Commit Graph

30 Commits

Author SHA1 Message Date
Joshen Lim 5f867e5f6c Feature Preview: RLS Tester (#45121)
## Context

Resolves FE-3077
Related discussion: https://github.com/orgs/supabase/discussions/45233

Verifying the correctness of your RLS policies set up has always been a
gap, as highlighted by a number of GitHub discussions like
[here](https://github.com/orgs/supabase/discussions/12269) and
[here](https://github.com/orgs/supabase/discussions/14401). As such,
we're piloting a dedicated UI for RLS testing (using role impersonation
as the base), in which you'll be able to
- Run a SQL query as a user (not logged in / logged in - this is the
role impersonation part)
- See which RLS policies are being evaluated as part of the query
- And hopefully be able to debug which policies are not set up correctly

Changes are currently set as a feature preview - and we'll iterate as we
get feedback from everyone 🙂 🙏

<img width="613" height="957" alt="image"
src="https://github.com/user-attachments/assets/83c37f8a-28fc-43b3-b0ff-e28571d8710c"
/>


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

* **New Features**
* RLS Tester: run queries as anon or authenticated users, view inferred
SQL, per-table policy summaries, and data previews of accessible rows.
* UI preview: new RLS Tester preview card and modal with opt-in toggle;
RLS Tester sheet with role/user selector and query editor.
  * SQLEditor: “Explain” tab is always visible.

* **Chores**
* Added supporting API endpoints, background checks for table RLS
status, and a local-storage flag to persist the preview opt-in.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-04-28 15:02:49 +08:00
Joshen Lim 7f5865872a Enforce noUnusedLocals and noUnusedParameters in tsconfig.json + fix all related issues (#45264)
## Context

Enforce `noUnusedLocals` and `noUnusedParameters` in tsconfig.json + fix
all related issues
2026-04-27 17:42:34 +08:00
Alaister Young 19027e73f8 [FE-3036] feat(studio): runtime env var overrides for enabled features (#45049)
Lets self-hosted Studio toggle flags in `enabled-features.json` at
container start time via `ENABLED_FEATURES_*` env vars, without
rebuilding the prebuilt image. Addresses
[FE-3036](https://linear.app/supabase/issue/FE-3036/allow-enabled-featuresjson-flags-to-be-overridden-via-env-vars)
and is a prerequisite for
[COM-205](https://linear.app/supabase/issue/COM-205/add-feature-flag-to-disable-all-logs-in-studio).

**Added:**
- `packages/common/enabled-features/overrides.ts` — pure parser that
maps `ENABLED_FEATURES_*` env vars to a disabled-features list
(forward-only key mapping, boolean validation, typo warnings) + 10
vitest tests
- `apps/studio/pages/api/enabled-features-overrides.ts` — Next.js API
route reading `process.env` at request time; no-op (`{
disabled_features: [] }`) when `IS_PLATFORM`
- `apps/studio/data/misc/enabled-features-override-query.ts` — React
Query hook with `staleTime: Infinity`, `enabled: !IS_PLATFORM`
- `packages/common/enabled-features/README.md` — docs the env var
convention, resolution order, `IS_PLATFORM` gating, and the
`Support.constants.ts` build-time caveat

**Changed:**
- `apps/studio/hooks/misc/useIsFeatureEnabled.ts` — merges the
override's `disabled_features` with `profile.disabled_features`

### Env var shape

One var per flag, prefixed `ENABLED_FEATURES_`. Feature key → env name:
uppercase with every non-alphanumeric char replaced by `_`.

```bash
ENABLED_FEATURES_LOGS_ALL=false
ENABLED_FEATURES_BRANDING_LARGE_LOGO=true
```

Values are `true`/`false` case-insensitively. Other values and prefixed
vars that don't match a known feature are logged and ignored.

### Resolution order (runtime, Studio only)

1. `ENABLED_FEATURES_*` (self-hosted, via API route → React Query →
hook)
2. `profile.disabled_features` (hosted, from `/platform/profile`)
3. `enabled-features.json` static value
4. Default (enabled)

`ENABLED_FEATURES_OVERRIDE_DISABLE_ALL` still short-circuits everything.

### Known limitation

`apps/studio/components/interfaces/Support/Support.constants.ts:4` calls
`isFeatureEnabled('billing:all')` at module load to build
`CATEGORY_OPTIONS`, which is spread into Zod form schemas. That call
site stays resolved from the JSON — documented in the package README.
`billing:all` isn't on the radar for self-hosted runtime toggling.

## To test

- `cd packages/common && pnpm exec vitest run enabled-features` — 10 new
tests pass
- `pnpm --filter studio run typecheck` clean
- Spin Studio locally with `NEXT_PUBLIC_IS_PLATFORM=false` and
`ENABLED_FEATURES_LOGS_TEMPLATES=false`;
`/project/[ref]/logs/explorer/templates` should reflect the flag after
the override fetch resolves
- Confirm the API route returns `{ disabled_features: [] }` when
`NEXT_PUBLIC_IS_PLATFORM=true`
- Set a typo like `ENABLED_FEATURES_LOGS_TMEPLATES=false` and check the
warning in container logs; flag stays enabled

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

* **New Features**
* Runtime feature-flag overrides for self-hosted deployments (env var
driven), new API endpoint and client-side hook to fetch overrides, and
client logic now merges profile and runtime overrides.

* **Documentation**
* Added comprehensive README describing the feature-flag system and
override configuration.

* **Tests**
* Added unit tests for override parsing and E2E tests covering runtime
override behavior.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: Alaister Young <10985857+alaister@users.noreply.github.com>
2026-04-20 22:28:56 +08:00
Charis 3b7052b5a9 cleanup: fix import order and prefixes for studio/data (#44501) 2026-04-03 09:15:57 +02:00
Danny White c2231301e0 chore(studio): improve HeaderBanner (#41525)
* design polish

* better banner

* defensive truncation

* better incident banner

* better prop names

* improve warnings

* fix variant

* OrganizationResourceBanner

* notice banner

* improve ClockSkewBanner

* add ARIA label

* rabbit

* lil dot

* 📝 Add docstrings to `dnywh/chore/improve-header-banner` (#41526)

* 📝 Add docstrings to `dnywh/chore/improve-header-banner`

Docstrings generation was requested by @dnywh.

* https://github.com/supabase/supabase/pull/41525#issuecomment-3680124020

The following files were modified:

* `apps/studio/hooks/misc/useOrganizationRestrictions.ts`

* new line

---------

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: Danny White <3104761+dnywh@users.noreply.github.com>

* fix clock docs link

* Small nits

* Fix URL for grace period warning to point to usage instead of billing

* rabbit

---------

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2025-12-29 15:16:10 +11:00
Ali Waseem 4d62c6d509 Fix: updated critical path errors within studio (#40216)
* updated Sentry critical path erroring

* removed unneeded return
2025-11-06 14:37:11 -08:00
Ivan Vasilov 8b657165b5 chore: Migrate to use custom type for ReactQuery queries and mutations (#40073)
* Add custom types for queries, mutations and infinite queries.

* Migrate all queries to use the new type.

* Migrate all infinite queries to useCustomInfiniteQueryOptions.

* Migrate all mutations to use useCustomMutationOptions.

* Add type to all imports in `types` folder.
2025-11-03 13:18:13 +01:00
Alaister Young 8855d05803 chore(studio): swap react-query to object syntax (#39842)
* chore(studio): swap react-query to object syntax

* Fix small issues found

* Fix realtime settings

* Nit

---------

Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2025-10-27 09:38:27 +01:00
Joshen Lim 4124f0ed98 Shift useFlag hook and configcat library to common package, remove from Studio (#38203)
* Shift useFlag hook and configcat library to common package, remove from studio

* Fix test

* Fix test
2025-08-27 13:42:20 +07:00
Joshen Lim 96875d651e Fix create project default region not getting selected correctly on staging and staging previews (#37237) 2025-07-17 17:02:46 +08:00
Joshen Lim ac670e230e Configure restricted region pool from configcat (#36105) 2025-06-03 16:33:36 +08:00
Joshen Lim 232a26a68d Add custom error handler around fetch method (#35562)
* Add custom error handler for fetch error 'Failed to fetch'

* Refactor EdgeFunctionTesterSheet to use react query instead of manually calling fetch

* Use new fetchHandler for where we're calling fetch

* Revert
2025-05-09 15:22:55 +08:00
Jordi Enric 785fcbacc8 Network Bans fixes (#35472)
* add loading and error states

* fix cmd k menu links

* Add hook for getting user's ip address

---------

Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2025-05-06 09:29:42 +02:00
divit 691ab75cb1 feat: change default us region to us east 2 (#35452) 2025-05-04 16:08:01 +05:30
divit 634f86d2d6 feat: disable us east and change default to us west (#35296) 2025-04-26 07:15:11 +00:00
Han Qiao 698e585a65 feat: fetch beta cli release version (#34923)
* feat: fetch beta cli release version

* Small refactors

* Fix

* Fix

---------

Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2025-04-14 16:20:03 +08:00
divit 1f32f1909d chore: expand default europe region selection (#34853) 2025-04-09 13:40:28 +05:30
Joshen Lim ec7e80bbef Add studio version in header for local self host (#34018)
* Add studio version in header for local self host

* Fix

* Address feedback

* Fix

* Remove Docker Hub context, everything is CLI

* Update to use CLI version as the comparator instead of docker image version

* Fix
2025-04-08 18:06:48 +08:00
divit 4cf91b7742 feat: change default US region to us east (#34322) 2025-03-21 16:57:31 +05:30
Kamil Ogórek f553065a2e feat: Add Login event to account audit logs (#33660)
* feat: Add Login event to account audit logs

* refactor

* Remove unrelated files

* Remove audit login events for sign in with GH and SSO

---------

Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2025-02-19 18:02:53 +08:00
Joshen Lim d586346e27 Chore/sentry fixes 211024 (#30003)
* Resolve https://supabase.sentry.io/issues/5808689343

* Fix SecurityStatus map key prop issue

* Fix FileExplorerHeader to use ButtonTooltip

* Fix https://supabase.sentry.io/issues/5998687405

* Fix https://supabase.sentry.io/issues/5414129652

* Fix https://supabase.sentry.io/issues/5414129652

* Fix map key issue in QueryPerformanceGrid

* Add whitelist error for sign up mutation

* Fix map key in DiskUsage

* Fix prop name in info-tooltip
2024-10-22 15:21:06 +08:00
Ivan Vasilov df52ea7ee0 feat: Replace all toasts with sonner (#28250)
* Update the design of the sonner toasts. Add the close button by default.

* Migrate studio and www apps to use the SonnerToaster.

* Migrate all toasts from studio.

* Migrate all leftover toasts in studio.

* Add a new toast component with progress. Use it in studio.

* Migrate the design-system app.

* Refactor the consent toast to use sonner.

* Switch docs to use the new sonner toasts.

* Remove toast examples from the design-system app.

* Remove all toast-related components and old code.

* Fix the progress bar in the toast progress component. Also make the bottom components vertically centered.

* Fix the width of the toast progress.

* Use text-foreground-lighter instead of muted for ToastProgress text

* Rename ToastProgress to SonnerProgress.

* Shorten the text in sonner progress.

* Use the correct classes for the close button. Add a const var for the default toast duration. Remove the custom width class from sonner.

* Set the position for all progress toasts to bottom right. Set the duration for all toasts to the default (when reusing a toast id from loading/progress toast, the duration is set to infinity).

* Fix the playwright tests.

* Refactor imports to use ui instead of @ui.

* Change all imports of react-hot-toast with sonner. These components were merged since the last commit to this branch.

* Remove react-hot-toast lib.

---------

Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
Co-authored-by: Jonathan Summers-Muir <MildTomato@users.noreply.github.com>
2024-08-31 07:50:51 +08:00
Charis 5cd8384bca feat(docs), refactor(docs,studio): add regions list to docs (#28125)
* feat(docs), refactor(docs,studio): add regions list to docs

Adds list of supported AWS regions to docs.

Pulls the region information into `shared-data` package to provide common source of truth for dashboard and docs.

* style: format
2024-07-23 12:45:44 -04:00
Joshen Lim d80befbae2 More auth related sentry whitelist errors (#27481)
* More auth related sentry whitelist errors

* Make pretty
2024-06-24 14:29:12 +08:00
Jonathan Summers-Muir 330ae6e407 [Dashboard] Chore/refactor new project form (#26997)
* init layouts in project settings

* Update general.tsx

* update gap

* Update Scaffold.tsx

* Update PostgrestConfig.tsx

* Update PostgrestConfig.tsx

* spacing issues

* now added a enabled switch

* Revert "now added a enabled switch"

This reverts commit f22050302a.

* Update PostgrestConfig.tsx

* Update PostgrestConfig.tsx

* revert

* Update project-postgrest-config-update-mutation.ts

* add bottom padding

* init changes

* Update PostgrestConfig.tsx

* Update [slug].tsx

* Update PostgrestConfig.tsx

* fix

* Update PostgrestConfig.tsx

* Update PostgrestConfig.tsx

* Update PostgrestConfig.tsx

* Pull updates, resolve conflicts

* remove staging/local specific logic.

• stopped provider Select from flashing
•

* Update [slug].tsx

* split up region query

* Update [slug].tsx

* Update [slug].tsx

---------

Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2024-06-06 19:32:10 +08:00
Joshen Lim 163263c3c5 First round of wrapping RQ errors with handleError (#26384)
* First round of wrapping RQ errors with handleError

* Remove the throw before the handleError usage.

* Make the handling of an API error more versatile. Add logging in Sentry if the error is of unknown type.

* Remove throwing of the handleError function.

* Add return type to the handleError function to be never so that we're sure it always throws.

---------

Co-authored-by: Ivan Vasilov <vasilov.ivan@gmail.com>
2024-05-17 16:30:55 +08:00
Kevin Grüneberg f9a55935f5 chore: use type imports for types/interfaces (#21738) 2024-03-04 20:48:22 +08:00
Ivan Vasilov 5417ba344f fix: Handle Cloudflare errors in the region selector (#20435)
* Simplify the logic when selecting another cloud provider.

* Make the regionSelector handle errors and not block the selec when it's loading.

* Add retry logic in get default region query

---------

Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2024-01-15 23:40:00 +08:00
Joshen Lim 199dd37ac8 Offer select closest region CTA in project creation (#20262)
* Offer select closest region CTA in project creation

* Update region select CTA to use cloudflare and support all regions

* Auto select region, remove CTA

* Update apps/studio/components/interfaces/ProjectCreation/RegionSelector.tsx

Co-authored-by: Alaister Young <alaister@users.noreply.github.com>

---------

Co-authored-by: Alaister Young <alaister@users.noreply.github.com>
2024-01-11 15:23:34 +08:00
Ivan Vasilov 436bdb10ae chore: Move the studio app to apps/studio (#18915)
* Move all studio files from /studio to /apps/studio.

* Move studio specific prettier ignores.

* Fix the ui references from studio.

* Fix the css imports.

* Fix all package.json issues.

* Fix the prettier setup for the studio app.

* Add .turbo folder to prettierignore.

* Fix the github workflows.
2023-11-15 12:38:55 +01:00