refactor: extract SQL parser from regex to AST-based validation #16
Labels
No labels
P1
P2
P3
PHP
agent-ready
bug
clotho
discovery
docs
refactor
review
security
testing
athena
athena-gemini
audit
clotho
clotho-gemini
codex
darbs-claude
security
wiki
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: core/php-mcp#16
Loading…
Add table
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
Summary
The
SqlQueryValidator(src/Mcp/Services/SqlQueryValidator.php) currently uses regular expressions for SQL parsing and validation. This approach is fragile, hard to maintain, and can be bypassed with creative SQL syntax.Problem
Proposed Solution
Replace regex-based validation with an AST (Abstract Syntax Tree) parser:
greenlion/php-sql-parserorphpmyadmin/sql-parser)Files
src/Mcp/Services/SqlQueryValidator.phptests/Unit/SqlQueryValidatorTest.php(update tests)Notes
Also noted in TODO.md under Code Quality. Estimated effort: 8-10 hours.