Commit Graph
18 Commits
Author SHA1 Message Date
BrilliancoderandNik Richers 7d9cbcd2aa docs: fix grammar in managing user data guide (#54217)
Fixes a grammar error in the Exporting users section of the managing
user data guide by changing "table" to "tables".

Co-authored-by: Nik Richers <nrichers@gmail.com>
2026-12-01 19:41:46 -07:00
supabase-vercel-tedd[bot] 101afae233 docs(auth): warn that users can change their own user metadata (#53973)
## Problem

The "Adding and retrieving user metadata" section of the Managing user
data guide shows how to set and read user metadata, but never says that
users can change it themselves. A reader could store roles or tenant IDs
there and trust them in RLS policies or app logic.

Related to
[FDBKIN-25396](https://linear.app/supabase/issue/FDBKIN-25396/document-that-raw-user-meta-data-is-client-mutable)
Closes
[DOCS-1763](https://linear.app/supabase/issue/DOCS-1763/warn-that-users-can-change-their-own-user-metadata-in-user-management)

## Solution

Adds a danger admonition at the end of the section. It explains that any
signed-in user can rewrite their own `user_metadata`, including the
claim in the JWT, so it must not hold authorization data or be trusted
in RLS. It points readers to `app_metadata` for values users must not
change, which only a trusted server with the secret key can set. It
links to the existing warnings on the Users page and in the RLS guide
instead of repeating them.

## How to verify

1. Open `/docs/guides/auth/managing-user-data` on the preview and scroll
to "Adding and retrieving user metadata".
2. Below the retrieval code tabs, a danger callout says that users can
change their own user metadata and that it must not hold roles or tenant
IDs or be trusted in RLS policies.
3. The callout says to store values that users must not change in
`app_metadata`.
4. The links to the user object
(`/docs/guides/auth/users#the-user-object`), `auth.jwt()`
(`/docs/guides/database/postgres/row-level-security#authjwt`), the
secret key page, and `auth.admin.updateUserById()` resolve and land on
the right sections.

## Checks

Ran `pnpm turbo run typecheck --filter='...[origin/master]'`, `pnpm
turbo run lint --filter='[origin/master]'`, and `pnpm exec oxfmt
--check` on the changed file; all pass. Docs tests skipped because they
need Docker. Checked behavior against `supabase/auth`
`internal/api/user.go` (`UserUpdate`: `data` updates user metadata with
no admin check; `app_metadata` from a non-admin returns `not_admin`) and
`internal/models/user.go` (`UpdateUserMetaData` merges keys and deletes
null ones).

## Checklist

- [x] I have read the [contributing
guidelines](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md)
- [x] The change is scoped to one docs section and adds no code samples

## Feedback for Tedd

To ask Tedd for a change to this PR, reply in Tedd's session on
[DOCS-1763](https://linear.app/supabase/issue/DOCS-1763/warn-that-users-can-change-their-own-user-metadata-in-user-management).
Tedd doesn't read comments on this PR.

---------

Co-authored-by: supabase-vercel-tedd[bot] <336548405+supabase-vercel-tedd[bot]@users.noreply.github.com>
2026-11-24 13:52:36 -07:00
supabase-vercel-tedd[bot]andAlexis Aguilar bdc7f1a527 docs(auth): add RLS policies for the profiles table in User Management (#53770)
## Problem

The "Accessing user data via API" section of the User Management guide
creates `public.profiles`, enables RLS, and adds a signup trigger, but
shows no policy. A reader who copies it gets a table that no client can
read. The section also never says that the trigger creates the profile
row, so readers try to insert it from the client after `signUp`, and
that insert fails under RLS.

Related to
[FDBKIN-20750](https://linear.app/supabase/issue/FDBKIN-20750/improve-guidance-on-creating-public-user-profile-tables-linked-to-auth)
Closes [DOCS-1728](https://linear.app/supabase/issue/DOCS-1728)

## Solution

The section now says that the trigger creates the profile row at signup,
and why it needs no insert policy: the `security definer` function runs
as `postgres`, which bypasses RLS. It explains that a client insert
fails without an insert policy, and that with no policies clients can't
read the table. Then it adds a select policy and an update policy that
let each signed-in user read and edit only their own row, keyed on this
page's `id` column. Other patterns link to the Row Level Security guide
instead of being repeated. The sentence that introduced the trigger said
it "updates" the table. It now says it creates a row.

## Checks

Ran Prettier on the changed file, plus `pnpm turbo run lint
--filter='[origin/master]'` and `pnpm turbo run typecheck
--filter='...[origin/master]'`, which passed. I ran the section's SQL
blocks in order as one script on PGlite (Postgres 17), with stub
`anon`/`authenticated`/`service_role` roles, an `auth.users` table, and
an `auth.uid()` that reads `request.jwt.claim.sub`. Results:
- The trigger created profile rows with no insert policy.
- As `authenticated`, a user read only their own row and updated only
their own row. Changing `id` to another user's, or inserting from the
client, failed with `new row violates row-level security policy for
table "profiles"`.
- `anon` read no rows.

Facts were checked against the RLS guide's select and update policy
sections and the functions guide's `security definer` section.

## Second reader

Verdict: ready, no blockers. Nits:
- The trigger's intro sentence repeated the new text and said "update".
Fixed: the intro now says it creates a row, and the paragraph after the
caution now opens with what not to do.
- The insert explanation was split around the policies. Fixed: it's now
one paragraph.
- It didn't say why `security definer` skips the insert policy. Fixed:
the page now names the `postgres` owner, which bypasses RLS.
- Link the public-profiles example directly. Fixed.
- Spell out RLS on first use. Left as is: the abbreviation predates this
change, and the page links Row Level Security by name above.

Second read of the reworded insert paragraph: ready, no blockers. Two of
its nits are fixed: the page says the owner is `postgres` when the
function is created in the Dashboard or by a migration, and it uses
"sign-up" instead of the JavaScript method name. Two were left for
review: split the "creates it" and "no insert policy" clauses, and write
"Row Level Security (RLS)". A third read of that fix found no blockers
and no nits.

Follow-ups outside this change:
- The grants block gives `anon` select and `authenticated`
insert/delete, which no policy uses.
- The quickstart SQL partial still adds a client insert policy for
profiles.

## How to verify

1. Open `/docs/guides/auth/managing-user-data` on the preview, section
"Accessing user data via API".
2. The section shows SQL for a select policy and an update policy on
`public.profiles` that use `auth.uid()` and the `id` column.
3. The text says that the trigger creates the profile row at signup and
that the client doesn't insert it.
4. The text says that without policies, clients can't read or change the
table.
5. The section links to the Row Level Security guide for other policy
patterns.
6. Pasting the section's SQL blocks, in order, into the SQL Editor runs
without errors.

## Checklist

- [x] I have read
[CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md)
- [x] If I wrote a new docs topic or edited an existing topic, I used
the `/write-the-docs` or `/edit-the-docs` skill, which applies the docs
[style
guide](https://github.com/supabase/supabase/tree/master/apps/docs/style-guide)

---------

Co-authored-by: supabase-vercel-tedd[bot] <336548405+supabase-vercel-tedd[bot]@users.noreply.github.com>
Co-authored-by: Alexis Aguilar <98043211+alexisintech@users.noreply.github.com>
2026-11-23 18:17:01 -07:00
supabase-vercel-tedd[bot] edece97bdc docs(auth): explain why the signup trigger must schema-qualify names (#53695)
## Problem

The User Management guide shows a trigger that copies new users into
`public.profiles`, but it doesn't say why the function sets `search_path
= ''` and writes `public.profiles` in full. A reader who drops the
schema from a table name breaks every sign-up, and the page doesn't
connect that to the `Database error saving new user` response.

Related to
[FDBKIN-40810](https://linear.app/supabase/issue/FDBKIN-40810/document-best-practices-for-security-definer-triggers-on-authusers)
Closes
[DOCS-1715](https://linear.app/supabase/issue/DOCS-1715/explain-why-the-signup-trigger-must-schema-qualify-tables)

## Solution

A caution admonition right after the trigger example on
`/guides/auth/managing-user-data` tells readers to schema-qualify every
non-built-in name in the function, such as `public.profiles`. It
explains that the function sets `search_path = ''`, so Postgres can't
find an unqualified name, the trigger fails, and every sign-up fails
with `Database error saving new user`. The note leaves out the Auth
role's own search path, because it doesn't apply once the function sets
an empty one. For why the search path stays empty, it links to the
"Security `definer` vs `invoker`" section of the database functions
guide instead of repeating it. The SQL example and the rest of the page
are unchanged.

## How to verify

1. On the preview, open `/docs/guides/auth/managing-user-data`.
2. Right after the `handle_new_user` / `on_auth_user_created` SQL
example, a caution note says to schema-qualify names such as
`public.profiles`, says the function's `search_path = ''` is why an
unqualified name fails, and gives the `Database error saving new user`
error.
3. The note's link opens the "Security `definer` vs `invoker`" section
of `/docs/guides/database/functions`.
4. No other text on the page changed.

## Checks

Ran `pnpm turbo run typecheck --filter='...[origin/master]'`, `pnpm
turbo run lint --filter='[origin/master]'` (0 errors), and Prettier
`--check` on the changed file. The error string was checked against
`supabase/auth` `internal/api/signup.go` (`signupNewUser` returns
`Database error saving new user` when the user insert fails). The docs
tests were skipped because they need Docker. A second reader reviewed
the change against the style guide.

## Checklist

- [x] I have read
[CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md)
- [x] If I wrote a new docs topic or edited an existing topic, I used
the `/write-the-docs` or `/edit-the-docs` skill, which applies the docs
[style
guide](https://github.com/supabase/supabase/tree/master/apps/docs/style-guide)

---------

Co-authored-by: supabase-vercel-tedd[bot] <336548405+supabase-vercel-tedd[bot]@users.noreply.github.com>
2026-11-20 16:36:36 -07:00
Guillaume Faas 94bc3f8d07 docs(csharp): add C# snippets (#48537)
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **Documentation**
* Added C# examples across API, authentication, database, Realtime, and
Storage guides.
* Expanded authentication coverage for passwordless, phone, anonymous,
identity linking, SSO, sign-out, and social login providers.
* Added database examples for queries, functions, joins, JSON, arrays,
search, PostGIS, and custom schemas.
* Added Realtime examples for broadcasts, presence, subscriptions, and
database changes.
* Added Storage examples for buckets, uploads, downloads,
transformations, CDN purging, and resumable transfers.
  * Included C# error-handling guidance and relevant reference links.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-08-03 13:13:55 +02:00
Pedro RodriguesandClaude Opus 4.8 91b40f15ab docs: how to fully remove account access when deleting a user (#48487)
The [User Management → Deleting
users](https://supabase.com/docs/guides/auth/managing-user-data) section
warned that deleting a user does not sign them out, but did not say what
to do about it. Adds a **Removing account access** subsection: revoke
sessions before deleting, why a soft-delete flag or
[ban](https://supabase.com/docs/reference/javascript/auth-admin-updateuserbyid)
is not a substitute, and the residual [access-token
window](https://supabase.com/docs/guides/auth/sessions) after
revocation.

Fills a docs gap surfaced by
[supabase/agent-skills#194](https://github.com/supabase/agent-skills/pull/194)
while investigating the
[`investigate-auth-001-deleted-user-access`](https://github.com/supabase/evals/blob/main/evals/investigate-auth-001-deleted-user-access/PROMPT.md)
eval scenario.

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

* **Documentation**
* Updated the “Deleting users” guidance to specify deleting via
`auth.admin.deleteUser()` (with `shouldSoftDelete: false`) and clarify
that this cascades to sessions, invalidates refresh tokens, and blocks
new access-token minting.
* Rewrote the explanation to emphasize that it does not substitute for
temporary bans or application-level “deleted” states.
* Clarified the access-token window: already-issued stateless JWTs
remain valid until `exp`, and recommended mitigations include short JWT
expiry and enforcing session validation (via `session_id`) for sensitive
actions.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-30 13:22:10 +01:00
Chris ChinchillaandCopilot 0e736457c8 docs: update docs to reflect new permission models for data api (#45288)
## I have read the
[CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md)
file.

YES

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

* **Documentation**
* Instructed granting least-privilege table permissions for anon,
authenticated, and service roles prior to enabling Row Level Security
across multiple guides and quickstarts.
* Clarified SQL examples and inline comments, added explicit GRANT steps
and RLS SELECT policies, rephrased policy guidance, and adjusted example
ordering and section numbering for clearer setup and testing.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-04-29 06:54:49 +00:00
Chris ChinchillaandCharis Lam 6821c07811 docs: feature toggle tests (#38282)
* Docs feature toggle tests

* Prettier

* Types fix

* Hide unsupported languages

* Fix import

* Add unsupported code warning

* Further SDK toggling

* Temp intro text

* Auth toggles

* clean up conditional visibility code

* fix: typecheck, tests, tiny bug

---------

Co-authored-by: Charis Lam <26616127+charislam@users.noreply.github.com>
2025-09-04 16:46:08 +02:00
hallidayo 14fd307392 fix: auth docs - removed example line (#36078)
removed example line
2025-06-02 16:21:42 +00:00
Charis 258bc37919 docs: add type hints (#34678) 2025-04-08 13:25:46 -04:00
Charis a820c56ed0 chore: docs linting (#33574) 2025-02-21 14:13:00 -05:00
Chris StocktonandChris Stockton 5af1abd28c feat: update emails to use a valid email address (#30978)
The purpose of this change is to reduce the bounce back rate of
the default email provider at Supabase. This change will allow
users to continue copying examples from the docs. Without it, an
upcoming change in supabase/auth[1] will begin rejecting these
invalid emails.

[1] https://github.com/supabase/auth/pull/1845

Co-authored-by: Chris Stockton <chris.stockton@supabase.io>
2024-12-09 15:43:35 -07:00
Tyler b4e3f47008 docs: Add Flutter / Dart sample codes into the guides. (#27106)
* docs: Adds Dart sample code into using custom schemas guide

* Add Flutter code to OAuth docs

* docs: Add sign out Flutter code to the OAuth guides

* Add Flutter code samples to the auth guides

* docs: Add Flutter code samples to storage docs

* docs: align all Flutter sample code to say Flutter instead of Dart

* docs: sort clean up Flutter and Dart labels

* docs: minor sample code fix

* run prettier
2024-06-11 14:05:52 +09:00
ec86bbc4fe feat: new auth ia (#22812)
Co-authored-by: Kang Ming <kang.ming1996@gmail.com>
Co-authored-by: Joel Lee <lee.yi.jie.joel@gmail.com>
2024-05-07 20:15:06 +00:00
Oliver Rice 13d8514c34 Remove references to non-empty search path as they are now lint warnings (#25853)
remove references to non-empty search path as they are now lint warnings
2024-05-07 15:07:20 -04:00
Charis 5d8cef6040 fix: update all examples and snippets to use select for auth rls func… (#22632)
fix: update all examples and snippets to use select for auth rls functions
2024-04-11 12:56:11 -04:00
Guilherme Souza 6006619c2a chore(docs): add Swift guides (#22625)
* chore(docs): add Swift guides

* chore(docs): add Swift guides for postgres changes

* chore: fix link identity swift method

* chore(docs): add Swift guides for realtime and storage

* chore: run npm run format

* chore(docs): add Swift example for passing params to `rpc` function
2024-04-10 10:57:27 -04:00
Charis e20038e2f2 refactor: move auth guides into content directory (#20777)
Begin the process of moving our MDX files into their own content directory.

Fixed a few minor bugs re: ToC and tabs not rerendering consistently on page navigation. (The ToC thing wasn't a problem before the refactor, the tabs thing is a problem on prod.)

Moved MDX files can't import their own components, so everything they require needs to be back in the component prop for mdx-remote's serializer. Cleaned this up a bit and lazy-loaded heavy/rare stuff. Also, the component prop doesn't take arbitrary objects (only actual components), so imported data has to be wrapped in a component.
2024-02-07 17:25:08 +00:00