Skip to content

fix(db): restore anon get_user_id for published CLI without oracle leak - #3199

Merged
riderx merged 3 commits into
mainfrom
cursor/fix-get-user-id-anon-compat-c09a
Aug 25, 2026
Merged

riderx merged 3 commits into
mainfrom
cursor/fix-get-user-id-anon-compat-c09a

Conversation

@riderx

@riderx riderx commented Aug 25, 2026 •

Copy link
Copy Markdown
Member

Fixes #3197

Summary (AI generated)

  • GRANT EXECUTE ON FUNCTION public.get_user_id(text) TO anon so published CLI 8.42.x can call rpc/get_user_id again.
  • Leaves get_user_id(text, text), get_org_perm_for_apikey, get_org_perm_for_apikey_v2, and invite_user_to_org_rbac revoked for anon.
  • Updates security/oracle/RBAC tests: anon may call get_user_id(text); org-perm/invite/two-arg overload stay denied.

Motivation (AI generated)

PR #3189 revoked anonymous execute on get_user_id, breaking channel add and bundle upload for published CLI releases that still call .rpc('get_user_id', { apikey }). Main-branch CLI already uses request_actor_user_id, but that is not in a released cli-* tag yet.

Business Impact (AI generated)

Unblocks API-key CLI channel creation and bundle upload for customers on 8.42.x without reopening the org-perm/invite oracle RPCs.

Test Plan (AI generated)

  • get_user_id(text) succeeds for anon with a valid API key (published CLI pattern)
  • get_user_id(text, text) remains permission denied for anon
  • get_org_perm_for_apikey / v2 remain permission denied for anon
  • invite_user_to_org_rbac remains permission denied for anon
  • CI green

Generated with AI

Open in Web Open in Cursor 

View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

Review in cubic

Re-grant anonymous execute on get_user_id for published CLI versions
that still call rpc/get_user_id with { apikey }. Require matching capgkey
header for anon callers so keys cannot be probed from the RPC body alone.
Keep get_org_perm_for_apikey* and invite_user_to_org_rbac revoked for anon.

Fixes #3197

Co-authored-by: Martin DONADIEU <martindonadieu@gmail.com>
@coderabbitai

coderabbitai Bot commented Aug 25, 2026 •

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

  • Run on-demand review

On-demand reviews are free for the next 26 days. After that, they cost $0.25 per reviewed file.

Or wait 37 seconds for your next included review.

View limit details

Limit details: You’ve used the included review currently available. Your 62 included PR review attempts over the past 7 days set your current allowance at 1 review per hour.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: bb76300c-8b29-46ce-a34a-76fa5d72d043

📥 Commits

Reviewing files that changed from the base of the PR and between dc57849 and cefa2bc.

📒 Files selected for processing (4)
  • supabase/migrations/20260825105544_restore_get_user_id_anon_cli_compat.sql
  • tests/rbac-apikey-request-identity-rpc.test.ts
  • tests/security-definer-execute-hardening.test.ts
  • tests/security-oracle-rpc-hardening.test.ts

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

@codspeed

codspeed Bot commented Aug 25, 2026 •

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

✅ 43 untouched benchmarks
⏩ 2 skipped benchmarks1


Comparing cursor/fix-get-user-id-anon-compat-c09a (cefa2bc) with main (dc57849)

Open in CodSpeed

Footnotes

  1. 2 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩

Restore published CLI 8.42.x identity RPC without re-granting the
two-arg overload or org-perm/invite oracle RPCs.

Co-authored-by: Martin DONADIEU <martindonadieu@gmail.com>
Co-authored-by: Martin DONADIEU <martindonadieu@gmail.com>
@sonarqubecloud

Copy link
Copy Markdown

@riderx
riderx marked this pull request as ready for review August 25, 2026 11:31
@riderx
riderx merged commit dab26f5 into main Aug 25, 2026
60 of 75 checks passed
@riderx
riderx deleted the cursor/fix-get-user-id-anon-compat-c09a branch August 25, 2026 11:31

This branch was previously deployed

1 inactive deployment
deepsec-pr — cefa2bc3 Deployed Aug 25, 2026 by cursor[bot] via Scan PR changes #5213
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.

Capgo CLI 8.42.3 fails with permission denied for function get_user_id

2 participants