322: MSSQL: read-only guard module (validateSql) with corpus tests #346
No reviewers
Labels
No labels
bug
chore
documentation
enhancement
feature
ready
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
david/pi-extensions-and-skills!346
Loading…
Reference in a new issue
No description provided.
Delete branch "feature/issue-322/mssql-read-only-guard-module-validatesql-with-corp"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
322: MSSQL: read-only guard module (validateSql) with corpus tests
Implements 322.
Generated in 1m 37s.
Review findings
Move the entry, and add the Low tests.# Review Findings — 322
Summary
I fixed the nested-comment finding and the two test-coverage findings. Three findings remain unresolved.
corpus-reject.mjsand fromKNOWN_GAPS. The SQL is valid, so I added it toguard.test.tsasnestedCommentHidingWrite_isAllowed. It couldn't go in the accept corpus, because the accept-corpus test requires every entry to start with SELECT or WITH.SELECT 1\nGO\nSELECT 2,SELECT * FROM #tmp,[into]andFOR XML, which pin the documented behaviour.index.tswiring (a scope decision), thetscscript (reserved for a separate chore) and the emptyKNOWN_FALSE_REJECTSlist (the new tests show those cases are allowed, so it stays empty).Critical
High
Medium
KNOWN_GAPS("comment: nested comment closes early if not nested-aware") is not a gap. The guard handles nested comments correctly, and the file's own comment says so. Listing it hides a corpus label whose expected behaviour differs from SQL Server's actual behaviour, and it weakens the "must-reject" corpus. Suggested fix: remove the entry fromcorpus-reject.mjs, or move it tocorpus-accept.mjsif the SQL is valid. Then drop it fromKNOWN_GAPS.validateSqlis not wired intomssql_queryinindex.ts, and the guard is not exported or referenced anywhere. If that is intentional for this issue, there is no gap. Otherwise the guard has no effect. Suggested fix: confirm a follow-up issue covers the wiring. If it does not, callvalidateSqlbefore executing inindex.ts.Low
GObatch-separator check is effectively redundant. Anything afterGOmust still start a statement and pass the keyword denylist, andGOlines containing;are already rejected. It also rejects a harmless line that starts withGO, such as an alias on its own line. Suggested fix: keep it as defence in depth, but add a test forSELECT 1\nGO\nSELECT 2to document the intent.KNOWN_FALSE_REJECTSis an empty array, and the comment above it lists examples (FOR XML, temp tables, unbracketed denied-keyword columns) that are not tested. Suggested fix: add accept or reject tests forSELECT * FROM #tmp, a column named[into], andFOR XMLso the documented behaviour is pinned..tsfiles (which use!non-null assertions and areasonunion) are unchecked beyond Node's type stripping. Suggested fix: add atsc --noEmitscript in a separate chore.