mirror of
https://github.com/supabase/supabase.git
synced 2026-12-04 07:29:16 +00:00
create-pull-request/patch
13
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
be27ad8cf5 |
feat(studio): show apps and confirm token access changes (#53917)
> [!WARNING] > This PR relies on #53705 being merged first. ## Problem Project admins need to see authorised apps before changing token access. [DEPR-734](https://linear.app/supabase/issue/DEPR-734) ## Solution - Show Apps below Members only when authorised apps exist; hide the section while loading or empty, and retain verification errors. - Show access levels and links to each app’s access sheet. - Include members and authorised apps in toggle confirmations; wait for complete counts and offer retry on errors. | After | | --- | | <img width="725" height="560" alt="CleanShot 2026-12-02 at 14 44 13" src="https://github.com/user-attachments/assets/6f033b2f-a8b4-4a64-824f-ef0cc270ff6c" /> | | No authorised apps (no empty state) | | <img width="728" height="773" alt="CleanShot 2026-12-02 at 14 11 31" src="https://github.com/user-attachments/assets/76b31461-abca-4f9a-b76d-bb664093dd67" /> | | Loading error | | <img width="727" height="749" alt="CleanShot 2026-12-02 at 14 38 34" src="https://github.com/user-attachments/assets/0722002c-a5cf-4877-b00b-15f9e4a6524c" /> | | 1× authorised app | | <img width="418" height="222" alt="CleanShot 2026-12-02 at 14 39 27" src="https://github.com/user-attachments/assets/db5cc89a-2099-4a6f-969c-b4e2c38ac972" /> | | Disabling token access whilst 1× app is relying on it | | <img width="424" height="387" alt="CleanShot 2026-12-02 at 14 39 58" src="https://github.com/user-attachments/assets/e15c1227-8190-42f4-876b-5f55a321848b" /> | | Re-enabling token access which will immediately restore access for N members and apps | ## Review instructions 1. Open the [staging preview](https://studio-staging-git-dnywh-depr-734-temporary-acc-b81819-supabase.vercel.app/dashboard), select a project you administer, and open **Database → Settings**. Enable database token access in **Feature previews**, plus `jitDbAccess` and `enableScopedOAuthManage` in the dev toolbar’s **Flags** tab if needed. 2. Open DevTools → **Console**, paste the setup below and run it. Navigate to another Studio page (possibly outside of Database) and back to **Database → Settings**, without reloading. Check **Test Partner App** appears under Apps with **Read and write** access. 3. Turn token access off. Check the confirmation includes the app, then choose **Cancel**. 4. Run `tokenAccessReview.state = 'disabled'` in Console, then navigate away and back. Turn token access on, expand **Who will regain access?**, check the app is listed, then choose **Cancel**. 5. Run `tokenAccessReview.state = 'enabled'; tokenAccessReview.fail = true`, then navigate away and back. Check the Apps error disables the toggle. Run `tokenAccessReview.fail = false` and choose **Retry apps** to recover. 6. Run `tokenAccessReview.apps = false`, then navigate outside Database and back. Check Apps is hidden once loaded. Reload to remove the setup. The setup mocks GET responses only, requires no app authorisation, and does not change saved access. Use **Cancel** in both confirmations. Do not reload between steps; reloading removes the setup. Network’s Response tab does not show these browser-generated responses. <details> <summary>Console setup</summary> ```js (() => { if (window.tokenAccessReview) throw new Error('Review setup is already active. Reload to reset it.') const projectRef = location.pathname.match(/\/project\/([^/]+)/)?.[1] if (!projectRef) throw new Error('Open a project’s Database Settings first.') const appId = '75e64165-b74e-432f-bb70-80d6ae432f06' const grantId = 'review-org-grant' const scopes = ['database_token_access:write'] const originalFetch = window.fetch const review = window.tokenAccessReview = { state: 'enabled', apps: true, fail: false } const approvals = /\/platform\/organizations\/[^/]+\/oauth\/approvals$/ const grants = new RegExp(`/platform/organizations/[^/]+/oauth/approvals/${appId}/grants$`) const page = (data) => Response.json({ data, links: { next: null, prev: null } }) window.fetch = function (input, init) { const url = new URL(input instanceof Request ? input.url : input, location.href) const method = init?.method ?? (input instanceof Request ? input.method : 'GET') if (method.toUpperCase() === 'GET') { if (url.pathname.endsWith(`/v1/projects/${projectRef}/jit-access`)) { return Promise.resolve(Response.json({ state: review.state, appliedSuccessfully: true })) } if (approvals.test(url.pathname)) { return Promise.resolve(page(review.apps ? [{ id: appId, type: 'oauth_app', attributes: { app: { name: 'Test Partner App', icon: null, created_by: null }, last_approved_at: '', target: 'organization', org_grant: { grant_id: grantId, approved_scopes: scopes, approved_at: '' }, }, }] : [])) } if (grants.test(url.pathname)) { if (review.fail) return Promise.resolve(Response.json({ message: 'Review: apps unavailable' }, { status: 500 })) return Promise.resolve(page([{ id: grantId, type: 'oauth_grant', attributes: { kind: 'organization_bound', user: null, approved_at: '', approved_scopes: scopes, projects: [{ ref: projectRef, name: 'Review project' }], }, }])) } } return originalFetch.call(this, input, init) } })() ``` </details> --------- Co-authored-by: Joshen Lim <joshenlimek@gmail.com> |
||
|
|
59cddd41a9 |
feat(studio): group database access settings (#54350)
> [!WARNING] > This PR relies on #54282 being merged first. ## Problem Database password and token access appear as separate sections in Database Settings, although both control connections to Postgres. ## Solution Group the existing controls under **Database access**, with **Password access** first and the switch beside **Token access**. Nest **Members** inside the Token access card and label its action **Add member**. Preserve the existing feature gates, permissions, toggle behaviour, dialogs and section anchors. Use shared card headings for Members, centre the token switch beside its description, and darken the Members table header. Update the matching token-access and password-reset docs instructions. ```text Database access ├── Password access └── Token access [switch] └── Members [Add member] ``` | After | | --- | | <img width="735" height="818" alt="CleanShot 2026-12-01 at 15 56 50" src="https://github.com/user-attachments/assets/f1207a2f-80d5-480a-9529-e110b960f427" /> | | _App [token] access coming separately in https://github.com/supabase/supabase/pull/53917._ | ## Review instructions 1. Open a project's **Database → Settings** page. Check that **Database access** contains **Password access** first, with the existing **Reset database password** button. 2. With the database token access preview enabled, check that **Token access** has its switch on the same row and **Members** appears inside the same card when enabled. Check that **Add member** opens the existing access rule sheet. 3. Check the existing enable confirmation and password reset dialog. Projects requiring SSL enforcement or a Postgres upgrade should keep their existing notices and actions. |
||
|
|
30a1b38da0 |
feat(studio): rename temporary access to database token access (#54282)
## Problem The database access preview still uses “Temporary access” across its settings and member rules. ## Solution Use “Database token access” for the feature and “Member access” for member rules. Update the preview, settings, dialogs, feedback, member status messages and docs together. Move the guide to `/guides/platform/token-access`, permanently redirect the old URL, and preserve existing section anchors. ## Review instructions 1. Open [the Studio preview](https://studio-staging-git-dnywh-database-token-access-naming-supabase.vercel.app), then Feature previews and find **Database token access**. Enable the preview for a supported project, then open [Database Settings](https://studio-staging-git-dnywh-database-token-access-naming-supabase.vercel.app/project/_/database/settings). 2. Check the **Database token access** heading, **Allow token access** switch and **Member access** table. Open **Add rule** and an existing rule to check the sheet titles. Open a rule’s delete confirmation and cancel it. 3. With an assigned role, check the access status above the member table. As a member without management permission, check the access notice uses the same feature name. 4. Open the [database token access guide in the docs preview](https://docs-git-dnywh-database-token-access-naming-supabase.vercel.app/docs/guides/platform/token-access). Check the guide and navigation use the new name, the dashboard instructions match Studio, and the existing section links from the member guide still work. Open `/docs/guides/platform/temporary-access` and its `.md` variant to check they permanently redirect to the new URLs. | Before | After | | --- | --- | | <img width="726" height="367" alt="CleanShot 2026-11-30 at 16 06 00" src="https://github.com/user-attachments/assets/be351f0c-d578-4289-8785-5c4e69a254a7" /> | <img width="729" height="374" alt="CleanShot 2026-11-30 at 16 05 38" src="https://github.com/user-attachments/assets/f02b470d-ef1a-4b6c-bdbb-20fe10b847c6" /> | |
||
|
|
15e95ab013 |
Joshenlim/fe 5242 jit db access show assigned role (#54214)
## Context Building on top of https://github.com/supabase/supabase/pull/54192, there was a missing piece to the JIT DB access UI which was showing the assigned access to the user if any (On staging it just shows an error, on the previous PR we show a "Contact your project admin" CTA). So this PR addresses that - there's a couple of cases to consider and I'd love for design to feedback / adjust as well as I'm not convinced this is the best way to do things. Am deliberately leaving out the "copyable connection strings" part for now as Danny's investigating into that one ### If you're a non-owner If not assigned a role: <img width="500" alt="image" src="https://github.com/user-attachments/assets/111d7c4f-0083-4bd5-88d5-ec45974ccf4d" /> If assigned a single role: <img width="500" alt="image" src="https://github.com/user-attachments/assets/1b4b1f3c-9a20-4010-bff8-7bf68a455e26" /> If assigned multiple roles: <img width="500" alt="image" src="https://github.com/user-attachments/assets/42cc66f6-4604-42eb-ab30-f58b1396ca6b" /> <img width="500" alt="image" src="https://github.com/user-attachments/assets/0914e1a3-9c7d-463e-851d-65f6b9793bb7" /> If (all) access expired: <img width="500" alt="image" src="https://github.com/user-attachments/assets/bda0fc65-e22a-49d9-b444-fc5d58a4745a" /> ### If you're an owner If not assigned a role: Status quo <img width="500" alt="image" src="https://github.com/user-attachments/assets/435abe70-ae88-49bb-86b9-7a03963b5b66" /> If yourself is assigned a role: <img width="500" alt="image" src="https://github.com/user-attachments/assets/9fafc74a-1a33-489e-a7da-70f57356a034" /> If yourself is assigned multiple roles: <img width="500" alt="image" src="https://github.com/user-attachments/assets/f4af901b-a24e-4272-b573-9ccb474bb7e2" /> If (all) access expired: Same as not assigned a role, just refer back to the table |
||
|
|
bef044891b |
Improve UI for JIT DB access for non owners + use proper perms check (#54192)
## Context For the Temporary database access feature preview, non project owners/admins are unable to view or manage the JIT db access section, but we currently don't guard properly against that. So this PR addresses this by showing an Admonition instead + guard the relevant react queries against the perms check to prevent unnecessary calls. We were also using `FGA_PERMISSIONS.PROJECT.ADMIN_WRITE` incorrectly as there's `FGA_PERMISSIONS.PROJECT.DATABASE_JIT_WRITE` that we can use ### Before <img width="788" height="602" alt="image" src="https://github.com/user-attachments/assets/90458c5a-5994-4812-abe1-17f0d3782f70" /> ### After <img width="836" height="284" alt="image" src="https://github.com/user-attachments/assets/ba08aa55-6b2a-49e5-8fc0-709c7b41cd72" /> |
||
|
|
6d08d66b7d |
Add eslint rule for google translate dynamic spans + address all issues (#52949)
## Context We've been seeing many `NotFoundError: Failed to execute 'removeChild' on 'Node'` and `NotFoundError: Failed to execute 'insertBefore' on 'Node'` events on Sentry which are historically known to be caused by Google Translate in the browser. There's technically no _right way_ to address this unfortunately, but one of the solutions which should address most of these issues is to wrap any dynamic text within a span - we've considered that quite a while back tbh but never took the time to do this until today with the help of Claude. Although just a heads up that it might not necessarily completely eradicate those issues. Also added an eslint rule which should prevent future occurences of this <img width="1264" height="192" alt="image" src="https://github.com/user-attachments/assets/b2c32ea0-45a2-4ccd-82fe-1a859905fc29" /> |
||
|
|
09a1f431bc |
Mass update for all lucide icon imports to use the component with Icon suffix (#51659)
## Context This is largely just a mechanical change here: Opting to use lucide icons with the `Icon` suffix across all icon imports within `studio` - so that it’s clearer which components are icons + reduces the possibility of name collision with our own components - e.g <User /> vs <UserIcon /> Also added a eslint rule for this: <img width="1069" height="167" alt="image" src="https://github.com/user-attachments/assets/7f36f443-5ca2-4bf6-8d22-86e774513bfc" /> And updated `AGENTS.md` as such: ``` Icons come from `lucide-react`, always imported with the `Icon` suffix (`import { CheckIcon, Trash2Icon } from 'lucide-react'`) — never the bare names (`Check`) or `Check as CheckIcon` aliases (lint-enforced). ``` |
||
|
|
476d4a5851 |
refactor(ui): drop redundant Button variant="default" props (#50161)
## What kind of change does this PR introduce? Mechanical cleanup on top of the Button default-variant change (#50160). ## What is the current behavior? Many callsites still pass `variant="default"` even though that is now the component default. ## What is the new behavior? Removes redundant static `variant="default"` from legacy `Button` and `ButtonTooltip` callsites. Keeps explicit defaults where they document the API: - `button-default.tsx` and `button-sizes.tsx` demos - `DocsButton`, which pins neutral styling at the wrapper boundary ## To test Studio: - [Auth → Rate Limits](https://studio-staging-2s957kwc4-supabase.vercel.app/dashboard/project/_/auth/rate-limits): dirty the form so Cancel appears; Cancel stays neutral, Save stays green - [Project Settings → API Keys](https://studio-staging-2s957kwc4-supabase.vercel.app/dashboard/project/_/settings/api-keys): `DocsButton` in the header actions stays neutral Design system: - [Design system → Button](https://design-system-git-dnywh-dc924ac1-supabase.vercel.app/design-system/docs/components/button): `button-default` / `button-sizes` still show explicit default styling; Primary (green) is restricted to the Primary section (and `asChild`) WWW: - [www → Brand assets](https://zone-www-dot-com-git-dnywh-dc924ac1-supabase.vercel.app/brand-assets): Download logo kit / Download button kit stay neutral |
||
|
|
c8aca8d3a0 |
chore(design-system): standardise keyboard focus rings (#41575)
## 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? UI / design-system consistency (accessibility). ## What is the current behavior? Keyboard focus rings are inconsistent across Studio and `packages/ui`: - Custom Button uses thick `outline` with per-variant colours (brand / grey / destructive / warning) - Form controls use muted grey rings (`ring-background-control`) - Tabs / NavMenu / Radio use soft brand `ring-ring` - Studio `.inset-focus` uses dark green `outline-brand-600` Related: [DEPR-354](https://linear.app/supabase/issue/DEPR-354). ## What is the new behavior? One shared focus recipe, exposed as Tailwind `@utility` classes in `packages/config/css/utilities.css`: | Utility | Use when | | --- | --- | | `focus-ring` | Buttons, inputs, most controls (offset ring) | | `focus-inset` | Dense/flush surfaces such as interactive table rows (renamed from `inset-focus`) | ```txt # focus-ring outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background ``` Applied on Button, shadcn form controls, Menu/NavMenu, Command palette trigger, Studio table rows, and related call sites. Documented in the design-system accessibility docs. Variants do not change focus ring colour. When the ring must appear on a different element than the focused one (e.g. Menu + ProductMenu `Link` via `group-focus-visible`, or InputGroup via `:has()`), keep an explicit ring stack. The utilities bake in `:focus-visible` on the same element. ## Additional context **Out of scope** - Full `packages/ui` / Studio / www sweep - Legacy Studio form-group green box-shadow cleanup - ESLint rule for bare `outline-none` ## Test plan Prefer Safari (“hard mode” for `tabIndex`). Expect one soft brand ring everywhere: not grey, not solid green outline. ### Design system - [ ] [Accessibility](https://design-system-git-dnywh-choreimprove-tab-focus-styles-supabase.vercel.app/design-system/docs/accessibility): recipe docs match what you see - [ ] [Button](https://design-system-git-dnywh-choreimprove-tab-focus-styles-supabase.vercel.app/design-system/docs/components/button): Tab primary / default / danger; same ring colour - [ ] [Table → Row-level navigation](https://design-system-git-dnywh-choreimprove-tab-focus-styles-supabase.vercel.app/design-system/docs/components/table#row-level-navigation): Tab an interactive row; inset outline (`focus-inset`) sits inside the row ### Studio - [ ] **Org home → table view** (`/organizations/_` or org projects): switch to the table layout, Tab onto a project row; inset outline sits inside the row (list/card view uses CardButton, not `focus-inset`) - [ ] **Project sidebar** (Database, Auth, Storage, …): Tab the main product nav links; ring follows the focused item (not the nested section menus like Tables / Roles) - [ ] **Storage → Files**: Tab a bucket row; same inset outline as org table rows - [ ] **Project Settings → General** (or Compute and Disk): Tab through inputs, checkboxes, switches, selects; same offset ring, no ring on mouse click - [ ] **Header ⌘K** (desktop width): Tab to the search control after Feedback; same soft brand `focus-ring` (was a thicker `ring-border-strong` before) - [ ] **Table Editor or SQL Editor tabs**: focus a tab, Tab to × if active; close shows a ring - [ ] **Light + dark**: ring stays visible against both backgrounds |
||
|
|
96d43099bb |
chore: refactor Button API so that it can be used a standard button (#46880)
## Problem Our `<Button>` component breaks the default `button` contract by redefining the `type` prop to set its variant (`primary`, `default`, etc) instead of the button type (`submit`, `button`, etc). This is confusing and forces to write more code when using it with shadcn components that expect/inject the standard button props. ## Solution - rename the `type` prop to `variant` - rename the `htmlType` prop to `type` - propagate the changes where necessary - format code ## How to test As this is just prop renaming, if it builds it's ok --------- Co-authored-by: Ivan Vasilov <vasilov.ivan@gmail.com> |
||
|
|
331278bfe4 |
feat(studio): add async handling to AlertDialog actions (#45960)
## What kind of change does this PR introduce? Feature, bug fix, and docs update. Addresses the AlertDialog async action behaviour discussed in Slack and follow-up PR feedback. ## What is the current behavior? `AlertDialogAction` delegates directly to Radix, so confirm actions close the dialog immediately on click. Async mutation flows have to use `asChild` with `event.preventDefault()` and a custom loading button to keep the dialog open while work is in flight. ## What is the new behavior? - `AlertDialogAction` now accepts async handlers and a controlled `loading` prop. Promise-returning actions keep the dialog open, show the existing Button loading state, disable cancel/dismissal while pending, close on success, and stay open on rejection. - Existing workaround usages in Studio have been migrated to the direct action API (see 'To test' callsite list below) - design-system docs now include async action examples and `AlertDialogBody` guidance for inline feedback https://github.com/user-attachments/assets/1af66410-e9f9-4231-9c6d-fe650bd717a4 ## Additional context - [ ] Once #45572 is rebased onto this change, `ResetTemplateDialog` should use `AlertDialogAction loading={isResettingTemplate}` with a promise-returning reset handler instead of a plain loading `Button` in `AlertDialogFooter`. ## To test - [x] On Studio API Keys settings, use a project with no publishable or secret API keys, click the “Create API keys” banner action, and confirm the Alert Dialog stays open with loading until the default publishable and secret keys are created. - [x] Delete a JIT database access rule and confirm the Alert Dialog stays open with loading until deletion succeeds, and stays open with inline feedback if it fails. - [x] With temporary access disabled and existing rules configured, enable temporary access and confirm the “This will activate existing rules” Alert Dialog stays open with loading until the configuration update succeeds, and stays open with inline feedback if it fails. - [x] Disable external replication and confirm the Alert Dialog stays open with loading until the mutation succeeds. - [x] Enable Index Advisor and confirm the Alert Dialog stays open with loading until the mutation succeeds, and stays open with inline feedback if it fails. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Alert dialogs support async actions with built-in loading, dismissal blocking while pending, and preserved dialog on error. * Two interactive examples demonstrating async success and error flows. * **Improvements** * Dialogs now surface inline error messages and consistent loading/confirm behavior across flows (create keys, replication, JIT DB access, index advisor). * Minor UI refinements for action controls. * **Documentation** * Docs updated with async-action guidance and inline-error recommendations. * **Tests** * New test suite validating async dialog behaviors. <!-- review_stack_entry_start --> [](https://app.coderabbit.ai/change-stack/supabase/supabase/pull/45960) <!-- review_stack_entry_end --> <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Gildas Garcia <1122076+djhi@users.noreply.github.com> |
||
|
|
bedb2efb87 |
chore(studio): JIT access UI improvements (#44161)
## What kind of change does this PR introduce? UI and copywriting improvements for temporary access. ## What is the current behavior? The temporary access UI still used older JIT/ephemeral naming in some places, did not clearly explain the setup requirements, and had to infer unavailable states from Platform error message text. ## What is the new behavior? The settings UI now uses temporary access naming consistently, explains that temporary access uses short-lived tokens for manual database connections, and renders clearer unavailable states for projects that require either a Postgres upgrade or a platform migration. The Studio query now consumes Platform’s structured `unavailableReason` contract instead of parsing human-readable error strings, so the UI owns the copy while Platform owns the eligibility reason. Validation: - `pnpm eslint components/interfaces/Settings/Database/JitDatabaseAccess/JitDbAccessConfiguration.tsx data/jit-db-access/jit-db-access-query.ts` - `pnpm tsc --noEmit --pretty false` <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * IP range input now supports one CIDR range per row with add/remove rows and form integration. * **Documentation** * Replaced “JIT” wording with “Temporary” / “Ephemeral token-based” access across UI, dialogs, toasts, and help links. * Added minimum PostgreSQL version requirement (17.6.1.081+). * **Improvements** * Per-row CIDR validation with precise nested error messages. * Refined layout spacing and moved the temporary-access configuration earlier in Database settings. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Etienne Stalmans <etienne@supabase.io> Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com> Co-authored-by: Joshen Lim <joshenlimek@gmail.com> |
||
|
|
c198a61951 |
feat: UI for managing jit database access (#43735)
## 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? feature ## Additional context Adds a feature flagged UI for toggling JIT based access to a project's database and managing permissions/access --------- Co-authored-by: Danny White <3104761+dnywh@users.noreply.github.com> Co-authored-by: Joshen Lim <joshenlimek@gmail.com> |