Repository navigation
Take back the table grants a hosted project gives anon - #10
Merged
Merged
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
🚧 Files skipped from review as they are similar to previous changes (2)
📝 WalkthroughWalkthroughThe database migrations revoke all ChangesAnonymous privilege control
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
The RLS suite failed its first run against a hosted project: `no session
sees nothing at all` expected `permission denied` and got a successful
select. `20260804101204_boards.sql` grants each table to `authenticated`
and says anon is granted nothing, which is true locally and false in
production — Supabase ships
alter default privileges for role postgres in schema public
grant all on tables to anon, authenticated, service_role;
and `db push` creates the tables as `postgres`, so each one arrived with
`grant all ... to anon`. Locally another role applies the migrations, the
default privilege never fires, and the two environments disagreed in
silence.
Nothing was exposed. Every policy is `to authenticated`, so RLS finds no
policy for anon and default-denies; the select returned no rows rather
than refusing. What was missing is the layer beneath the policies, the
one that would still hold if a policy were later written too loosely.
The behavioural test cannot guard this on its own — it passes locally
whether or not the revoke exists, because locally the grant never existed.
So the privilege is asserted directly, for the same reason `prosecdef` is.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TbSwVkGcNQZohV9VoeACRT
boubou666
force-pushed
the
worktree-anon-grant
branch
from
August 5, 2026 16:36
01b3429 to
a0cc2fb
Compare
|
Note GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer. |
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 RLS suite was pointed at a hosted Supabase project for the first time. 30 of 31 passed;
no session sees nothing at allfailed, because the select succeeded where it expectedpermission denied.20260804101204_boards.sqlgrants each table toauthenticatedand says in a comment thatanonis granted nothing. That is true on the local stack and false on a hosted project, which shipsand creates the tables as
postgreswhensupabase db pushapplies them. So every table arrived carryinggrant all ... to anon. Locally the migrations are applied by another role, the default privilege never fires, and the two environments disagreed in silence.Nothing was exposed. All twelve policies are
to authenticated, so RLS finds no policy foranonand default-denies — the select returned no rows rather than refusing. What was missing is the layer beneath the policies: the one that refuses outright, and so would still hold if a policy were later written too loosely.Changes
20260805153000_revoke_anon_table_grants.sqlrevokesanononboards,board_membersandboard_invites, stating the privilege in SQL instead of inheriting it from whichever role ran the file.test/db/rls.test.jsassertshas_table_privilege('anon', …)directly for the three tables. The behavioural test cannot guard this on its own: locally it passes whether or not the revoke exists, because locally the grant never existed. Same reasoning as the existingprosecdefassertion.20260804101204_boards.sql:136no longer claims something untrue of production.Verification
Applied to the hosted project and read back with
supabase db dump: noanontable grants remain, and theauthenticatedgrants are intact on all three tables.Known, deliberately not addressed
bump_board_version,freeze_board_owner,touch_updated_at) still carrygrant all ... to anon. Postgres refuses direct calls to trigger functions, but whether revokingexecuteaffects trigger firing was not verified, and production was not the place to find out.🤖 Generated with Claude Code
https://claude.ai/code/session_01TbSwVkGcNQZohV9VoeACRT
Summary by CodeRabbit
Bug Fixes
Tests