You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
DESTRUCTIVE_PATTERN = /\b(DROP|DELETE|TRUNCATE|ALTER)\b/i is the production guard for SQL execution.
Problem
Per docs/audits/results.md F20.
Misses: RENAME TABLE (irreversible), GRANT ALL, REVOKE ALL, SET PASSWORD FOR, LOCK TABLES WRITE, KILL. MySQL conditional comment /*! DROP */ TABLE users bypasses because the JS regex doesn't strip comments. DR'op' TABLE users (string-split identifier) also bypasses.
Files
src/stores/resultStore.ts:8
Repro (if applicable)
Static analysis only.
Expected
GRANT ALL ON *.* TO 'alice'@'%' against a production connection shows the confirm dialog. RENAME TABLE users TO users_old shows the dialog. SELECT still goes through.
Proposed fix
Scope M. Extend regex to /\b(DROP|DELETE|TRUNCATE|ALTER|RENAME|GRANT|REVOKE|SET\s+PASSWORD|KILL|LOCK\s+TABLES)\b/i. Strip -- and /* */ comments before matching. Consider blocking multi-statement batches on production.
Acceptance
GRANT/REVOKE/RENAME/SET PASSWORD/KILL/LOCK trigger the dialog; SELECT still passes.
Fixed by #531 (commit b4297c1). The four-verb regex was replaced with src/lib/sql-safety.ts, which strips string literals and comments before matching — and specifically unwraps MySQL conditional comments (/*!50000 DROP ... */) rather than stripping them, because the server executes their contents. GRANT, REVOKE, RENAME and KILL are in the verb set, and CTE-prefixed writes resolve through statement_after_cte.
Not auto-closed because the PR body wrote Refs #415 rather than a closing keyword.
Activity
fix(grid): stop a typed boolean becoming 0, and widen the production …
EVWorth commentedon Sep 4, 2026
Fixed by #531 (commit b4297c1). The four-verb regex was replaced with src/lib/sql-safety.ts, which strips string literals and comments before matching — and specifically unwraps MySQL conditional comments (
/*!50000 DROP ... */) rather than stripping them, because the server executes their contents. GRANT, REVOKE, RENAME and KILL are in the verb set, and CTE-prefixed writes resolve throughstatement_after_cte.Not auto-closed because the PR body wrote
Refs #415rather than a closing keyword.