Skip to main content
Glama

audit_supabase_rls

Audit Supabase/Postgres access control via catalog metadata: find tables with RLS off, always-true policies, tenant leaks, exposed views and SECURITY DEFINER risks. Read-only role suffices.

Instructions

Audit a Supabase/Postgres database's access control and return a human-readable report (use get_findings for JSON). Covers: tables with RLS off; permissive policies (USING (true) or anything that reduces to always-true); anon/authenticated policies that do not scope rows to the caller (tenant leaks) for SELECT, INSERT, UPDATE and DELETE; policies that trust user-editable user_metadata; Storage (public buckets and storage.objects policies, reported as storage_); SECURITY DEFINER functions (callable by anon, search_path not pinned, reading user_metadata); views that run as their owner and skip RLS; exposed materialized views; Realtime publications streaming anon-readable rows; default privileges that grant future tables to the API roles; roles with BYPASSRLS; and tables owned by a client role without FORCE RLS. Reads ONLY catalog metadata, never row data, so a read-only role is enough; a check the role cannot read is reported as check_skipped. Not covered: Auth settings and Edge Functions code, which are not in the database catalog.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "db_url": "<db_url>"
    },
    "name": "audit_supabase_rls"
  }
}

Input Schema

NameRequiredDescriptionDefault
allowNoPolicy names that are intentionally permissive (e.g. a public status page). Prefer the qualified form "table.policy".
db_urlYesPostgres connection string for the project to audit (e.g. postgresql://... — get it from `supabase status` locally or your project's connection settings). A read-only role is enough.
schemaNoSchema to audit (default: public).public

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.1

TDQS

A4.6/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the full burden and does so: it declares the operation reads only catalog metadata and never row data, discloses that unreadable checks degrade gracefully to check_skipped, and names the coverage boundary. These are the exact behavioral facts an agent needs before calling a security audit.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Front-loaded with purpose and output routing before the long coverage enumeration, and every listed item is an audit category rather than filler. The dense semicolon-delimited run-on in the middle is harder to scan than a bulleted list would be, but no sentence is wasted.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a three-parameter, read-only audit tool with no output schema, the description supplies the output shape (human-readable report), the machine-readable alternative, the privilege requirement, graceful-degradation behavior, and an explicit non-coverage list. Nothing material an agent needs to invoke it correctly is missing.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so all three parameters are already documented in the schema. The description adds no parameter-level detail beyond that (e.g., how db_url failures surface or how allow matching behaves when unqualified), so baseline 3 applies.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Opens with a specific verb and resource ("Audit a Supabase/Postgres database's access control") and immediately states what it returns plus the sibling that returns the alternative format ("use get_findings for JSON"). The enumerated coverage list (RLS off, permissive policies, tenant leaks, storage, SECURITY DEFINER, etc.) makes the tool's scope unmistakable.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Explicitly routes the agent between this tool and get_findings by output format, states the privilege prerequisite ("a read-only role is enough"), and defines an explicit exclusion list ("Not covered: Auth settings and Edge Functions code"). An agent knows both when to pick this tool and when not to.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.