fix(server): allow readonly metadata statements#297
Merged
Conversation
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
onequery-landing | d753dca | Commit Preview URL Branch Preview URL |
Jun 26 2026, 02:59 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 read-only SQL metadata statements such as
SHOW,DESCRIBE, andEXPLAINwithout bypassing existing safety validation.User-Facing Changes
SHOWmetadata queries remain allowed across supported providers.DESCRIBEandDESCmetadata queries are now accepted by the read-only SQL validator.EXPLAIN SELECT ...andEXPLAIN ANALYZE SELECT ...are now accepted when the parser exposes the explained query for validation.SLEEP()orGET_LOCK(), are still rejected.Why This Changed
The previous implementation handled metadata statements as provider-specific branches. That worked for
SHOW, but it made adding similar read-only statements likeDESCRIBEandEXPLAINrequire more special cases and risked skipping existing AST-level safety checks.How It Changed
SHOW,DESCRIBE/DESC, andEXPLAIN.SELECT INTO, locking clauses, unsafe functions, and side-effecting expressions.DESCRIBE,DESC, and safeEXPLAINforms.Bug Fixes
DESCRIBEqueries were rejected even though they are read-only metadata operations.Extra Context / Decisions (Optional)
EXPLAINis not allowed as an opaque command when the parser cannot expose the explained query AST, because that would prevent the validator from seeing unsafe nested operations.Verification
rtk mise exec -- bun --cwd packages/server vitest run src/services/data-source-query/validate-sql.test.ts src/services/data-source-query/execute-query.test.tsrtk mise exec -- bun --cwd apps/connector vitest run src/jobs/validation.test.tsrtk mise exec -- bunx turbo typecheck --json --filter=@onequery/server --filter=@onequery/connectorrtk mise exec -- bunx turbo test --json --filter=@onequery/server --filter=@onequery/connectorrtk mise exec -- bun lint --format jsonrtk mise exec -- bun run formatrtk git push -u origin fix/general-readonly-metadata-statementsran pre-pushlint-fullsuccessfully.Video / Screenshot (Optional)