docs: document the splinter.public_buckets contract - #190
Open
sidgaikwad wants to merge 1 commit into
Open
sidgaikwad wants to merge 1 commit into
sidgaikwad wants to merge 1 commit into
Conversation
0025_public_bucket_allows_listing reads its bucket list from the splinter.public_buckets setting, which the splinter.sql preamble populates transaction-locally. A consumer that runs the lint query outside that transaction gets an empty bucket list and zero findings, which reads as a clean result rather than a lint that never ran. The README already documents the equivalent pgrst.db_schemas contract, so document this one alongside it, including the single-transaction requirement and the same constraint for splinter.json consumers, whose manifest exposes setup and query as separate fields.
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.
Fixes #181 (suggestion 1 — documenting the contract; the fail-loud and self-contained-fallback options are left alone, since both change a security lint's behavior and are yours to call).
The problem
Since #170,
0025_public_bucket_allows_listingno longer readsstorage.buckets. It reads the bucket list from a setting:That setting is populated by the preamble in
splinter.sql, transaction-locally:So a consumer that runs the lint query outside that transaction reads an empty bucket list and gets zero findings — which reads as "no affected buckets" rather than "this lint never evaluated anything."
Reproduced
Against
supabase/postgres:17.6.1.136with one public bucket and one broadPERMISSIVESELECT policy onstorage.objects(for select to anon using (true)) — same file, same database, same exposure, only the invocation differs:psql --single-transaction -f splinter.sqlpublic_bucket_allows_listing / WARN / {SECURITY}psql -f splinter.sqlThe second run is silently green while the bucket is still listable.
What this changes
A
### Storage lints andsplinter.public_buckets`` section in the README, placed next to the existingpgrst.db_schemasone and following its shape: what the setting is, that the preamble sets it transaction-locally, the `--single-transaction` invocation, and what an invisible setting produces.It also notes the same constraint for
splinter.jsonconsumers.bin/compile_json.pyemitssetup(fromcompile.HEADER) and per-lintqueryas separate fields, andHEADERis exactly this preamble — plusset local search_path = '', which needs a transaction for the same reason. The manifest's own docstring describessetupas a "prelude run once, verbatim, before the lints", which doesn't say the lints must share its transaction.Scope
Docs only — no lint or compiler changes, so
splinter.sqlandsplinter.jsonare untouched.Two things from the issue I deliberately did not address, both still open for a maintainer decision:
[]is the actual fix for the hazard; this PR only makes the contract discoverable.bucket_id IN ('my-bucket'),'my-bucket' = bucket_idandbucket_id = 'my-bucket' AND truematch none of 0025's enumerated patterns, so those buckets yield no finding while staying listable. That's a separate lint change, and I'd be happy to take it as its own PR if you want it.