Skip to content

Commit 1afa4ee

Browse files
Merge pull request #78 from Azure-Samples/fixreadtool
fix read data to exclude INTO clause
2 parents c8eb7b0 + f99eaf8 commit 1afa4ee

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

MssqlMcp/Node/src/tools/ReadDataTool.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,14 @@ export class ReadDataTool implements Tool {
2424
'GRANT', 'REVOKE', 'COMMIT', 'ROLLBACK', 'TRANSACTION',
2525
'BEGIN', 'DECLARE', 'SET', 'USE', 'BACKUP',
2626
'RESTORE', 'KILL', 'SHUTDOWN', 'WAITFOR', 'OPENROWSET',
27-
'OPENDATASOURCE', 'OPENQUERY', 'OPENXML', 'BULK'
27+
'OPENDATASOURCE', 'OPENQUERY', 'OPENXML', 'BULK', 'INTO'
2828
];
2929

3030
// Regex patterns to detect common SQL injection techniques
3131
private static readonly DANGEROUS_PATTERNS = [
32+
33+
// SELECT INTO operations that create new tables
34+
/SELECT\s+.*?\s+INTO\s+/i,
3235
// Semicolon followed by dangerous keywords
3336
/;\s*(DELETE|DROP|UPDATE|INSERT|ALTER|CREATE|TRUNCATE|EXEC|EXECUTE|MERGE|REPLACE|GRANT|REVOKE)/i,
3437

0 commit comments

Comments
 (0)