[codex] fix API key RBAC oracle#2060
Conversation
|
ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (4)
📝 WalkthroughWalkthroughThis PR introduces three new API key authorization and enforcement functions in Supabase: a CLI permission wrapper that validates apikey headers and delegates to RBAC checks, an app-listing function that filters accessible apps by header-based API key identity, and a trigger function that enforces organization-specific API key expiration policies. Comprehensive SQL and E2E tests validate header-based auth, permission enforcement, and expiration constraints across multiple scenarios. ChangesAPI Key RBAC and Expiration Enforcement
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 SQLFluff (4.1.0)supabase/migrations/20260507090436_fix_apikey_rbac_rpc_oracle_and_expiration_scope.sqlUser Error: No dialect was specified. You must configure a dialect or specify one on the command line using --dialect after the command. Available dialects: supabase/tests/49_test_apikey_oracle_rpc_permissions.sqlUser Error: No dialect was specified. You must configure a dialect or specify one on the command line using --dialect after the command. Available dialects: supabase/tests/42_test_apikey_expiration.sqlUser Error: No dialect was specified. You must configure a dialect or specify one on the command line using --dialect after the command. Available dialects: Comment |
0c44af8 to
555b95b
Compare
|



Summary (AI generated)
Motivation (AI generated)
The existing wrapper RPCs accepted arbitrary apikey arguments from anon callers, bypassing the earlier public EXECUTE revocation on get_user_id(text). The expiration trigger also skipped policy checks for unscoped API keys.
Business Impact (AI generated)
This reduces API-key oracle and metadata exposure risk while preserving CLI compatibility for clients that already send capgkey headers. It also enforces organization API-key expiration settings consistently for unscoped user keys.
Test Plan (AI generated)
Generated with AI
Summary by CodeRabbit
New Features
Tests