Repository navigation
fix(sparql): require data:write for SPARQL UPDATE - #139
Merged
Merged
Conversation
The SPARQL route authorized every request with data:read, so a key issued with only data:read could run INSERT DATA, DELETE WHERE or DROP ALL and mutate or wipe a world. Parse the query before authorizing and require data:write for updates, data:read otherwise. An unparseable query is rejected as INVALID_ARGUMENT before it runs. The namespace and world check still runs before parsing. Fixes #138 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
EthanThatOneKid
added a commit
to wazootech/docs.wazoo.dev
that referenced
this pull request
Oct 18, 2026
* docs: stop claiming Worlds is an append-only ledger Worlds stores current state: updates delete and insert quads, and no history, timestamp or per-quad provenance is kept. Reword every Worlds claim of an append-only or chronological ledger, immutable or per-quad provenance, and queryable past states to what is true, and drop the "When Worlds fits" bullets that only sold history. Claims that describe other products (Graphiti's bi-temporal edges, Kafka's logs) stay. update.mdx also called SPARQL on the data plane read-only; it accepts SPARQL UPDATE, which requires data:write (wazootech/worlds-api#139). Fixes #191 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs(update): name the planned append-only change log History is not retained yet; point to the planned change log, which is the part that will be append-only (wazootech/worlds-sdk-ts#221). The world's current state stays mutable. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Oct 18, 2026
EthanThatOneKid
added a commit
that referenced
this pull request
Oct 18, 2026
The route description now says SELECT and ASK need data:read and SPARQL UPDATE needs data:write (enforced since #139), and that an unparseable query returns 400. Snapshot regenerated with sync:openapi. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
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.
What
POST /worlds/{worldId}/sparqlauthorized every request withdata:read, so a key issued with["data:read"]could runINSERT DATA,DELETE WHERE,DROP ALLand so on, and mutate or wipe a world. Fixes #138.@wazoo/sparql-engine/parser, default options, same asWazooSparqlEngine). It requiresdata:writefor an update anddata:readfor a query. The decision is made before execution, not from the result kind.400 INVALID_ARGUMENTwithout reaching the engine.403without any feedback about its query.Tests
tests/abuse.test.ts, under "scope enforcement":data:readkey gets403namingdata:writefor each of 7 update forms (INSERT DATA,DELETE DATA,DELETE WHERE,INSERT … WHERE,DELETE/INSERT … WHERE,CLEAR,DROP), and the SDK is never called.data:readkey can still run SELECT and ASK.data:read+data:writekey and the admin key can run updates.I ran the new tests against the unfixed route: the 7 update cases and the unparseable case fail there. With the fix, the full suite passes (226 tests) and typecheck is clean.
Not observed
deploy-qaandhealth-qarun only on push tomain.403, which is the intended behavior.🤖 Generated with Claude Code