fix(sdk): scope PAT detail to active org and show a unified not-found page - #1895
fix(sdk): scope PAT detail to active org and show a unified not-found page#1895rohilsurana wants to merge 2 commits into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
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 (1)
Included review availability: Your plan provides up to 2 included reviews per hour; 1 remains after this review. 📝 WalkthroughSummary by CodeRabbit
WalkthroughThe PAT detail view now classifies loading errors, retries transient failures up to twice, and renders dedicated states for invalid, missing, mismatched, and unexpected failures. ChangesPAT detail error handling
Estimated code review effort: 3 (Moderate) | ~20 minutes Merge Risk: ⚪ Minimal · up to This localized change scopes PAT detail handling to the active organization and separates not-found responses from transient errors; no actionable merge-blocking risk remains beyond normal checks and review. Suggested reviewers: 🚥 Pre-merge checks | ✅ 2✅ Passed checks (2 passed)
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 |
Coverage Report for CI Build 32232541493Coverage remained the same at 48.739%Details
Uncovered ChangesNo uncovered changes found. Coverage RegressionsNo coverage regressions found. Coverage Stats
💛 - Coveralls |
Problem
The current-user PAT management flows (get, update, delete, regenerate) scope the token lookup by the logged-in user, not by the org. A user who belongs to more than one org could open, edit, regenerate, or delete a token that belongs to another org just by changing the org in the URL. The token also rendered under any org the user is a member of.
The PAT detail view is where all of this happens. It fetches the token by id and hosts the Update, Regenerate, and Revoke actions.
Fix
A client-side guard in the PAT detail view. The PAT response already carries its
org_id, so we compare it with the active org from the route.Retry is tuned to match. A NotFound or invalid id is a definite answer and is not retried, so the not-found state shows right away. Other failures may be transient, so they are retried a couple of times before the error state appears. Before this, the query used the default retry of 3, which retried even a 404 three times.
No proto or server change is needed. The list view already scopes its search by org.
Testing
Ran a local sandbox with one user in two orgs, each with a PAT, and checked:
Notes
This is a UI guard. A direct RPC call is still not org-scoped on the server, which is a separate, deeper change.