Repository navigation
Conversation
When adding a resource in the scoped access token form, the new permission row was seeded with the resource's entire action set (read/write/create/delete). A newly added resource should be least-privilege by default, just `read`, or the first available action, so tokens meant to be narrowly scoped aren't granted more than intended. Seed the row through a shared getDefaultActions() helper (used by both form and the toggle util) and add a component test asserting a single default action. Signed-off-by: Dhruv Chauhan <[email protected]>
|
Thanks for contributing to Supabase! ❤️ Our team will review your PR. A few tips for a smoother review process:
|
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
@dhruv2x is attempting to deploy a commit to the Supabase Team on Vercel. A member of the Team first needs to authorize it. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughThe permissions form now initializes newly selected resources with least-privilege actions, preferring ChangesScoped permission defaults
Possibly related issues
Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
|
hello @djhi can you have a look? |
|
As @awaseem said in the issue: This isn't even out to users btw, its behind a flag since we're actively working on it... |
When adding a resource in the scoped access token form, the new permission row was seeded with the resource's entire action set (read/write/create/delete). A newly added resource should be least-privilege by default, just
read, or the first available action, so tokens meant to be narrowly scoped aren't granted more than intended.Seed the row through a shared getDefaultActions() helper (used by both form and the toggle util) and add a component test asserting a single default action.
I have read the CONTRIBUTING.md file.
Yes
What kind of change does this PR introduce?
Bug fix. Fixes: #48175
What is the current behavior?
In the "Generate scoped token" form (Account → Access Tokens → scoped), adding a
resource under Configure permissions pre-selects all of that resource's
actions (e.g. read, write, create, delete). The access dropdown shows
"N selected" with every checkbox ticked. If the user submits without manually
deselecting, the created token is granted every action for that resource rather
than a minimal default. the opposite of what a scoped, least-privilege token
is for.
No existing issue. found while reviewing the scoped access token form.
What is the new behavior?
Adding a resource now selects a single least-privilege action by default:
readwhen the resource supports it, otherwise its first available action. Theuser can still tick additional actions as needed. This matches the default the
togglePermissionResourceutil already applied before the form was reworked.The default-action logic is extracted into a shared
getDefaultActions()helperso the form and the util can't drift apart again.
Additional context
Root cause:
whose
actionsfield lists every available action, instead of a row seeded witha single default action.
Fix:
Permissions.tsx:append(resource)→append({ resource: resource.resource, actions: getDefaultActions(resource) })Permissions.utils.ts: newgetDefaultActions()helper;togglePermissionResourcereuses it (no behavior change)Summary by CodeRabbit
New Features
readwhen available or the first supported action.Bug Fixes