Skip to content

Commit 7022868

Browse files
Revert "code changes for SQL query built from user-controlled sources"
This reverts commit 714d298.
1 parent 8de6a24 commit 7022868

File tree

1 file changed

+1
-8
lines changed

1 file changed

+1
-8
lines changed

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

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,9 @@
1010
using Microsoft.KernelMemory.AI;
1111
using Microsoft.KernelMemory.Diagnostics;
1212
using Microsoft.KernelMemory.MemoryStorage;
13-
using System.Text.RegularExpressions;
1413

1514
namespace Microsoft.KernelMemory.MemoryDb.SQLServer;
16-
// Accepts only [a-zA-Z_][a-zA-Z0-9_]{0,127}
17-
private static readonly Regex s_safeSqlIdentifierRegex = new Regex(@"^[a-zA-Z_][a-zA-Z0-9_]{0,127}$", RegexOptions.Compiled);
15+
1816
/// <summary>
1917
/// Represents a memory store implementation that uses a SQL Server database as its backing store.
2018
/// </summary>
@@ -764,11 +762,6 @@ private static string NormalizeIndexName(string index)
764762
ArgumentNullExceptionEx.ThrowIfNullOrWhiteSpace(index, nameof(index), "The index name is empty");
765763

766764
index = s_replaceIndexNameCharsRegex.Replace(index.Trim().ToLowerInvariant(), ValidSeparator);
767-
// Only allow index names that are valid SQL identifiers (start with a letter or underscore, followed by letters, digits, or underscores, max 128 chars)
768-
if (!s_safeSqlIdentifierRegex.IsMatch(index))
769-
{
770-
throw new ArgumentException("Invalid index name. Allowed: letters, digits, underscores, max length 128, cannot start with digit.", nameof(index));
771-
}
772765

773766
return index;
774767
}

0 commit comments

Comments
 (0)