Summary
Add security scanner to detect common SQL injection patterns in parsed SQL.
Problem
Parser doesn't detect security patterns - need to help developers identify potential SQL injection vulnerabilities.
Action Items
-
Create security scanner package: pkg/sql/security/
-
Detect common injection patterns:
- Tautologies:
1=1, 'a'='a', OR 1=1
- Comment-based bypasses:
--, /**/, #
- Stacked queries:
; DROP TABLE, ; DELETE FROM
- UNION-based extraction:
UNION SELECT in suspicious contexts
- Time-based blind:
SLEEP(), WAITFOR DELAY
- Boolean-based blind: Suspicious boolean logic patterns
- Out-of-band:
xp_cmdshell, LOAD_FILE(), etc.
-
Add severity levels:
- CRITICAL: Definite injection (e.g.,
OR 1=1 --)
- HIGH: Likely injection (suspicious patterns)
- MEDIUM: Potentially unsafe (needs review)
- LOW: Informational
-
CLI integration:
gosqlx security-scan query.sql
gosqlx security-scan --severity high *.sql
-
API integration for programmatic use
Acceptance Criteria
Technical Details
Priority: Medium
Effort: Medium (32h)
Phase: Phase 4 - Feature Development
Dependencies: None
Example Output
CRITICAL: SQL Injection detected in query.sql:3
WHERE username = 'admin' OR '1'='1'
^^^^^^^^^
Pattern: Tautology (always true condition)
Risk: Authentication bypass
Related
Unique security feature vs competitors
Summary
Add security scanner to detect common SQL injection patterns in parsed SQL.
Problem
Parser doesn't detect security patterns - need to help developers identify potential SQL injection vulnerabilities.
Action Items
Create security scanner package:
pkg/sql/security/Detect common injection patterns:
1=1,'a'='a',OR 1=1--,/**/,#; DROP TABLE,; DELETE FROMUNION SELECTin suspicious contextsSLEEP(),WAITFOR DELAYxp_cmdshell,LOAD_FILE(), etc.Add severity levels:
OR 1=1 --)CLI integration:
gosqlx security-scan query.sql gosqlx security-scan --severity high *.sqlAPI integration for programmatic use
Acceptance Criteria
Technical Details
Priority: Medium
Effort: Medium (32h)
Phase: Phase 4 - Feature Development
Dependencies: None
Example Output
Related
Unique security feature vs competitors