Repository navigation
fix(viewer): enforce readonly queries in data_query MCP tool - #277
Closed
SougataXdev wants to merge 1 commit into
Closed
SougataXdev wants to merge 1 commit into
SougataXdev wants to merge 1 commit into
Conversation
Author
|
@domoritz Could you please take a look at this PR when you get a chance? It addresses the read-only SQL issue in data_query. Thanks! |
The data_query tool claimed to be readonly but executed arbitrary SQL. Validate the statement client-side: allow only SELECT/WITH/VALUES/DESCRIBE/SHOW/EXPLAIN, reject stacked statements and DDL/DML keywords, ignoring strings and comments.
SougataXdev
force-pushed
the
fix/mcp-readonly-query
branch
from
October 7, 2026 07:52
adb25a2 to
03d9dbe
Compare
domoritz
requested changes
Oct 7, 2026
Author
|
Understood — regex allowlist is bypassable and would give false confidence. Closing this for now. If you want this hardened later, should it be a read-only DuckDB connection, removal/restriction of |
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.
The data_query MCP tool claimed to be readonly but executed arbitrary SQL (TODO at packages/viewer/src/model_context/model_context.ts:78).
This change validates the statement before running it:
Tests: