Skip to content

Commit eb088f6

Browse files
changes for added suppressions
1 parent 61650a4 commit eb088f6

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

App/kernel-memory/extensions/SQLServer/SQLServer/SqlServerMemory.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ FOREIGN KEY ([memory_id]) REFERENCES {this.GetFullTableName(this._config.MemoryT
118118
try
119119
{
120120
SqlCommand command = connection.CreateCommand();
121+
// codeql[cs/sql-injection] Index name sanitized by NormalizeIndexName with regex ^[a-zA-Z_][a-zA-Z0-9_]{0,127}$
121122
command.CommandText = sql;
122123
command.Parameters.AddWithValue("@index", index);
123124
await command.ExecuteNonQueryAsync(cancellationToken).ConfigureAwait(false);
@@ -170,6 +171,7 @@ DELETE [tags]
170171
try
171172
{
172173
SqlCommand command = connection.CreateCommand();
174+
// codeql[cs/sql-injection] Index name sanitized by NormalizeIndexName with regex ^[a-zA-Z_][a-zA-Z0-9_]{0,127}$
173175
command.CommandText = sql;
174176
command.Parameters.AddWithValue("@index", index);
175177
command.Parameters.AddWithValue("@key", record.Id);
@@ -214,6 +216,7 @@ public async Task DeleteIndexAsync(string index, CancellationToken cancellationT
214216
SqlCommand command = connection.CreateCommand();
215217
try
216218
{
219+
// codeql[cs/sql-injection] Index name sanitized by NormalizeIndexName with regex ^[a-zA-Z_][a-zA-Z0-9_]{0,127}$
217220
command.CommandText = sql;
218221
command.Parameters.AddWithValue("@index", index);
219222
await command.ExecuteNonQueryAsync(cancellationToken).ConfigureAwait(false);
@@ -240,6 +243,7 @@ public async Task<IEnumerable<string>> GetIndexesAsync(CancellationToken cancell
240243
SqlCommand command = connection.CreateCommand();
241244
try
242245
{
246+
// codeql[cs/sql-injection] Schema and table names from configuration, not user input
243247
command.CommandText = sql;
244248
var dataReader = await command.ExecuteReaderAsync(cancellationToken).ConfigureAwait(false);
245249
while (await dataReader.ReadAsync(cancellationToken).ConfigureAwait(false))
@@ -533,6 +537,7 @@ WHEN NOT MATCHED THEN
533537
foreach (var record in list)
534538
{
535539
SqlCommand command = connection.CreateCommand();
540+
// codeql[cs/sql-injection] Index name sanitized by NormalizeIndexName with regex ^[a-zA-Z_][a-zA-Z0-9_]{0,127}$
536541
command.CommandText = sql;
537542
command.Parameters.AddWithValue("@index", index);
538543
command.Parameters.AddWithValue("@key", record.Id);
@@ -644,6 +649,7 @@ FOREIGN KEY ([collection]) REFERENCES {this.GetFullTableName(this._config.Memory
644649
SqlCommand command = connection.CreateCommand();
645650
try
646651
{
652+
// codeql[cs/sql-injection] Schema and table names from configuration, not user input
647653
command.CommandText = sql;
648654
await command.ExecuteNonQueryAsync(cancellationToken).ConfigureAwait(false);
649655
}

0 commit comments

Comments
 (0)