10 Commits
Author SHA1 Message Date
Charis 395a54f2b7 feat(studio): gate jwt signing keys, legacy api keys, and third-party auth on grants (#53241)
Resolves
[FE-4732](https://linear.app/supabase/issue/FE-4732/grants-rollout-jwt-signing-keys-legacy-api-keys-and-third-party-auth).

## Changes
Gates the JWT signing keys, legacy API keys, and third-party auth
endpoints on grants instead of `unguarded.migrating`, and replaces their
V2 permission guards with `useGrant`:
- **Data layer (11 sites):** `data/jwt-signing-keys/*`,
`data/api-keys/legacy-api-keys-status-query`,
`data/api-keys/legacy-api-key-toggle-mutation`, and
`data/third-party-auth/*`. Queries become grant-gated query option
factories; mutations take the grant in their variables.
- **Consumers:** the JWT settings page, the JWT signing keys table and
its dialogs, `jwt-settings`, `ToggleLegacyApiKeys`, `Project/APIKeys`,
and the third-party auth page, form, and create dialogs. Each consumer
renders denied and error states.
- **JWT signing keys table:**
- It's gated only on the signing keys reads (`GET signing-keys` and `GET
signing-keys/legacy`, both `auth_signing_keys_read`).
- The legacy API keys status is only used by the revoke dialogs. If it
can't be read, revoking the legacy JWT secret fails closed: the user
sees the "disable legacy API keys first" warning, with copy explaining
why, instead of the confirm modal.
- **Legacy JWT secret query:** a 404 (secret not imported as a signing
key yet) resolves to `null` and shows the "Migrate JWT secret" panel.
Other errors now render an error instead of being treated as "not
migrated".
- **Write actions:**
- `getWriteGrantTooltip` moves from `APIKeys.utils` to `lib/grants` and
takes a resource noun. Disabled write actions use it to explain why
they're disabled.
- New `getWriteGrantToastMessage`: handlers that run without a grant now
show a toast instead of silently doing nothing. This includes the API
keys handlers from #52966.

## Permission changes
- **Legacy API keys toggle and status** (`GET`/`PUT
/v1/projects/{ref}/api-keys/legacy`): the guard moves from
`auth_signing_keys_read`/`_write` to the endpoint annotation,
`api_gateway_keys_read`/`_write`. The annotation was confirmed against
the backend controller (FE-4728). As a result, the JWT signing keys
table's legacy revoke check now depends on `api_gateway_keys_read`.
- **API keys last-used analytics**
(`/platform/projects/{ref}/analytics/endpoints/api_keys.last_used.otel`):
this endpoint uses legacy permissions (`analytics:Read` on `logflare`),
not FGA. Its check moves from the V2 `auth_signing_keys_read` check to
`useAsyncCheckPermissions(PermissionAction.ANALYTICS_READ, 'logflare')`.
- Every other guard already matched its annotation:
  - `auth_signing_keys_read`/`_write` for signing keys
  - `auth_config_read`/`_write` for third-party auth

## Testing
- Data layer: `jwt-signing-keys.test.ts`, `legacy-api-keys.test.ts`, and
`third-party-auth.test.ts` cover every migrated fetcher, check that
factories stay disabled without a grant, and cover legacy-key 404 vs.
500.
- `jwt-secret-keys-table/index.platform.test.tsx`:
- Legacy status denied: the table still renders, and revoking the legacy
key shows only the warning.
  - Legacy status known enabled or disabled.
  - Signing keys read denied.
  - Legacy key 404 vs. 500.
- `create-key-dialog.platform.test.tsx`: triggering create without a
grant shows the toast and sends no request.
- `ToggleLegacyApiKeys.platform.test.tsx`,
`ThirdPartyAuthForm.platform.test.tsx`, and
`settings/jwt/index.platform.test.tsx`: granted, denied, error, and
partial-permission cases.
- `lib/grants.test.ts`: the tooltip and toast helpers.

🤖 Generated with [Claude Code](https://claude.com/claude-code)
2026-11-10 15:30:58 -05:00
Joshen Lim 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).
```
2026-10-14 12:56:55 +02:00
Danny White 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
2026-09-11 17:05:26 +10:00
Danny White 1131e3e2ce fix(ui): default Button variant to default instead of primary (#50160)
## What kind of change does this PR introduce?

Bug fix / design-system alignment for the legacy `Button` from `ui`.

## What is the current behavior?

Omitting `variant` on the legacy `Button` falls back to brand-green
`primary`. That makes accidental greens easy, and it is hard to spot the
real main action on busy pages.

## What is the new behavior?

- Legacy `Button` now defaults to neutral `default`
- Intentional primary CTAs (create, save, submit, marketing CTAs, and
matching `ButtonTooltip` usages) now set `variant="primary"` so their
appearance is unchanged
- Neutral actions that previously relied on the old fallback (cancel,
close, back, dashboard nav, and similar) become grey/white
- Design-system docs updated; regression tests cover the new default

`Button_Shadcn_` is unchanged. It already uses its own CVA default.

This is PR 1 of 2 in a stack. PR 2 drops now-redundant
`variant="default"` props.

## To test

Studio (http://localhost:8082):

- `/sign-in`: Sign in stays green
- Open a project → Database → Tables: New table stays green
- Auth → Users → Invite: Invite user stays green; Cancel / dismiss
controls stay neutral
- Project Settings → General: edit a field so Cancel and Save appear.
Cancel is neutral, Save is green

Design system (http://localhost:3003):

- Components → Button: default demo is neutral; primary demo is green;
featured preview is the default variant

Marketing (optional):

- www header: Start your project stays green; logged-in Dashboard is
neutral

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

- **Style**
- Buttons now default to a neutral style, while primary actions across
Studio, documentation, marketing pages, forms, dialogs, and error states
use prominent primary styling.
- Updated button examples and previews clarify the distinction between
default and primary variants.
  - Event registration now includes a directional arrow icon.

- **Tests**
- Added coverage confirming default button styling and explicit primary
styling behave as expected.
- Updated related test fixtures to use primary styling where
appropriate.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-09-10 11:23:17 +10:00
Gildas GarciaandIvan Vasilov 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>
2026-06-16 23:59:58 +02:00
Gildas Garcia 0713a1efc1 chore: remove shadcn suffix for Input, Textarea, Alert and Collapsible (#45867)
## Problem

Now that we migrated old components to their new shadcn alternatives, we
don't need the `_Shadcn_` suffix anymore.

## Solution

Remove it

<img width="659" height="609" alt="image"
src="https://github.com/user-attachments/assets/2d7271a9-066a-4dcc-92fe-729b106d2c2f"
/>
2026-05-15 14:55:37 +02:00
Gildas Garcia 0facd341a6 chore: remove UI form components _Shadcn_ suffix (#45212)
## Problem

We used to have a `_Shadcn_` suffix for all the shadcn form components
because we also had `formik` form components.
This is not needed anymore.

## Solution

- Remove the suffix
- Update all usages
2026-04-24 12:14:15 +02:00
4a0bb36ca8 style: require sorted imports in studio/components (#44408)
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Ivan Vasilov <vasilov.ivan@gmail.com>
2026-04-01 10:22:37 +02:00
Ivan Vasilov 43cc61818c chore: Migrate all isPending uses in react-query (#40642)
* Bump react-query. Minor type and logic fixes.

* Migrate all use of isLoading to isPending in mutations.

* Fix type errors.
2025-11-20 16:44:53 +01:00
Stojan Dimitrovski 74a3be9aa8 feat: add workos tpa ui behind feature flag (#36254) 2025-06-09 19:56:06 +02:00