Repository navigation
feat(studio): enforce expiry scoped pat - #48811
Conversation
Tokens must always have an expiry: drop the "Never" preset from EXPIRES_AT_OPTIONS so both classic entry points (flag-off dialog and the experimental V0 dialog) can no longer create non-expiring tokens, matching the scoped/legacy sheet which never offered one. Existing non-expiring tokens are unaffected; the list still displays them. Also deletes the orphaned BasicInfo.tsx (superseded by TokenDetails), the dead 'never' branch in getExpirationDate, and re-baselines the dialog's close reset to the full defaults.
Extracts the expiry-cap portion of the scoped-PAT UI rework, on top of the "Never" preset removal. - Add a single shared getMaxCustomExpiryDate() (one year from today) driving the scoped calendar bounds, the zod validation, and the classic dialog's maxDate, replacing the inline dayjs().add(1, 'year') duplicates. - Reject a custom scoped expiry beyond that cap in TokenFormSchema, so a hand-edited or stale value can't slip past the calendar. - Bound both calendars so they can't page past the selectable range: the scoped Calendar via startMonth/endMonth, and the shared DatePicker by deriving them from its existing minDate/maxDate props. The shared DatePicker's other consumer is the JIT database-access expiry picker, which already passes minDate/maxDate with the same one-year cap (MAX_CUSTOM_EXPIRY_YEARS), so it gains matching month bounds and can no longer page into months where every day is already disabled. Reports and Logs use the separate LogsDatePicker and are untouched. Co-Authored-By: Wen Bo Xie <[email protected]> Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
📝 WalkthroughWalkthroughAccess-token creation no longer supports non-expiring tokens. Custom expiry dates are limited to one year from the current date across classic and scoped forms. DatePicker navigation follows the configured date bounds. ChangesAccess token expiry
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant TokenDetails
participant DatePicker
participant TokenFormSchema
TokenDetails->>DatePicker: set minimum and maximum custom expiry dates
DatePicker-->>TokenDetails: return selected date
TokenDetails->>TokenFormSchema: validate custom expiry date
TokenFormSchema-->>TokenDetails: return valid result or customExpiryDate error
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 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 |
🎭 Playwright Test Results (next)Details
Skipped testsFeatures › auth-users.spec.ts › should show web3 users as enabled when the matching web3 provider is enabled |
Braintrust eval report
|
## I have read the [CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md) file. YES ## What kind of change does this PR introduce? Replaces the scoped form's inline account-level access mode with a proper legacy-token escape hatch: "Create legacy token" switches the sheet to the classic form (name + expiry only) and creates through the legacy endpoint, skipping the two-step review. Mirrors the mode-switch links in both directions and restores the "Generate token for experimental API" split-button dropdown, extracted into a shared ExperimentalTokenDropdown. Ported from origin/w3b6x9/scoped-pat-ui-rework, excluding its expiry handling (shipped in #48811) and MCP-unsupported warnings (follow-up PR). <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Added support for creating classic account-wide access tokens alongside scoped tokens. * Added an experimental token dropdown for quick token creation. * Added links to switch between scoped and legacy token creation flows. * Classic token creation now provides dedicated warnings and simplified access settings. * **Improvements** * Updated token access messaging, descriptions, and labels for clarity. * **Tests** * Expanded coverage for token creation, navigation, validation, and clipboard behavior. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Claude Sonnet 5 <[email protected]>
…for-pitr-archiving-stale * origin/master: (342 commits) feat(studio): role-aware access feedback in scoped token creation (#48858) Initialize notebook editor page (#48842) test(docs): scan changed pages for WCAG 2.1 A/AA in warn mode (#48727) docs(auth): clarify audit logs storage options and configuration (#48852) feat(studio): warn that scoped tokens don't support the MCP server (#48849) feat(studio): lifecycle and role-aware scoped token view sheet (#48848) feat(www): add Open Authorization Integration Addendum (#48804) feat(studio): add legacy token mode to scoped pat creation flow (#48844) Add blog post: Supabase is now a connector on Perplexity Computer (#48776) feat(studio): enforce expiry scoped pat (#48811) fix(studio): model scoped pat permissions as OR-of-AND alternatives - smaller version (#48809) fix(ui): opaque default button hover fills (#48837) fix(ui): restore normal alert text wrapping (#48840) feat: notebook content schema (#48813) fix(ui): remove extra spacing before custom reports section (#48796) feat(marketing): add hint text below Go page form labels (#48824) Initialize notebooks store (#48801) Use white wordmark for QA.tech primary logo (#48827) fix titleless Admonition alignment (#48784) fix inconsistent product menu dividers (#48787) ...
I have read the CONTRIBUTING.md file.
YES
Waiting on #48809
Summary by CodeRabbit
New Features
Updates
Tests