fix(server): validate SHOW statement expressions#293
Merged
Conversation
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
onequery-landing | e628ff4 | Commit Preview URL Branch Preview URL |
Jun 25 2026, 11:46 AM |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
One-Line Summary
Allow safe
SHOWmetadata queries while keeping side-effecting SQL expressions blocked.User-Facing Changes
SHOWmetadata statements can now pass read-only SQL validation.Only SELECT or SHOW queries are allowed. Got: ....SHOW ... WHERE GET_LOCK(...)andSHOW ... WHERE SLEEP(...)are rejected like the same functions inSELECT.Why This Changed
The read-only validator previously treated top-level
SHOWas non-select SQL and rejected metadata inspection queries. The first implementation allowedSHOWby bypassing read-only checks entirely, which left executable expressions inside MySQLSHOW ... WHEREclauses unchecked.How It Changed
SHOWstatements as read-only candidates alongsideSELECT.SHOWstatements so unsafe functions and nested side-effecting expressions are still rejected.SHOWcommand node without allowing nested side-effecting command nodes.SHOW, including metadata forms such asSHOW CREATE TABLE.Bug Fixes
SHOW ... WHEREclauses, side-effecting functions could pass validation afterSHOWwas added; this now rejectsGET_LOCKandSLEEP.Extra Context / Decisions (Optional)
SHOW CREATE TABLEis treated as read-only metadata even though the statement text contains theCREATEkeyword.Verification
rtk mise exec -- bun --cwd packages/server vitest run src/services/data-source-query/validate-sql.test.tsrtk mise exec -- bunx turbo test --json --filter=@onequery/server --filter=@onequery/connectorrtk mise exec -- bunx turbo typecheck --json --filter=@onequery/server --filter=@onequery/connectorrtk mise exec -- bun lint --format jsonrtk mise exec -- bun run formatrtk git push -u origin fix/show-readonly-validationran the pre-pushlint-fullhook successfully.Video / Screenshot (Optional)