Skip to content

Docs/rls grant truncate fixes - #48388

Closed
tagadearpit wants to merge 2 commits into
supabase:masterfrom
tagadearpit:docs/rls-grant-truncate-fixes
Closed

tagadearpit wants to merge 2 commits into
supabase:masterfrom
tagadearpit:docs/rls-grant-truncate-fixes

Conversation

@tagadearpit

@tagadearpit tagadearpit commented Jul 28, 2026 •

Copy link
Copy Markdown

I have read the CONTRIBUTING.md file.

YES/NO

What kind of change does this PR introduce?

Bug fix, feature, docs update, ...

What is the current behavior?

Please link any relevant issues here.

What is the new behavior?

Feel free to include screenshots if it includes visual changes.

Additional context

Add any other context or screenshots.

Summary by CodeRabbit

  • Documentation
    • Clarified that Row Level Security is enabled by default for tables created in the dashboard.
    • Added guidance to revoke default permissions before assigning role-specific access.
    • Updated SQL examples and security checklist guidance, including reviewing role grants and noting that RLS does not protect TRUNCATE operations.

@tagadearpit
tagadearpit requested a review from a team as a code owner July 28, 2026 11:26
@github-actions github-actions Bot added the documentation Improvements or additions to documentation label Jul 28, 2026
@vercel

vercel Bot commented Jul 28, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
design-system Ready Ready Preview, Comment Jul 28, 2026 11:29am

Request Review

@github-actions

Copy link
Copy Markdown
Contributor

Thanks for contributing to Supabase! ❤️ Our team will review your PR.

A few tips for a smoother review process:

  • If you have a local version of the repo, run pnpm run format to make sure formatting checks pass.
  • Once we've reviewed your PR, please don't trivially merge master (don't click Update branch if there are no merge conflicts to be fixed). This invalidates any pre-merge checks we've run.

@vercel

vercel Bot commented Jul 28, 2026

Copy link
Copy Markdown

@tagadearpit is attempting to deploy a commit to the Supabase Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai

coderabbitai Bot commented Jul 28, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The PR updates PostgreSQL security documentation with guidance on default privileges, RLS coverage, permission revocation, and an INSERT policy schema example.

Changes

RLS documentation

Layer / File(s) Summary
Privilege and RLS security guidance
apps/docs/content/guides/database/postgres/row-level-security.mdx, apps/docs/content/guides/deployment/going-into-prod.mdx
Documents dashboard-created table defaults, revokes default permissions before role-specific grants, adds role_table_grants review guidance, and notes that RLS does not cover TRUNCATE.
INSERT policy SQL example
apps/docs/content/guides/database/postgres/row-level-security.mdx
Changes the profiles.id declaration to id uuid uuid primary key.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Possibly related issues

Possibly related PRs

Suggested reviewers: czenko

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description is only the template text and does not provide the required PR details. Fill in the template with the actual change type, current behavior, new behavior, and any additional context or linked issues.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title is concise and generally matches the docs changes about RLS grants and TRUNCATE behavior.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
apps/docs/content/guides/database/postgres/row-level-security.mdx (1)

18-28: 🔒 Security & Privacy | 🟠 Major | ⚡ Quick win

Separate existing grants from future default privileges. REVOKE ON TABLE only affects the named existing table, but the RLS note implies this covers Supabase’s default table grants for future objects. Keep information_schema.role_table_grants for current grants, and either add explicit ALTER DEFAULT PRIVILEGES/pg_default_acl guidance or clearly scope the RLS section to existing objects only.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@apps/docs/content/guides/database/postgres/row-level-security.mdx` around
lines 18 - 28, Clarify the privilege guidance so existing-table grants are
distinguished from future default privileges: update the RLS section in
apps/docs/content/guides/database/postgres/row-level-security.mdx (lines 18-28)
to scope REVOKE ON TABLE guidance to existing objects or add ALTER DEFAULT
PRIVILEGES/pg_default_acl instructions, while preserving
information_schema.role_table_grants for current grants. Apply the corresponding
clarification at apps/docs/content/guides/deployment/going-into-prod.mdx (line
29), explicitly distinguishing current grants from future defaults.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@apps/docs/content/guides/database/postgres/row-level-security.mdx`:
- Line 213: Correct the profiles table definition by removing the duplicated
uuid type from the id column declaration, changing `id uuid uuid primary key` to
a single uuid type followed by the primary key constraint.

---

Outside diff comments:
In `@apps/docs/content/guides/database/postgres/row-level-security.mdx`:
- Around line 18-28: Clarify the privilege guidance so existing-table grants are
distinguished from future default privileges: update the RLS section in
apps/docs/content/guides/database/postgres/row-level-security.mdx (lines 18-28)
to scope REVOKE ON TABLE guidance to existing objects or add ALTER DEFAULT
PRIVILEGES/pg_default_acl instructions, while preserving
information_schema.role_table_grants for current grants. Apply the corresponding
clarification at apps/docs/content/guides/deployment/going-into-prod.mdx (line
29), explicitly distinguishing current grants from future defaults.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 5380db9a-57be-49db-8b20-1e537764824f

📥 Commits

Reviewing files that changed from the base of the PR and between b8310db and 7611edb.

📒 Files selected for processing (2)
  • apps/docs/content/guides/database/postgres/row-level-security.mdx
  • apps/docs/content/guides/deployment/going-into-prod.mdx

-- 1. Create table
create table profiles (
id uuid primary key,
id uuid uuid primary key,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "File context:"
sed -n '200,220p' apps/docs/content/guides/database/postgres/row-level-security.mdx

echo
echo "Postgres CREATE TABLE attribute_type examples in PostgreSQL docs availability is not local: checking local source context and simple parser grammar expectation"
python3 - <<'PY'
from pathlib import Path
p = Path('apps/docs/content/guides/database/postgres/row-level-security.mdx')
text = p.read_text()
needles = ['id uuid uuid primary key', 'id uuid primary key']
for n in needles:
    print(n, text.find(n))

# Deterministic check against documented SQL grammar property:
# SQL create_table column_def ::= column_name data_type ... can include zero or one data_type.
# Two identical data_type tokens is not the documented syntax.
print('two type tokens after column name:', '  id uuid uuid primary key,' in text)
PY

Repository: supabase/supabase

Length of output: 1093


Fix the duplicated uuid type.

The profiles table example uses invalid CREATE TABLE syntax with id uuid uuid primary key; change it to id uuid primary key.

Proposed fix
-  id uuid uuid primary key,
+  id uuid primary key,
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
id uuid uuid primary key,
id uuid primary key,
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@apps/docs/content/guides/database/postgres/row-level-security.mdx` at line
213, Correct the profiles table definition by removing the duplicated uuid type
from the id column declaration, changing `id uuid uuid primary key` to a single
uuid type followed by the primary key constraint.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant