Commit Graph
24 Commits
Author SHA1 Message Date
supabase-vercel-tedd[bot] 39295dd584 docs(api): explain that default privilege changes leave existing tables exposed (#53639)
## Problem

The Securing your API guide explains how to stop new objects in `public`
from getting Data API grants. It doesn't say that this only changes the
defaults for objects created later. Existing tables keep their grants
and stay reachable through the Data API.

Related to
[FDBKIN-41883](https://linear.app/supabase/issue/FDBKIN-41883)
Closes [DOCS-1685](https://linear.app/supabase/issue/DOCS-1685)

## Solution

Adds text to `apps/docs/content/guides/api/securing-your-api.mdx` and
rewrites no existing text:

- **Default privileges:** a new paragraph says that changes to default
privileges, including the platform default change, apply only to new
objects, so existing tables keep their grants and stay reachable through
the Data API. A per-table revoke follows it: `revoke all on table
public.your_table from anon, authenticated, service_role;`. A sentence
after it says that leaving out `service_role` keeps server-side access
with a secret key.
- **Revoke default privileges:** a new sentence says that existing
tables, sequences, and functions keep their current grants. It links to
the per-table revoke in `#default-privileges`.

Sources for the behavior:
- The Dashboard toggle's SQL (`buildDefaultPrivilegesSql` in
`packages/pg-meta/src/sql/studio/database/privileges.ts`) runs only
`alter default privileges … grant/revoke` statements. It runs no revoke
on existing tables.
- The Postgres docs for `ALTER DEFAULT PRIVILEGES` say it affects only
objects created later.
- `getting-started/api-keys.mdx` says that a secret key uses
`service_role`, which bypasses RLS but still needs table grants.
- Checked on PGlite (PostgreSQL 18.6). After `alter default privileges …
revoke all on tables`, a table created earlier kept its `anon`,
`authenticated`, and `service_role` grants, and a table created later
had none. After the per-table revoke, `has_table_privilege('anon',
'public.old_t', 'select')` returned false. With `service_role` left out
of the revoke, `service_role` still read an RLS-enabled table. With
`service_role` included, it got `permission denied`.

Checks run: `pnpm turbo run lint --filter='[origin/master]'` (0 errors),
`pnpm turbo run typecheck --filter='...[origin/master]'`, Prettier
`--check` on the changed file, and `pnpm -C apps/docs run
check:removed-anchors`. `pnpm build:guides-markdown` didn't run locally:
its federated-content step needs GitHub credentials. The docs tests
weren't run because they need Docker.

## 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-19 22:23:30 +00:00
Kody JacksonandClaude Sonnet 5.5 671c94e868 chore(docs,kb) - Update 301 destinations to final resolution + fix some 404s (#53553)
## Context

Lots of links that initially go to 301's within docs / kb. Updates these
to their resolved target.

Ask your Claude Code to review the new destinations programmatically.

---------

Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-18 15:10:08 +00:00
Kody JacksonandClaude Sonnet 5.5 ceae23e199 docs: add cross-links in guides (AI, API, Auth, Database, Functions, deployment) (#53560)
## What

Adds internal cross-links to docs guides

## Testing

- Prettier passes on the changed lines.
- Docs build passes (`pnpm build --filter=docs`).
- Docs link e2e run locally against the production build for every
changed page across this PR

---------

Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-18 08:57:10 -06:00
Kody Jackson d4a2c464b2 chore(docs) - update troubleshooting links to new destinations (#52095)
## Problem

KB now has definitive version of the troubleshooting guides. Need to
update the in content links to match work happening in #52088.

## Preview links

N/A... all atomic changes to links, so previews not very helpful here.
2026-10-22 08:02:23 -05:00
Alexis Aguilar ae991bb19e docs: correct default privilege and function revoke guidance (#51960)
Issue found during my dogfooding project :)

## Problem

The docs on default privileges in `public` don't match what Postgres
grants or what the revoke statements do:

- **Default privileges:** Securing your API and the Row Level Security
guide say new tables grant `SELECT`, `INSERT`, `UPDATE`, and `DELETE`.
New tables grant every table privilege, which also includes `TRUNCATE`,
`REFERENCES`, `TRIGGER`, and, on Postgres 17, `MAINTAIN`.
- **Revoking them:** the statements in Revoke default privileges match
what the Dashboard runs. They remove the privileges the Data API uses,
and leave the other four on new tables and `UPDATE` on new sequences.
- **Functions:** `alter default privileges ... in schema public revoke
execute on functions from public` has no effect. Postgres grants
`EXECUTE` to `PUBLIC` through a global default, and a revoke limited to
one schema can't remove it ([Postgres
docs](https://www.postgresql.org/docs/current/sql-alterdefaultprivileges.html)).
New functions stay callable by `anon` and `authenticated` through the
Data API. Securing your API, Working with branches, and Database
functions each say they don't.
- **Dashboard label:** Working with branches refers to a **Default
privileges for new entities** setting. The Data API settings label it
**Automatically expose new tables**.

Resolves
[DOCS-1457](https://linear.app/supabase/issue/DOCS-1457/default-privilege-docs-miss-truncate-references-trigger-and-maintain).

## Solution

The pages describe what Postgres grants and what the Dashboard setting
leaves behind. The revoke procedure removes every default privilege on
new objects.

- **Securing your API:** Default privileges shows the defaults in a
table, and lists what turning off **Automatically expose new tables** in
the Data API settings leaves behind. Revoke default privileges revokes
every privilege on new tables, sequences, and functions, including the
`execute` grant to `PUBLIC`. A caution explains that this revoke also
restricts functions in other schemas, such as helper functions that RLS
policies call. A new Check your default privileges section has a query,
run in the SQL Editor or with `psql`, that lists what each Data API role
receives on new objects.
- **Row Level Security:** the grants table lists every privilege, which
matches its introduction.
- **Working with branches:** uses the current setting label, and says
what the revoke migration leaves, with `maintain` marked as Postgres 17
only.
- **Database functions:** revokes `EXECUTE` from `PUBLIC` without `in
schema`, and notes that the change applies to functions in every schema.

Each changed snippet was run in page order on a hosted project on
Postgres 17.11, inside a transaction that rolled back.

## Product issue

The Dashboard's **Automatically expose new tables** setting runs the
same function revoke
(`packages/pg-meta/src/sql/studio/database/privileges.ts`), so turning
it off leaves new functions callable.
[DAT-192](https://linear.app/supabase/issue/DAT-192) tracks it.

cc @supabase/data-api @avallete

## Preview links

- [Securing your
API](https://docs-git-alexisa-docs-1457-supabase.vercel.app/docs/guides/api/securing-your-api)
- [Row Level
Security](https://docs-git-alexisa-docs-1457-supabase.vercel.app/docs/guides/database/postgres/row-level-security)
- [Working with
branches](https://docs-git-alexisa-docs-1457-supabase.vercel.app/docs/guides/deployment/branching/working-with-branches)
- [Database
functions](https://docs-git-alexisa-docs-1457-supabase.vercel.app/docs/guides/database/functions)

## Additional context

- The Working with branches sentence about new functions on branches
follows from the Postgres default. It wasn't tested on a branch.
- Securing your API and the Row Level Security guide still describe
defaults "on existing projects". That wording changes when the new
default reaches every project, so this PR leaves it.
2026-10-20 11:52:57 -07:00
Maksym Ionutsa 4d492db5eb docs: update settings links after upgrade UI move to General (#49053)
## 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?

docs update
- Upgrade project button and Postgres/PostgREST version checks moved
from Infrastructure to General settings
- Updated links across 13 docs pages to match


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

- **Documentation**
- Updated dashboard links throughout the documentation to direct users
to **General Settings** instead of **Infrastructure Settings**.
- Corrected guidance for Postgres, pgvector, pg_net, and PostgREST
upgrades, configuration, and version checks.
- Updated monitoring, Grafana, and Log Drains links to current
documentation paths.
- Fixed troubleshooting links, CLI project path examples, pg_cron
terminology, and Markdown formatting.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-08-13 22:38:04 +02:00
Miranda Limonczenko c1d010a699 feat(docs) Add a SKILL to write stronger documentation and apply it to guides/api/securing-your-api (#48018)
Closes DOCS-1176

## Summary

This PR adds documentation-writing guidance for humans and agents, then
applies it to the “Securing your API” guide.

## Changes

- Add a documentation word list based on Google’s style guide and
existing MDX lint rules.
- Add a shared `docs-guides` Agent Skill with Cursor and Claude
integration.
- Expand contributing guidance for information types, procedures,
chunking, links, admonitions, grammar, and terminology.
- Restructure “Securing your API” into contextual and procedural
sections.
- Add section navigation, cross-references, transitions, and procedural
outcomes.
- Reduce repeated admonitions and improve scannability.

## Manual testing

1. Open `/docs/guides/api/securing-your-api` in Preview and compare to
Live.
https://docs-git-docs-restructure-api-supabase.vercel.app/docs/guides/api/securing-your-api
2. See that the content is improved and clear with no important context
removed.
3. See the Admonitions that are no longer marked as admonitions. See the
content still makes sense.
4. Review the diff of `CONTRIBUTING.md` and `WORD_LIST.md`.
5. See that you agree with the new rules and that they are clear.


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

* **Documentation**
* Updated documentation-writing guidelines with clearer standards for
structure, formatting, components, diagrams, terminology, and
navigation.
* Added a comprehensive word and style reference for consistent
documentation language.
* Reworked the API security guide with clearer guidance on grants, RLS,
dedicated schemas, pre-request checks, rate limiting, and API keys.
* Added documentation authoring workflow guidance, including validation
and formatting steps.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-07-17 18:48:45 +00:00
Gabriel ClaudinoandMiranda Limonczenko 4c31f84c75 Apply suggestion from @czenko
Co-authored-by: Miranda Limonczenko <miranda.limonczenko@supabase.io>
2026-07-16 09:26:54 +01:00
Gabriel Claudino 432aecce59 docs: clarify supabase_admin default privileges are intentional 2026-07-15 09:12:09 +01:00
Joshen Lim 1de298ff31 Reinstate https://github.com/supabase/supabase/pull/45143 into latest master (#47433)
## Context

Previous PR was [here](https://github.com/supabase/supabase/pull/45143)
but it got stale with lots of conflicts so figured it'll be easier redo
it off the latest master

Moves policies page from Auth to Database under an Access Control
section along with Roles. This moves all existing files, applies
redirects, and updates urls to point to the new route

<img width="274" height="412" alt="image"
src="https://github.com/user-attachments/assets/7952c185-64ae-4355-ba36-45397efe1787"
/>

<img width="453" height="471" alt="image"
src="https://github.com/user-attachments/assets/04b3dcb3-48a5-4049-9893-d01109fb46a9"
/>


## To test
- [ ] Verify that policies now live under Database correctly

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

* **New Features**
* Added a quick navigation shortcut to open **Database > Policies
(RLS)**.
* **Bug Fixes**
* Updated Policies and RLS-related links across the product to open the
**Database policies** area (menus, command palette, context actions,
alerts, and link-outs).
* Added a permanent redirect from the old **auth policies** URL to the
new **database policies** URL.
* **Documentation**
* Updated RLS Dashboard and security checklist instructions to reference
**Database > Policies**.
* **Tests**
  * Adjusted automated tests to validate the new Policies route.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-06-30 18:49:33 +08:00
Saxon Fletcher 3ef1c1e08c Add recommendation on schema isolation (#45390) 2026-04-30 18:09:33 +10: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 Chinchilla a96d3d2b21 docs: API landing pages overhaul (#45062) 2026-04-28 14:13:48 +02:00
Chris Chinchillaandfadymak 9a8ea280ed docs: Key changes in API section (#44994)
## 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**
* Updated API docs and quickstart examples to reference publishable API
keys in configuration snippets, cURL examples, and browser guidance.
* Adjusted quickstart cURL examples to simplify headers and align with
publishable-key usage.
* Clarified security guidance to recommend distributing publishable keys
where appropriate and updated related wording across guides.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: fadymak <dev@fadymak.com>
2026-04-21 15:48:46 +01:00
6b8772a33e Update Data API docs to include explicit grants (#42969)
Updates our documentation pages around the Data API to include
instructions on how to grant the necessary privileges across API roles
across tables and functions. Current behaviour means this is largely
unnecessary as privileges are granted by default on public schema, but
adding instructions will help cover scenarios where this isn't the case
and expose some of the underlying magic happening.

## To test:
- These updates refer to new settings that are added to the data api
that give more visibility and control over what tables and functions are
accessible via the api.
- To view these settings you'll need enable `tableEditorApiAccessToggle
` feature flag

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

* **Documentation**
* Added a new "Data API" guide and removed the old "Hardening the Data
API" page
  * Updated navigation links to surface the new Data API guide
* Expanded quickstarts, SDK install pages, and security guides with
step‑by‑step Data API exposure, default‑privileges, RLS guidance, and
SQL GRANT examples (including function EXECUTE notes)
* Updated troubleshooting references and added redirects for legacy
documentation paths
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: Claude Haiku 4.5 <noreply@anthropic.com>
Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>
Co-authored-by: SaxonF <1072756+SaxonF@users.noreply.github.com>
Co-authored-by: Chris Chinchilla <chris.ward@supabase.io>
Co-authored-by: Chris Chinchilla <chris@chrischinchilla.com>
2026-04-21 13:57:58 +10:00
973bacf783 docs: Data API IA (#42417)
*Summary*
- reorganize the navigation menu to highlight modules, consolidate API
security content, and move guide entries (auto-generated docs, type
generation, security topics) to the intended sections
- relocate the Data API hardening and custom claims RBAC guides into the
API subtree, updating internal references and redirects, and fixing
cross-links (including adjusting the Security reference order)
- adjust data API topic references (e.g., securing guide and role
management) to point to the new paths and ensure the helper link
ordering follows the requested layout

*Testing*
- Not run (not requested)

Change 1

<img width="1286" height="576" alt="image"
src="https://github.com/user-attachments/assets/d903e9b0-bbfc-403f-bcb9-eee540e466db"
/>

Change 2

<img width="1176" height="666" alt="image"
src="https://github.com/user-attachments/assets/82b3ea4c-b8d4-4cb9-ad90-6c39c8a1a997"
/>


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

## Summary by CodeRabbit

* **Documentation**
* Reorganized API documentation structure, consolidating REST and
GraphQL API guides under a dedicated API section.
* Moved security-related guides to API documentation paths for better
organization.
* Implemented automatic redirects for old documentation links to new
locations.
* Updated navigation menu to reflect the restructured documentation
layout.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: Chris Chinchilla <chris.ward@supabase.io>
Co-authored-by: Chris Chinchilla <chris@chrischinchilla.com>
2026-03-11 14:11:26 +01:00
Yogeshwaran C 647ac43c0a fix: correct indefinite article usage for acronyms (an HTTP, an API, an RLS) (#42919)
## What kind of change does this PR introduce?

Grammar corrections across documentation and test descriptions.

## What is the current behavior?

Multiple docs and test files use "a" before acronyms that start with a
vowel sound when pronounced:
- "a HTTP" (pronounced "aitch-tee-tee-pee") should be "an HTTP"
- "a API" (pronounced "ay-pee-eye") should be "an API"  
- "a RLS" (pronounced "arr-ell-ess") should be "an RLS"
- "the all users" is redundant (should be "all users")

## What is the new behavior?

All instances corrected to use proper English indefinite articles:

### Docs files (11 files):
- `firebase-auth.mdx` — "the all users" -> "all users" (2 occurrences)
- `log-drains.mdx` — "a HTTP drain" -> "an HTTP drain"
- `securing-your-api.mdx` — "a HTTP 402" and "a HTTP 420" -> "an HTTP"
- `scan-error-*.mdx` — "a HTTP 500" -> "an HTTP 500"
- `roboflow.mdx` — "a HTTP interface" -> "an HTTP interface"
- `auth-hooks.mdx` — "A HTTP Hook" -> "An HTTP Hook", "a HTTP hook" ->
"an HTTP hook", "a HTTP error" -> "an HTTP error"
- `auth-mfa.mdx` — "a HTTP 401" -> "an HTTP 401"
- `password-verification-hook.mdx` — "a HTTP request" -> "an HTTP
request"
- `before-user-created-hook.mdx` — "a HTTP implementation" -> "an HTTP
implementation"
- `pgtap-extended.mdx` — "a API exposed schema" -> "an API exposed
schema"
- `error-codes.mdx` — "a RLS policy" -> "an RLS policy"
- `broadcast.mdx` — "a RLS" -> "an RLS"

### Studio files (1 file):
- `CronJobs.utils.test.ts` — "a HTTP request" -> "an HTTP request" (9
test descriptions) + "notationa" typo -> "notation"

## Additional context

The rule: use "an" before acronyms pronounced with a leading vowel
sound. "HTTP" starts with "aitch" (vowel sound), "API" starts with "ay"
(vowel sound), and "RLS" starts with "arr" (vowel sound).
2026-02-19 07:23:18 -07:00
Filipe Cabaço feecf1f121 docs: add warning regarding db-pre-request usage (#41354) 2025-12-16 10:08:27 +01:00
GaryAustin1 dce1920ee1 Update securing-your-api.mdx to fix broken example (#30206)
The example for checking additional API keys has a security flaw and bad code.

It checked current_role for anon to do security, but because it is a security definer function the role will never be anon.

Added to check for the role claim in the jwt.

Also the table used for keys is UUID and the type from the header is text for the key.  Cast it to UUID.
2024-10-31 15:46:46 -04:00
Chris Gwilliams 77529b234b Remove mention of safeupdate temporarily (#28013)
remove mention of safeupdate temporarily
2024-07-22 11:42:21 +01:00
Charis b50c657e51 chore(docs): add link (#27829) 2024-07-08 13:12:48 -04: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
Liam Birkin 73c5826a49 fix: updated url for some docs links that were throwing 404 page (#23220)
fix 404 links
2024-04-24 15:00:36 +00:00
Charis b0b8b6b6e3 refactor: finish moving mdx to content directory (#21321) 2024-02-16 13:43:02 -05:00