Skip to content

[codex] Mask SQL literals in query_graph guard#206

Merged
yibeichan merged 2 commits into
mainfrom
codex/issue-200-query-graph-sql-mask
Jun 11, 2026
Merged

[codex] Mask SQL literals in query_graph guard#206
yibeichan merged 2 commits into
mainfrom
codex/issue-200-query-graph-sql-mask

Conversation

@yibeichan

Copy link
Copy Markdown
Owner

Summary

  • port SQL literal/comment masking to the TypeScript query_graph guard
  • allow valid SELECT usage of SQLite REPLACE()
  • keep write-keyword rejection for executable SQL text outside literals/comments
  • add regression coverage for REPLACE(), string literals, and comments

Root cause

queryGraph scanned the raw SQL text for write keywords before execution. That rejected safe SELECT queries when a blocked word appeared as a SQLite function name, in a string literal, or in a comment. The Python CLI already masks literals/comments before keyword checks; the MCP path did not.

Validation

  • npm test -- --testPathPatterns=query-graph-tool.test.ts
  • npm test

Closes #200

@yibeichan yibeichan marked this pull request as ready for review June 11, 2026 20:34
@yibeichan yibeichan merged commit a7d547a into main Jun 11, 2026
5 checks passed
@yibeichan yibeichan deleted the codex/issue-200-query-graph-sql-mask branch June 11, 2026 23:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: queryGraph falsely rejects SELECT queries using REPLACE() and keywords in string literals

1 participant