Skip to content

fix: remove anon read access to interfaces_feedback - #52534

Merged
kanadgupta merged 1 commit into
masterfrom
kanad-claude/remove-anon-read-path-a941f2
Nov 2, 2026
Merged

kanadgupta merged 1 commit into
masterfrom
kanad-claude/remove-anon-read-path-a941f2

Conversation

@kanadgupta

@kanadgupta kanadgupta commented Oct 29, 2026 •

Copy link
Copy Markdown
Member

Problem

The CLI (supabase/cli#5988) and MCP server (supabase/mcp#474) only submit and delete feedback. Neither reads it back. But anon can still read a row's feedback text with its delete token, so a leaked token exposes the submission.

Linear: CLI-2406

Solution

New migration on public.interfaces_feedback:

  • Revoke all privileges from anon and authenticated, then grant anon only delete and select (delete_token).
  • Rename the select policy to "Token holders can match their own feedback for deletion".
  • Update the delete_token column comment to say it authorizes deletes only.

Key choices:

  • The select policy and select (delete_token) stay. Clients delete with a delete_token=eq.<token> filter. A filtered delete needs select on the filtered column and must pass the select policy. Tested locally: revoking the grant makes deletes fail with 42501, and dropping the policy makes them silently match 0 rows.
  • Privileges are reset, not revoked column by column. Default grants differ between Postgres images. On the current local image, anon gets every table privilege by default, which overrides column-level grants. Starting from revoke all gives the same end state everywhere.

No client changes are needed. The delete policy and submit_interfaces_feedback are unchanged.

Review instructions

Run these against a local stack (supabase db reset) or this PR's preview branch. Replace the placeholders:

  • <PROJECT_URL>: for example http://127.0.0.1:54321
  • <ANON_KEY>: the project's anon key
  • <DELETE_TOKEN>: the token returned in step 1 or 5
  1. Submit feedback. The response is the delete token.

    curl -X POST '<PROJECT_URL>/rest/v1/rpc/submit_interfaces_feedback' \
      -H 'apikey: <ANON_KEY>' \
      -H 'Content-Type: application/json' \
      -d '{"feedback": "test"}'
  2. Try to read the feedback with the token. Expect 401 with code 42501.

    curl '<PROJECT_URL>/rest/v1/interfaces_feedback?select=feedback&delete_token=eq.<DELETE_TOKEN>' \
      -H 'apikey: <ANON_KEY>' \
      -H 'x-feedback-token: <DELETE_TOKEN>'

    Only select=delete_token succeeds. Every other column returns 42501.

  3. Delete without the token header. Expect Content-Range: */0.

    curl -i -X DELETE '<PROJECT_URL>/rest/v1/interfaces_feedback?delete_token=eq.<DELETE_TOKEN>' \
      -H 'apikey: <ANON_KEY>' \
      -H 'Prefer: count=exact'
  4. Delete with the token header. Expect Content-Range: */1.

    curl -i -X DELETE '<PROJECT_URL>/rest/v1/interfaces_feedback?delete_token=eq.<DELETE_TOKEN>' \
      -H 'apikey: <ANON_KEY>' \
      -H 'Prefer: count=exact' \
      -H 'x-feedback-token: <DELETE_TOKEN>'
  5. Submit feedback with a project ref and user ID.

    curl -X POST '<PROJECT_URL>/rest/v1/rpc/submit_interfaces_feedback' \
      -H 'apikey: <ANON_KEY>' \
      -H 'Content-Type: application/json' \
      -d '{"feedback": "test", "project_ref": "my-project", "user_id": "my-user"}'
  6. Delete with only the token header. Expect Content-Range: */0.

    curl -i -X DELETE '<PROJECT_URL>/rest/v1/interfaces_feedback?delete_token=eq.<DELETE_TOKEN>' \
      -H 'apikey: <ANON_KEY>' \
      -H 'Prefer: count=exact' \
      -H 'x-feedback-token: <DELETE_TOKEN>'
  7. Delete with all three headers. Expect Content-Range: */1.

    curl -i -X DELETE '<PROJECT_URL>/rest/v1/interfaces_feedback?delete_token=eq.<DELETE_TOKEN>' \
      -H 'apikey: <ANON_KEY>' \
      -H 'Prefer: count=exact' \
      -H 'x-feedback-token: <DELETE_TOKEN>' \
      -H 'x-feedback-project-ref: my-project' \
      -H 'x-feedback-user-id: my-user'
  8. Optional: run supabase feedback add and supabase feedback delete against this PR's preview branch. Both succeed (already confirmed).

🤖 Generated with Claude Code

Clients only submit and delete feedback, so a leaked delete token should
not be usable to read a submission. Reset anon/authenticated privileges
and grant anon only what token-scoped deletes need: delete, plus select
on delete_token.

Generated with AI

Co-Authored-By: Claude <[email protected]>
@vercel

vercel Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
design-system Ready Ready Preview Oct 29, 2026 9:14pm UTC
docs Ready Ready Preview, v0 Oct 29, 2026 9:14pm UTC
kb Ready Ready Preview Oct 29, 2026 9:14pm UTC
studio-self-hosted Ready Ready Preview Oct 29, 2026 9:14pm UTC
studio-staging Ready Ready Preview Oct 29, 2026 9:14pm UTC
ui-library Ready Ready Preview Oct 29, 2026 9:14pm UTC
zone-www-dot-com Ready Ready Preview, v0 Oct 29, 2026 9:14pm UTC
1 Skipped Deployment
Project Deployment Actions Updated
studio Ignored Ignored Oct 29, 2026 9:14pm UTC

Request Review

@supabase

supabase Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

Updates to Preview Branch (kanad-claude/remove-anon-read-path-a941f2) ↗︎

Deployments Status Updated
Database ⚠️ Thu, 29 Oct 2026 21:11:43 UTC
Services ⚠️ Thu, 29 Oct 2026 21:11:43 UTC
APIs ⚠️ Thu, 29 Oct 2026 21:11:43 UTC

Tasks are run on every commit but only new migration files are pushed.
Close and reopen this PR if you want to apply changes from existing seed or migration files.

Tasks Status Updated
Configurations ⚠️ Thu, 29 Oct 2026 21:15:03 UTC
Migrations ✅ Thu, 29 Oct 2026 21:15:07 UTC
Seeding ✅ Thu, 29 Oct 2026 21:15:08 UTC
Edge Functions ✅ Thu, 29 Oct 2026 21:15:09 UTC

⚠️ Warning — Service health check failed
⚠️ Warning — Service health check failed


View logs for this Workflow Run ↗︎.
Learn more about Supabase for Git ↗︎.

@coderabbitai

coderabbitai Bot commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Walkthrough

The migration revokes table privileges on public.interfaces_feedback from anon and authenticated. It grants anon select access to delete_token and delete access, renames the existing feedback-read policy, and updates the token column comment.

Changes: Feedback deletion access

Layer / File(s) Summary
Feedback deletion access
supabase/migrations/20261029120000_restrict_interfaces_feedback_reads.sql
The migration revokes table privileges from anon and authenticated, grants anon select access to delete_token and delete access, renames the existing policy, and documents the deletion headers in the token column comment.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Possibly related PRs

Suggested reviewers: awaseem

Merge Risk: Minimal · up to 83d4a

The migration restricts feedback reads while preserving the intended token-scoped deletion grants. No demonstrated merge-blocking issue remains.

Pre-merge checks: Passed 4
Check name Status Explanation
Title check Passed The title "fix: remove anon read access to interfaces_feedback" matches the main change. The migration revokes all privileges from anon and authenticated on public.interfaces_feedback and grants anon …
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Description check Passed The description includes a clear Problem, detailed Solution, key design choices, and numbered Review instructions. It omits the repository Checklist section, but the required change context and valida…
Full details: Title check

Explanation

The title "fix: remove anon read access to interfaces_feedback" matches the main change. The migration revokes all privileges from anon and authenticated on public.interfaces_feedback and grants anon only delete and select on delete_token. The title names the core security fix, although it does not mention the renamed policy or the column comment update.

Full details: Description check

Explanation

The description includes a clear Problem, detailed Solution, key design choices, and numbered Review instructions. It omits the repository Checklist section, but the required change context and validation steps are complete.

Finishing Touches
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@kanadgupta
kanadgupta requested review from a team and mattrossman October 30, 2026 23:03
@kanadgupta
kanadgupta merged commit dc3cbef into master Nov 2, 2026
44 checks passed
@kanadgupta
kanadgupta deleted the kanad-claude/remove-anon-read-path-a941f2 branch November 2, 2026 20:20
@github-actions

github-actions Bot commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

Braintrust eval report

Assistant (master-1793650993)

Score Average Improvements Regressions
Completeness 91% (+0pp) 5 🟢 6 🔴
Conciseness 61.1% (+1pp) 21 🟢 23 🔴
Correctness 77.5% (-1pp) 9 🟢 13 🔴
Docs Faithfulness 52% (-2pp) 5 🟢 5 🔴
Goal Completion 77.4% (0pp) 9 🟢 11 🔴
Knowledge Usage 92.9% (-7.000000000000001pp) - 2 🔴
SQL Identifier Quoting 100% (+0pp) - -
SQL Validity 100% (+0pp) - -
Safety 93.3% (+2pp) 2 🟢 1 🔴
Tool Usage 86.9% (-2pp) 2 🟢 4 🔴
URL Validity 100% (+0pp) - -
Time_to_first_token 2.61tok (-0.51tok) 65 🟢 13 🔴
Llm_calls 10.51 (+0.19) 29 🟢 22 🔴
Tool_calls 3.37 (-0.02) 30 🟢 34 🔴
Errors 0.02 (+0.01) - 2 🔴
Llm_errors 0 (+0) - -
Tool_errors 0.02 (+0.01) - 2 🔴
Prompt_tokens 70111.16tok (+2237.14tok) 34 🟢 40 🔴
Prompt_cached_tokens 50673.73tok (+352.3tok) 38 🟢 33 🔴
Prompt_cache_creation_tokens 19418.77tok (+1884.35tok) 35 🟢 39 🔴
Prompt_cache_creation_5m_tokens 0tok (+0tok) - -
Prompt_cache_creation_1h_tokens 0tok (+0tok) - -
Completion_tokens 1499.14tok (-20.34tok) 40 🟢 38 🔴
Completion_reasoning_tokens 439.69tok (-6.17tok) 39 🟢 38 🔴
Completion_accepted_prediction_tokens 0tok (+0tok) - -
Completion_rejected_prediction_tokens 0tok (+0tok) - -
Completion_audio_tokens 0tok (+0tok) - -
Total_tokens 71610.3tok (+2216.79tok) 36 🟢 42 🔴
Estimated_cost 0$ (+0$) 32 🟢 34 🔴
Duration 13.01s (-1.38s) 56 🟢 22 🔴
Llm_duration 24.91s (-2.52s) 56 🟢 22 🔴

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants