Repository navigation
fix(safe-mode): classify grid browse sentinels as reads - #4397
Merged
Merged
Conversation
BigQuery, Spanner, Elasticsearch, Typesense and etcd build grid browse/search as opaque tagged requests; the classifier graded them .write, so Read-Only blocked browse_table and the grid's Fetch All. Recognize them as reads. A BigQuery or Spanner tag carrying a __RAW__ filter still grades .write, so it cannot bypass Read-Only.
…ssified-write # Conflicts: # apple/TablePro/Core/Utilities/SQL/QueryClassifier.swift
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.
Summary
QueryClassifiergraded the opaque grid browse/search/count sentinels five engines build (BIGQUERY_BROWSE:/_COMBINED:/_FILTER:/_SEARCH:,SPANNER_BROWSE:,ELASTICSEARCH_SEARCH:,TYPESENSE_SEARCH:,ETCD_RANGE:/ETCD_COUNT:) as.write: BigQuery and Spanner had no classifier case, and the Elasticsearch, Typesense and etcd cases parse an HTTP verb or command, not the tag.browse_tableand the grid's Fetch All failed with "Cannot execute write queries" on these engines (macOS: BigQuery MCPbrowse_tableblocked in Read-Only Safe Mode #4385, reported on BigQuery)..safe, the way memcached, bigtable, qdrant, weaviate and firebase already do. Only an exact registered tag prefix reads as a read; real SQL, real writes and destructive statements keep their tier.ETCD_REFUSAL:marker as a read, so a refused filter surfaces its real error instead of a write denial (memcached already does this withMEMCACHED_REFUSAL:).ExternalStatementGate.privateRequestRefusalstill refuses these tags from outside the app (tier-independent), and no real write or destructive statement changes tier.Test plan
QueryClassifierNonSqlTests.bigQueryTiers/spannerTiers, and additions toetcdTiers/elasticsearchTiers/typesenseTiers: each tag reads as a read, whileSELECT/INSERT/DROPkeep safe/write/destructive. Fail on main, pass here.driverBrowseMarkersReadAsReadspins every browse/search/count marker inExternalStatementGate.driverRequestMarkersto.safe, so a future unrecognized read marker fails the test.verify.sh build;verify.sh test QueryClassifierNonSqlTests.Fixes #4385