fix(sql-builder): block INTO OUTFILE and INTO FILE by duyet · Pull Request #3229 · chmonitor/chmonitor · GitHub
Skip to content

fix(sql-builder): block INTO OUTFILE and INTO FILE - #3229

Merged
duyet merged 1 commit into
mainfrom
fix/sql-validator-outfile
Aug 23, 2026
Merged

fix(sql-builder): block INTO OUTFILE and INTO FILE#3229
duyet merged 1 commit into
mainfrom
fix/sql-validator-outfile

Conversation

@duyet

@duyet duyet commented Aug 23, 2026

Copy link
Copy Markdown
Member

Closes #3222

ClickHouse SELECT ... INTO OUTFILE (and the INTO FILE alias) writes
query output to a server-side file path, a data-movement side effect
outside read-only monitoring. The sql-validator denylist had no
clause for it, so a SELECT that starts with SELECT (and thus passes
the statement-type gate) could carry an INTO OUTFILE write through.

Add an INTO_FILE_WRITE pattern to SQL_PATTERNS and wire it into
SQL_INJECTION_PATTERNS. It scans the literal-blanked copy so a
LIKE '%INTO OUTFILE%' audit query is not mis-flagged, while the real
clause tokens (which sit outside a literal) are still blocked.

Closes #3222

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: duyetbot <bot@duyet.net>
@duyet
duyet enabled auto-merge (squash) August 23, 2026 04:17
@github-actions github-actions Bot added the area: packages Shared packages/* label Aug 23, 2026
@codecov

codecov Bot commented Aug 23, 2026

Copy link
Copy Markdown

@github-actions

Copy link
Copy Markdown
Contributor

☁️ Cloudflare Preview Deployment

App Preview URL
Dashboard https://preview.dash.chmonitor.dev
MCP https://preview.dash.chmonitor.dev/api/mcp
Landing https://preview.chmonitor.dev
Docs https://preview.docs.chmonitor.dev
Property Value
Commit 00b7293
Deployed at 2026-08-23T04:20:42.451Z

Previews are automatically updated on every push to this PR.
Unchanged apps keep their previous preview (path-filtered deploys).

@duyet
duyet merged commit 4ef0bc4 into main Aug 23, 2026
23 checks passed
@duyet
duyet deleted the fix/sql-validator-outfile branch August 23, 2026 04:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: packages Shared packages/*

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[audit] sql-validator has no INTO OUTFILE / INTO FILE pattern or test P3

1 participant