PermDock
CLI

doctor

Diagnose a PermDock installation: server-only imports in client entries, unknown references, ungranted permissions, stale catalogs, roles or tenants read from unverified claims, missing skills and the TypeScript version.

permdock doctor runs every check PermDock knows how to make about a repository and prints a report with a fix for each finding. It is the first command an agent runs after wiring PermDock and the last one before opening a pull request. Findings have stable codes so skills and CI can reference them.

Usage

permdock doctor                # all checks
permdock doctor --json         # report with $schema, for agents
permdock doctor --only imports,references
permdock doctor --fix          # apply safe fixes (install skills, regenerate the catalog)
permdock doctor --ignore PD017:post.delete   # accept one finding for this run
permdock doctor --update-baseline   # accept this run's findings in doctor.baseline
printf %s "$DATABASE_URL" | permdock doctor --db-url-stdin   # also run the checks that query the database (PD085, PD110)
permdock doctor --local                # the same, against the local Supabase stack
permdock doctor --local --stack feature-a   # a named stack of this worktree

--local runs supabase status --output-format json in the project and connects to its DB_URL, so each git worktree finds its own stack without assumed ports. --stack <name> picks a named stack and needs --local. --local and --db-url-stdin exclude each other. doctor, generate, supabase hook generate, every rls command that reads a database and powersync verify take both flags.

Exit code 1 on any error, 0 otherwise; warnings only fail with --fail-on warning or doctor.failOn: "warning". A finding is an error, a warning or an info hint. info never fails the run, renders as ::notice with --format github and as a SARIF note, and the summary counts it as a note.

Without --fix, doctor only reads: it never writes the catalog or any other file. On a terminal, --fix asks before it writes; answering no prints the report without fixing, and cancelling exits 130. In CI, in a pipe or with --json it fixes without asking. The report lists each fix it applied first, as fixed in the JSON report. An --only value that names no check code or group exits 2 with the nearest match.

Accept a finding

Every finding has a target (a permission key, a file:line, a table) and an id of <code>:<target>. The text report prints the id after the fix line, and the JSON report carries both fields. A check that sets no target gets the file:line its message opens with, or the message's first word when it is a path or a key, else project.

doctor.baseline names a JSON file of accepted findings, relative to the project root, in better-supabase's grouped format:

permdock.config.ts
doctor: { baseline: "doctor-baseline.json", failOn: "warning" }
doctor-baseline.json
[
  {
    "code": "PD017",
    "reason": "Only the current owner may transfer, from their own session",
    "targets": ["organization.transferOwnership"]
  }
]
  • Accepted. A finding whose code and target an entry lists leaves findings, no longer counts as an error or warning, and appears under ignored in the JSON report with its reason. A { code, target, reason } entry is read too, so one file serves both libraries.
  • Reason. An entry without a reason is reported as a baseline-reason error.
  • Stale. An entry that matches no finding is reported as a baseline-stale error, so the file shrinks when the cause goes away. An entry is only judged when its check ran: --only and a check that needs --db-url-stdin leave the others alone.
  • Update. permdock doctor --update-baseline rewrites the file to accept this run's errors and warnings. An entry keeps its reason, a new entry takes the reason of another entry with its code, and the rest get an empty reason to fill in. Without doctor.baseline it exits 2.

doctor.failOn: "warning" exits 1 on a warning as well as an error; --fail-on overrides it for one run. --ignore <id> (repeatable) accepts a finding for one run without a reason.

When better-supabase runs permdock doctor --json through its authorization.doctor.command (BS705), its own tooling.doctor.baseline accepts PermDock's findings as BS705 entries whose target starts with the PermDock code. Both files use the same format. doctor.waivers and doctor.ignore were removed in 0.31; permdock codemod 0.31 moves both into the baseline file (codemod).

Where doctor reads source files

The checks over source files (PD001, PD002, PD007 to PD015, PD044 and the others that read code) scan doctor.srcPath, an array of directories or globs relative to the project root. It defaults to collect.srcPath, then ./src. Set it when the catalog should come from one folder and the checks should cover more, such as client components outside the folder that defines the permissions:

permdock.config.ts
export default defineConfig({
  permissions: "./src/permdock/permissions.ts",
  collect: { srcPath: ["./src/permdock"] },
  doctor: { srcPath: ["./src", "./app", "./components"] },
});

PD004 compares the catalog on disk with the one collect would write from collect.srcPath, so a wider doctor.srcPath never reports catalog drift. PD002 and PD003 count the references under doctor.srcPath.

Checks

CodeCheckSeverity
PD001Server-only imports in client entrieserror
PD002Unknown permission referenceserror
PD003Permissions used but never grantedwarning
PD004Stale catalogerror
PD005Missing or outdated Agent Skillswarning
PD006Unsupported TypeScript versionerror
PD007Policy validation mode never with an HTTP, MCP or agent adapter presentwarning
PD008Reserved identifier used for a public exportwarning
PD009Duplicate permdock copies in the dependency treeerror
PD010Roles or tenant read from an unverified or user-editable claimerror
PD011Tenant read from an optional claim under a multi-tenant issuerwarning
PD012OpenAPI document or Overlay pinned to a draft revision the installed CLI does not emitwarning
PD013Polymorphic EdDSA in a JWT algorithms list instead of Ed25519warning
PD014discovery issuer mismatch, plain-HTTP issuer, or jwks without issuererror
PD015Token verification that does not check typ, or accept: 'id-token' on an API routewarning
PD016Opaque RLS grants, or sqlFunction grants with no verify fixtures, under an rls configwarning
PD017An allow on a sensitive verb (approve, pay, settle, submit, transfer, refund, disburse, or doctor.sensitiveActions) has no approval and no deny on the same leafwarning
PD018exclusiveWith names an undeclared role (error), or a doctor.memberships fixture / custom role holds two exclusive roles (warning)error / warning
PD019rls.rbac.authorize is jwt, [auth] jwt_expiry in supabase/config.toml exceeds 3600 seconds, and the policy grants a sensitive verbwarning
PD020A permission the policy marks hostable sits on a resource the rls config compileswarning
PD021The policy lists hostable permissions but PERMDOCK_CLOUD_URL or PERMDOCK_CLOUD_KEY is unsetwarning
PD022A SQL migration creates a view without security_invoker, so it reads past row level securitywarning
PD023A custom role in the doctor.memberships fixture names a permission or include its ceiling dropswarning
PD024An allow sets approval: { mode: "confirm" }, so the requester can approve their own requestwarning
PD025A membership in the doctor.memberships fixture grants nothing under the policy's named scopeswarning
PD026No role on a scope sets min, so every instance of it can lose its last managerwarning
PD027Under an rls config, a grant's where or check reads context.*, which RLS cannot evaluatewarning
PD028supabase.hook.attrs lists user_metadata or another value the hook cannot use (error), or an attrs column or a membership source's deciding column that your migrations let anon or authenticated insert or update (warning)error, warning
PD029An API key in the doctor.credentials fixture never expires or is not a valid v1 credential, or a tenant's settings allow keys without expirywarning
PD030Under an rls config, a read grant limits fields, but the table still returns those columns to a direct readwarning
PD031A resource parents itself but no through: 'parent' grant walks it, or declares restricted but no graph grant reaches its rowswarning
PD032Under an rls config, a graph resource's snake*case name matches a scope or another resource, or is not a SQL name, so rls generate cannot name its permitted*<resource>\_ids helpererror
PD033A role activation has no maxDuration (the elevation never expires on its own), or an activation role is held standing by a doctor.memberships fixturewarning
PD034Under an rls config, a breakGlass grant would be compiled: RLS never compiles a break-glass override, so it reads through the generated permdock_break_glass_<resource> function insteadwarning
PD035A supportAccess role has actorRequired: false, so a support session runs as the tenant, unattributedwarning
PD036A protect(permission) with no row loader on a route whose path names an id (/posts/:id, /posts/{id}, a [id] folder), so the check never sees the row (BOLA)warning
PD037A migration's policy on storage.objects or realtime.messages calls permdock_has or permitted_<scope>_ids with a permission whose grants carry row conditions, which the helpers do not check; the permission-key forms are not flaggederror
PD038Under an rls or supabase.hook config, a subjectFromSupabase or subjectFromSupabaseSession call reads the tenant from a different claim than rls.tenantClaim, the claim the hook writes and the helpers compare withwarning
PD039Under a supabase.hook config, the helper schema has no generated permdock_has, permitted_<scope>_ids or member_<scope>_ids, a supabase.hook.claims entry in the doctor.claims fixture is larger than the memberships budget, or a sample has a memberships entry subjectFromSupabase dropswarning
PD040A SQL migration calls auth.role(), which Supabase deprecatedwarning
PD041An exchangeCapability call signs with alg: 'HS256', the project's shared JWT secretwarning
PD042The token hook is declared under supabase/schemas, and no migration from the one that creates it on grants it to supabase_auth_admin (migra only)error
PD043schema_paths in supabase/config.toml applies a file that calls the SQL helpers before the file that defines them, or leaves that file out (migra only)warning
PD044usePermission reads a permission whose grant the snapshot cannot answer, and there is no app/**/api/permdock/route.ts using permdockHandler and no endpointwarning
PD045The Supabase project config (config.json, config.jsonc or config.toml) does not parse, both JSON files exist, or a value read as env(NAME) names an unset variablewarning
PD046The PermDock helper schema (rls.schema) is listed in [api] schemas, so the Data API serves the security definer helpers as RPCswarning
PD047A SQL migration reads raw_user_meta_data or user_metadata, which a user can set for themselveswarning
PD048A SQL function sets no search_pathwarning
PD049A security definer function whose execute is not revoked from public (and, in the public schema, from anon), or a hook claim function a client role can executewarning
PD050A migration creates a table in public without enabling row level securityerror
PD051A policy calls auth.uid() or auth.jwt() bare instead of (select auth.uid()), so Postgres calls it once per rowwarning
PD052An update policy has using and no with checkwarning
PD053A foreign key column no index starts withwarning
PD054The last role_permissions seeds in the migrations differ from the rows the policy compiles towarning
PD055A custom role in the doctor.memberships fixture stores a permission under a key it was renamed fromwarning
PD056A migration still calls an rls.migrate helper by its legacy namewarning
PD057rls.anonymousSignIns is 'deny', but a subjectFromSupabase or subjectFromSupabaseSession call does not pass anonymousSignIns: 'deny'warning
PD058sync-config.yaml or the powersync.manifest file is missing or differs from what the policy compiles to, or the config does not compile, or a synced scope's membership source has no stream formwarning
PD059The configured policy module throws or exports no policy, so every check that reads the policy is skippederror
PD060A source file under collect.srcPath has a syntax error, so the catalog and the usage report miss what it referenceswarning
PD061rls.suspension.scopes.<scope>.keep or rls.suspension.memberships.keep lets suspended members keep permissions: the kept keys, and any key the definitions do not declarewarning
PD062A migration reads or sets a legacy request.jwt.claim.<name> settingwarning
PD063A migration changes or drops a reserved Supabase role, or grants a reserved membership, which supautils rejectserror
PD064rls.assignments guards a table (a membership table, the global-roles table or a listed table) that no permdock_assignment trigger is created on in the migrations or the rls generate outputwarning
PD065A file that imports permdock/react-native reads a permission whose grant the snapshot cannot answer, so the device denies it offlinewarning
PD066An rls.migrate.tables table that the migrations still create, with what still reads it or a note that rls migrate --retire-out can drop itwarning
PD067An operation in the configured operations module whose permission or results key the permissions module does not declareerror
PD068PermDock writes files for pg-delta under the declarative schema directory, and the Supabase config sets [experimental.pgdelta] enabled = false, so the Supabase CLI diffs them with migraerror
PD069Under pg-delta, [db.migrations] schema_paths is still set, or a numbered NNN_permdock_*.sql part from migra is still therewarning
PD070The policy declares oauthScopes and the catalog on disk lists none or another set, so better-supabase's SQL checks deny a token that holds only a coarse scopewarning
PD071An action verb whose name reads as a write (create…, update…, approve…, markPaid) has no rls.actions entry and no default, so it compiles to 'none'warning
PD072A membership source reads role keys through rls.customRoleWrites.roles, whose tenant rows tenants write, so a tenant row named like a declared role could grant itwarning
PD073A role's for lists kinds that no membership source of its scope can holderror
PD074supabase.hook is set, but supabase/config.toml does not enable [auth.hook.custom_access_token] or names another functionwarning
PD075Two resources that rls.tables maps to one table, so the same rows carry two sets of keys and helpers; a resource declared tableOf is not countedwarning
PD076rls.actions entries set to 'none' on a verb that compiles to 'none' anyway, or entries for a verb no permission usesinfo
PD077A config key or value names a scope, resource or action the policy does not declare, such as a Realtime topic {organisation} placeholder; or two of them give one SQL helper nameerror
PD078better-supabase's blocks.permissions.activeTenant writes the active tenant to another place than supabase.hook.activeFrom reads itwarning
PD079A permission key a configured better-supabase block checks is not in the catalog, a block action key is one better-supabase renamed, or better-supabase/sql has no modulePermissionKeys to list themerror
PD080postgrestSources, memoryVersionCache or claimsFirst is created inside a function body, so no read or instance is sharedwarning
PD081instanceCache is created inside a function body, so no instance is reusedwarning
PD082supabase.hook keeps permdock_authz_version while better-supabase's blocks.sessions.authzVersions keeps a second version tablewarning
PD083postgrestSources is used and the migrations define subject_for but no authz_version_for, so every version read failserror
PD084A synced PowerSync stream reads a token claim, so a role or tenant change needs a session refresh and a reconnectwarning
PD085With --db-url-stdin, custom_access_token_hook raises when supabase_auth_admin calls iterror
PD086A sqlFunction set variant names a column the resource does not declare (error), or passes row-field args the set form drops (warning)error / warning
PD091An operation under openapi.tenantPaths that openapi.operations declares no entry for, or a declared entry that matches no operation of an openapi.doc documenterror
PD092pnpm-lock.yaml lists permdock more than once with different peer sets, so one app can load two copies of its stores and cacheswarning
PD097Fixture seed data is in a migration or schema file, or a defineSeeds default names an unknown role, scope or permission. A missing [db.seed] sql_paths entry is a warning and names the line to adderror / warning
PD098DATABASE_URL or SUPABASE_DB_URL uses port 6543, the transaction pooler, which does not keep the prepared statements the generated helpers run aswarning
PD099A SQL file defines an update policy on a table that has no select policy, so updates match no rowswarning
PD087The hook broadcasts on another topic than better-supabase listens on, or better-supabase is a dependency whose config file is not found
PD088A statement casts to text around a permitted_*_rows or can_<resource> call; the helpers use the resource id typewarning
PD089A statement tests one known id against permitted_*_rows; can_<resource>(id, permission) evaluates that row onlywarning
PD090A hand-written policy calls permdock_actor_may_write() where the generated *_read_only_actors policy already applieswarning
PD093A migration defines own_subject(), which permdock_subject() from the hook migration already is
PD094A better-supabase config sets blocks.memberships.options.roleThrough, blocks.permissions.disabled.<subject> or blocks.invitations.options.platformRoles to the value the provider already supplieserror
PD095A schema file has a do block that creates an object, grant … on all, two definitions of one signature, a trigger on a view, if not exists on create table, create index or create policy, or a drop trigger before a create trigger. Another schema file creates a function or policy a PermDock schema file creates. A -- permdock: migration repeats DDL or a grant a schema file already defineserror
PD096A membership through.on lists a column that deciding columns omit, so the hook join, the stream and the manifest can drop that pairerror
PD100A source file imports definePermDock from permdock/supabase while a better-supabase config exists, so the app keeps two version, instance and subject cacheserror
PD101A schema file defines a permissive policy on a follows child table for a command the generated follows policies already allowwarning
PD102roles: "many" while sync-config.yaml still filters the junction with membership_roles.user_id = auth.user_id(), so a member syncs only their own role rowswarning
PD103A policy calls a PermDock helper once per row: permitted_<resource>_row(row, …), can_<resource>(…) on a column of the row, a set helper passed a column of the row, or a permitted_<resource>_rows('key') whose body has no arm for the keywarning
PD104Two permissive policies cover one command of a table and the app wrote one of themwarning
PD105A follows foreign key, a via column or a walk user column leads no indexwarning
PD106A statement of the app casts a key column to text (id::text = any(…)), which hides the column from its indexwarning
PD107A statement reads a custom-role table and compares tenant_id through a text cast or is not distinct fromwarning
PD108An app policy calls permitted_<resource>_rows(p) with no tenant argument and no tenant-led predicatewarning
PD109rls.customRoles with rls.authorize: "jwt" and no supabase.hook.claims function, so no token carries grantserror
PD110With --db-url-stdin, the access token the hook builds for a sample user is over 4,096 characterswarning
PD111A list endpoint takes an optional limit: an openapi.doc GET on a collection path, or an MCP tool schema with limit: …optional()warning
PD112The snapshot of the role with the most grants is over 65,536 bytes of JSON; the message names the largest partwarning
PD113Source reads the legacy shared JWT secret (SUPABASE_JWT_SECRET, JWT_SECRET) or lists HS256 as the only verification algorithmwarning
PD114rls.authorize: "jwt" with a token hook: the helpers read only the memberships the budget keeps; an error when a sample user's token is truncated, information in database modewarning
PD115The newest migration with the generated helpers carries a different sha-256: digest from the schema file rls generate writeswarning
PD116A module with a file-level 'use server' exports a Server Action that calls no protectAction, requirePermission, getPermission or assert
PD120permdock.config sets a key to the value its command uses when it is unset; permdock codemod config --prune removes it
PD121rls.memberships or rls.suspension disagrees with the membership sources, or restates what they derive
PD122A granted verb has no rls.actions entry and infers no SQL command, so it compiles to none (information)
PD123A better-supabase action checks the key its block derives, which the catalog does not list
PD134No schema file creates a table for a resource without an rls.tables entry, under its verbatim name or its snake_case plural (information)
PD135A pg-delta project writes the role_permissions rows as a data migration; rls.seeds: 'view' keeps them declarative (information)
PD130The project calls permdockFor and builds another instance with getPermDock or createPermDock and its own memberships, customRoles, versions or instances
PD136The project installs a Supabase CLI older than 3.2.0warning
PD137permdock.manifest.json lists a function in rls.sharedFunctions that now reads a row table or the caller, or lists a two-argument helper in rls.permissionFilterserror
PD124With a database URL: a table whose policies call PermDock's helpers belongs to a publication other than Realtime's and powersyncinfo
PD138With a database URL: the hook's budget truncates the memberships of at least one of the first 5,000 users of auth.users
PD125pg-topo finds a cycle, an object two schema files create, or a table rls.tables names that no schema file createswarning
PD126The app lists oxc-parser or pgsql-parser and installs another version than permdock pinsinfo
PD127rls is configured and [db] driver is sqlite or sqlite-postgres (Supabase Lite), where generated policies and helpers do not existwarning
PD128permdock.manifest.json marks a table share: 'tenant' in rls.tableReads, and its select policies in the schema files, migrations or rls.out now make it rowerror
PD131A table has more than doctor.policies.max (default 4) policies for one command and authenticatedwarning
PD132The policy is over a byte budget in budgets; the message names the size, the budget and the largest parterror
PD133A server module passes clientBundle(policy) to a provider's bundle prop, which serialises the bundle into every documentwarning

PD001: server-only imports in client entries

Policy modules, createPermDock from permdock/next and any file that imports from permdock/hono, permdock/mcp or a provider must never be reachable from a client bundle. doctor reads every file under doctor.srcPath (default collect.srcPath), treats a file as a client entry when it carries 'use client', has .client. in its name, or matches doctor.clientEntries, and reports each client entry that imports a server-only entry directly. Frameworks with no client marker (a Vite SPA, an Expo app, a Chrome extension) list their client code in doctor.clientEntries, an array of directories or globs relative to the project root:

permdock.config.ts
export default defineConfig({
  permissions: "./src/permissions.ts",
  doctor: { clientEntries: ["src/**/*.tsx", "app"] },
});

doctor also reports a client entry that imports the module policy names in permdock.config.ts. It resolves each value import, re-export and literal dynamic import() of the client entry from that file, as the bundler would: relative paths with or without an extension, the paths of the nearest tsconfig.json, and package names through node_modules and the package's exports. A monorepo that exposes the policy as @acme/access/permdock/policy from a workspace package is therefore caught in the app that imports it. A type-only import is not reported, because the bundler erases it.

This is the permix issue #49 class of bug (server code leaking into client bundles), caught before the bundler does something surprising. The bundle check in tests/bundle covers what a transitive import would reach.

PD002: unknown permission references

Member accesses rooted at a definition export that do not resolve to a leaf (permissions.post.archive when archive is not an action), and findPermission(permissions, 'literal') calls with a literal that no key matches. These are type errors in TypeScript projects; doctor catches them in JavaScript files, MDX and generated code too.

A member access counts only when its root identifier is bound to a permission tree where it is read: an import of permissions or of any definePermissions export, a default import named permissions, or a definePermissions(...) declaration. A parameter, local variable, catch binding or module variable with the same name shadows it, so function grant(permissions: string[]) { return permissions.length } is not a reference. An identifier no scope declares still matches by name, as in generated code. The same rule decides the references collect and usage record.

PD003: used but ungranted

The same analysis as usage, reported here at warning level so a single doctor run covers it.

PD004: stale catalog

Runs collect --check in memory. A stale permissions.catalog.json is an error because downstream tools (OpenAPI emission, MCP descriptions, the docs) read the file, not the code.

PD005: skills

Checks that the PermDock skills are installed (it looks for the permdock skill) for the agents configured in the repository (.agents/skills, .claude/skills, .cursor/skills) and that their version matches the installed permdock. It looks in the working directory and every directory above it up to the workspace root (the first with pnpm-workspace.yaml, a package.json that declares workspaces, or .git), so skills installed once at a monorepo's root count for a package that runs doctor. The lock is .permdock/skills-lock.json, or a skills-lock.json from the skills CLI that lists the permdock skill. --fix runs permdock skills install. See skills.

PD006: TypeScript version

Reads the resolved typescript version and compares it with the supported matrix (5.9, 6, 7). Warns on 7.0 when a tool that needs the compiler API is detected, because TS 7.0 does not ship a stable one. Also verifies that isolatedDeclarations is not required of the consumer: PermDock enables it for itself, apps do not have to.

PD007: validation mode

validate: 'never' is a documented footgun when untrusted input reaches can(). If the policy sets it and the repository imports an HTTP, MCP, AI SDK or Claude Agent adapter, doctor says so and links to Validation.

PD008: reserved identifiers

Public exports named dock, ability, a can that defines rather than checks, or $-prefixed members in modules that import permdock. Enforces the naming convention in userland code where a skill would otherwise learn the wrong names.

PD009: duplicate copies

Two versions of permdock in node_modules are not a correctness problem for references (identity is by key, permissions) but are for types and bundle size; reported with the two paths.

PD010: roles or tenant from an unverified claim

Reads the claims option of every subjectFromJwt and jwtSubjectResolver call and the field accesses in definePolicy's subject function, and reports a roles or tenant source that is one of: email or anything derived from it (a .split('@') on email is the common form), name, preferred_username, picture, or a bucket the provider documents as user-editable (user_metadata, Clerk unsafeMetadata, Stytch untrusted_metadata, Stack Auth clientMetadata, Ory traits, Cognito custom:* attributes without a write restriction). These are the escalation paths in the threat model: the token is genuine, the claim is not authoritative. The fix names the server-set counterpart for the detected provider (app_metadata, publicMetadata, trusted_metadata, serverMetadata, metadata_admin) or, for roles, points at a database lookup in context (claim trust rules).

PD011: tenant from an optional claim

Fires when claims.tenant names a claim the issuer emits only for some accounts and the issuer is a multi-tenant one: Google's hd under accounts.google.com (absent for consumer accounts), Entra tid under the common or organizations endpoint (personal accounts arrive with the consumers tenant), Okta groups-derived tenants without a filter. A missing tenant yields a subject without one, which tenant-scoped conditions deny, so this is a warning rather than an error; it exists because the usual next step is a default tenant in the resolver, which is the bug. The fix is to compare the claim against onboarded tenants in the resolver, or to restrict the issuer (login.microsoftonline.com/<tenant>/v2.0 instead of common, the hd authorization parameter at Google) so the IdP filters first (single sign-on).

PD012: stale draft pin

Reads x-permdock-catalog.drafts from every OpenAPI document and Overlay permdock openapi emit has written in the repository (found through the openapi section of the config or the paths passed to --doc) and compares each pin with the revision the installed CLI emits (OpenAPI 3.3, watch list). A mismatch means the document carries an older draft shape than a regeneration would produce, which is a warning here and an error in permdock openapi emit --check; the fix is to regenerate. Documents and Overlays without drafts (targets 3.1 and 3.2, Overlay 1.1) are not checked; a --overlay 1.2 Overlay carries drafts.overlay (OpenAPI Overlay).

PD013: polymorphic EdDSA

Reads the algorithms option of every subjectFromJwt, jwtSubjectResolver, joseTokenVerifier and joseTokenSigner call and warns when it lists EdDSA. RFC 9864 registers the fully-specified Ed25519 (and Ed448) and deprecates the polymorphic name because a verifier cannot tell from alg alone which curve it is committing to (JOSE). The runtime accepts EdDSA only for a crv: Ed25519 key, so this is a warning; the fix is to write Ed25519. none or RSA1_5 in the list is an error under the same check, since the runtime refuses them regardless.

PD014: discovery and issuer configuration

Reads the options of PermDock calls only: an object literal passed to a function imported from a permdock entry (joseTokenVerifier, subjectFromJwt, jwtSubjectResolver, an adapter's createPermDock), an object literal nested in one, or a const holding an object literal that such a call names. An object with a jwks key that never reaches a PermDock call, such as another library's environment object, is not checked. Errors when a discovery value is not an https: URL, when discovery and jwks or issuer are both set (the document supplies both and a hand-set issuer that differs is the misconfiguration Discovery section 4.3 exists to catch), or when jwks is configured without issuer. With network access (--online) it fetches the Discovery document once and reports an issuer that does not equal the configured one byte for byte, a missing jwks_uri, or a jwks_uri on a different origin than the issuer, each of which the runtime would treat as discovery-mismatch and resolve every token to anonymous (OpenID Connect).

PD015: token type

Warns when a custom TokenVerifier passed as verifier does not declare typ handling (the conformance runner testTokenVerifier covers the runtime side; this is the static hint), and when accept: 'id-token' appears in a resolver used by an HTTP, MCP or agent adapter rather than a BFF session layer, because an ID token is not an access token and never carries delegation (JWT adapter). It also reports a resolver whose profile: 'fapi2' is paired with algorithms that include RS256, which the profile forbids.

PD016: RLS opaque grants and unverified twins

Warns when permdock.config.ts has an rls block whose policy still contains opaque conditions (they deny in memory; map the helper through rls.functions or rewrite as sqlFunction) or sqlFunction grants with no rls.fixtures.json (or rls.fixtures) so permdock rls verify --db-url-stdin cannot prove the twin. See conditions and rls.

Example report

permdock doctor

  ✖ PD001  app/(marketing)/pricing/page.tsx imports permdock/next
           fix: move the check into a Server Component or import from 'permdock/react'
  ✖ PD004  permissions.catalog.json is stale (post.publish added)
           fix: pnpm exec permdock collect
  ⚠ PD005  skill permdock@0.4.0 installed, 0.1.1 available
           fix: pnpm exec permdock skills install

  2 errors, 1 warning

The Unicode markers are replaced with error / warn under --no-color or when stdout is not a TTY.

PD017: sensitive verbs without approval

Loads the policy and warns on each allow whose action is in the sensitive list and that carries neither approval nor a deny on the same leaf. Override the list with doctor.sensitiveActions in permdock.config.ts. The fix text points at approval: { by }.

To accept one leaf, list its permission key under PD017 in the baseline: { "code": "PD017", "reason": "clerks delete drafts only", "targets": ["post.delete"] }.

PD018: static separation of duty

role(..., { exclusiveWith: ['approver'] }) is data only: evaluation does not change. Doctor errors when a named exclusive role is not declared. When doctor.memberships points at a JSON fixture (customRoles and memberships arrays), doctor warns if a custom role includes two exclusive roles or a membership holds both. Dynamic SoD (two roles not active in one session) is not planned.

PD019: JWT-mode authorize() with long-lived tokens

With rls.rbac.authorize: 'jwt', Postgres reads roles from the access token, so a revoked role keeps working until the token expires. The check reads [auth] jwt_expiry from supabase/config.toml (default 3600) and warns when it exceeds an hour while the policy grants a verb from doctor.sensitiveActions. Fix it with authorize: 'database' or a shorter expiry.

PD020: hostable permissions compiled into RLS

permdock rls compiles the code policy, so a hosted grant on a hostable permission widens the application's answer while Postgres keeps the code answer. With an rls config, the check lists every hostable key whose resource is compiled (every resource, or those in rls.tables when it is set). Fix it by removing the permission from hostable, or by dropping its table from rls.tables and enforcing it in the application (hostable permissions). --only hosted runs this check and PD021.

PD021: hostable permissions without Cloud variables

A policy with hostable permissions expects hosted grants, which need permdock cloud push to publish the catalog and cloud() to fetch the policy document. The check warns when PERMDOCK_CLOUD_URL or PERMDOCK_CLOUD_KEY is missing from the environment doctor runs in, and names the missing variable (cloud).

PD022: views without security_invoker

A Postgres view runs with its owner's rights unless it is created with (security_invoker = true), so a view over an RLS table returns every row to every caller. With an rls config or doctor.migrations, the check reads the .sql files under doctor.migrations (default supabase/migrations, supabase/schemas, migrations, drizzle, prisma/migrations, db/migrations) in name order and warns on each create view that neither sets security_invoker nor gets it from a later alter view ... set (security_invoker = true). Materialized views are skipped: Postgres does not apply RLS to them at read time. The <table>_visible views permdock rls generate --fields views writes are security_invoker and pass; the <table>_visible_fields companion --revoke-columns adds reads as its owner on purpose, and its comment on view ... is 'permdock:field-companion ...' exempts it. --only views runs this check.

PD023: custom-role keys outside the ceiling

When doctor.memberships points at a JSON fixture with a customRoles array, the check runs validateCustomRole on each custom role and warns once per dropped entry: a permission no assignable declared role of the role's scope allows (outside-ceiling), an unknown permission key or include (unknown-permission, unknown-role), a grant carrying a condition (condition-not-allowed), or a level the resource does not declare (unknown-level). Evaluation already drops these, so the warning is about intent: the tenant admin expected the key to stick. Fix it by granting the permission to a declared assignable role, or by removing it from the custom role (custom roles). --only custom-roles runs this check.

PD024: approvals the requester can give

Every approval refuses the request's principal as approver, so a user cannot approve their own request. approval: { mode: "confirm" } lifts that for one grant, which is right when the product wants a user to confirm their own agent's call and wrong everywhere else. The check loads the policy and warns once per allow that sets it, naming the permission and the role, so each opt-out is a visible decision in review. requireDistinctApprover on approvalsHandler overrides every opt-out at runtime (approval security). --only self-approval runs this check.

PD025: memberships the named scopes drop

When doctor.memberships points at a JSON fixture with a memberships array, the check normalises each entry against the policy's named scopes and warns on every entry evaluation would drop: a scope the policy does not declare, a nested membership whose within lacks an ancestor's id, or an entry mixing scope, tenant and on. Such a membership fails closed, so the warning is about a provider mapping or seed that silently grants nothing. --only scopes runs this check.

PD026: scopes nobody has to keep

The check loads the policy and warns once per scope that has roles held on it but where none sets min: every organization can then lose its last owner, and nobody is left who may assign roles there. Set min: 1 on the role that manages the scope (generated RLS then refuses to commit the removal of its last holder), or min: 0 on any of the scope's roles to record that no holder must stay, as for a customer scope whose contacts come and go (ownership). --only ownership runs this check.

PD027: request context in an RLS policy

A condition that reads context.* (where: { region: context.region }) is evaluated by can and compiled by the ORM adapters, which bind the request context. Postgres never sees that context: it is not in the JWT, so permdock rls generate refuses the grant (or skips it under --skip-closures) and the database cannot enforce the rule. With an rls config, the check names each such grant and the refs it reads. Fix it by moving the value into a server-set claim and comparing with principal.claims.<name>, which compiles, or by keeping the check in the application only (subject attributes in RLS). --only context-refs (or --only rls) runs this check.

PD028: attributes and memberships a user could set

The Supabase token hook copies supabase.hook.attrs into the attrs claim, which attribute conditions and RLS read (Supabase token hook). An error names an entry generate refuses: user_metadata or raw_user_meta_data, an auth.users column, a prototype key or a duplicate. A warning names listed columns that the SQL files under doctor.migrations (default supabase/migrations, supabase/schemas, migrations, drizzle, prisma/migrations, db/migrations) grant insert, update or all on to anon, authenticated or public, table-wide or by column, net of later revokes. Fix it by revoking those grants and granting column-level update on non-attribute columns only; the generated migration refuses to install until you do. The same warning covers every tableMembershipSource / junctionMembershipSource source in supabase.hook.memberships (or rls.membershipSources): its user, scope, id, within, role, via and expiry columns decide who holds which membership. The grant model is Postgres's: a column-level revoke leaves a table-level grant in place, so revoke update (user_id) on contacts after grant update on contacts still warns (sources). With a supabase config, a table created in public starts with Supabase's default privileges, which grant anon and authenticated everything, until a migration revokes them on the table or with alter default privileges in schema public revoke ... on tables. insert and update are tracked apart, so revoke update alone still leaves the default insert. --only attrs (or --only supabase) runs this check.

PD029: API keys that never expire

When doctor.credentials points at a JSON fixture { credentials?, settings? } (a sample of the API-key records the application stores, and per-tenant settings in the memorySettingsSource shape), the check warns on every credential without expiresAt, every record parseCredential rejects (it would verify to no subject), and every tenant whose credentials settings set allowNoExpiry. A key that never expires stays live after it leaks until someone revokes it, so each opt-in should be deliberate (API keys). --only credentials runs this check.

PD030: field-limited columns the database still returns

fields on a read grant redact in the application (pick), but a row policy returns every column of the rows it admits. With an rls config, the check lists, per resource, the columns a read allow's fields leave out or a read deny's fields name (the row key excepted). Without rls.fields ('views' or 'mask') it warns that RLS is row-level and any direct read of the table returns them; with field views but without rls.revokeColumns: true it warns that <table>_visible masks them while the table still returns them. Fix it with permdock rls generate --fields views --revoke-columns so clients read the columns only through the view, or keep reads of the table server-side and redact with pick (field security). --only fields runs this check.

PD031: graph declarations that do nothing

A self-parent is what makes a chain, and restricted is what stops one, but only a relation(..., { through: 'parent' }) grant reads either. The check names each self-parented resource no such grant walks (its ancestors grant nothing, and rls generate keeps no closure for it) and each restricted column on a resource no graph grant reaches. Grant through the chain, or remove the declaration (relationships). --only graph runs PD031 and PD032.

PD032: graph resources RLS cannot name

With an rls config, every resource a graph grant reads gets a permitted_<resource>_ids helper, named in snake*case: chatThread becomes permitted_chat_thread_ids, and its links and closure objects follow (permdock_link_chat_thread*<link>, permdock_closure_chat_thread). A resource whose snake_case name matches a scope (a teamresource for sub-teams next to theteam scope) would replace the scope helper of the same name and signature, two resources with one snake_case name (chatThreadandchat_thread) would share a helper, and a name with a hyphen is not a SQL name, so rls generate refuses all three; the check reports them before it runs. Rename the resource.

PD033: activation without a ceiling, or held standing

A role activation with no maxDuration mints an elevation that never expires on its own, so it leans entirely on a revocation the app might forget; set a maxDuration. The check also reads the doctor.memberships fixture and names any activation role a membership holds under roles rather than eligible: an activation role is eligible-only and must never be held directly (elevated access). --only activation runs PD033.

PD034: break-glass under an RLS config

A breakGlass grant is the one deny override, and it is non-portable on purpose: RLS never compiles it. Under an rls config the check names each break-glass permission so it is clear the database side reads through the generated permdock_break_glass_<resource> security definer function (which checks a signed break-glass session and writes an audit row), never a policy, so plain RLS keeps denying the restricted rows (elevated access). --only break-glass runs PD034.

PD035: support access without an actor

supportAccess is impersonation: a vendor acts inside a tenant. With actorRequired: false the session runs as the tenant with no act, so the audit log cannot tell the vendor apart from the customer. The check names each support role that omits it; set actorRequired: true (elevated access). --only support runs PD035.

PD036: id route without a row loader

Broken object level authorization (BOLA, OWASP API1) is a route that takes an object id and checks only that the caller holds the permission, so anyone who may update one post may update every post. protect(permission, loader) loads the row and decides against it; protect(permission) alone decides a collection-level question. The check reads each protect( call with a single argument and warns when the file sits under a dynamic route segment (app/posts/[id]/route.ts) or when a route literal with a parameter ('/posts/:id', '/posts/{id}') appears earlier in the same statement. It is a source scan, not a type check: a route that loads the row some other way and calls assert in the handler also passes, and can ignore the warning. --only bola runs PD036.

PD037: helper calls for row-conditioned permissions

The SQL helpers answer one question, whether the subject holds a role with the grant key in a scope; the row conditions of a grant stay in PermDock's own table policies (RLS). A Storage or Realtime policy written outside PermDock, such as a better-supabase bucket or topic access policy, that calls a helper for a permission with a where, check, closure, field list, purpose, break-glass override, validFrom / validUntil window, or a relation, plan, actor or assurance grantee would therefore grant more than the application does. The check reads create policy statements on storage.objects and realtime.messages from the migration directories (doctor.migrations) and errors on each grant-key helper call (permdock_has, permitted_<scope>_ids) whose key has rowConditions: true in the catalog. permdock_has_permission('<key>') and permitted_<scope>_ids_by_permission('<key>') count only the allows without a row condition, minus any deny, so they never grant more than the application does and are not flagged; permitted_<scope>_ids_by_permission('<key>', true) adds the conditioned allows and is. That is the fix for a permission that also has a relationship grant, such as a chat thread shared with one user: the topic policy calls the permission-key form and admits the members whose role reaches the thread's organization, while the share stays in the table policies. permdock rls verify --db-url-stdin runs the same check against pg_policies. --only supabase or --only row-conditions runs PD037.

PD038: tenant claim mismatch

The hook writes the active tenant to rls.tenantClaim (default supabaseTenantClaim, tenant_id), and the generated helpers compare against it; subjectFromSupabase and subjectFromSupabaseSession read it from their tenant option, with the same default. When the two differ, the subject has no active tenant while RLS still scopes rows to one, so can() and the database disagree. The check finds each call in the source scan and compares its tenant option, or the default when the call passes none, with rls.tenantClaim. A call whose options are a variable is skipped. --only supabase or --only tenant runs PD038.

PD039: Supabase hook setup

The hook writes claims that only the generated SQL helpers read. The check lists the helpers the policy's scopes need (permdock_has, permitted_<scope>_ids and member_<scope>_ids in rls.schema, plus member_<scope>_ids_for for each scope with a membership source) and warns on each one no SQL file defines: rls.out (else rls.sql; with a {part} placeholder, its helpers part), pg-delta's <schema>/helpers.sql when rls.out has no {part}, the SQL files in the hook file's folder, and the doctor.migrations folders, never the hook's own file. A project that writes the helpers with rls generate --split therefore passes when rls.out holds the same {part} path the command uses, under pg-delta's per-schema layout, or when the helpers part sits next to the hook. The hook's own file is the split hook part when rls.split lists hook, or when that part carries the hook marker. permdock supabase hook generate prints the same warning, and with --db-url-stdin looks in the database instead. When doctor.claims points at a JSON array of sample decoded tokens, the check also measures each supabase.hook.claims entry and warns when its largest sample is more bytes of JSON than the memberships budget: those claims sit outside the budget but still travel in the session cookie. It also lists each sample's memberships entries that subjectFromSupabase cannot read (the membership-dropped cause at runtime). --only supabase or --only helpers runs PD039.

PD040: auth.role() in a migration

Supabase deprecated auth.role(). The role a request runs under is already the Postgres role (anon or authenticated), so a policy names it with to authenticated instead of testing auth.role() = 'authenticated' in using. The check scans the doctor.migrations folders, skipping comments, and names each call by file and line. --only auth-role runs it.

PD041: HS256 capability tokens

exchangeCapability can sign with the project's legacy JWT secret (alg: 'HS256', key: { secret }). Whoever holds that secret can mint a token for any user, not just a link. The check warns on each call whose options are a literal with alg: 'HS256'; sign with ES256 and the private JWK of an asymmetric Supabase signing key instead. --only capabilities runs it. Token lifetime, refresh-token reuse and HS256 on the local stack are better-supabase's checks; PermDock keeps PD019 because it is about how stale the authorization claims may be.

PD042: hook grants missing from the migrations

supabase db diff writes migrations from supabase/schemas but drops function privileges, so a hook declared there lands without its supabase_auth_admin execute grant and its revoke: the auth server cannot call it, and Postgres's default execute for public lets clients call it. The check runs when a file under supabase/schemas starts with the hook marker. It finds the first migration under supabase/migrations that creates custom_access_token_hook and the last that drops it, and errors unless that migration or a later one grants execute on the hook to supabase_auth_admin. create or replace function keeps the grants, so later migrations that only change the body pass. Move to pg-delta, whose declarative sync keeps the grants (move from migra to pg-delta), or generate the grants file with --grants-out (migra). The check runs only when the schema workflow is migra. --only declarative (or --only supabase) runs PD042.

PD043: helpers applied after their callers

db diff applies schema files in the order of the schema_paths globs in supabase/config.toml (default ./schemas/**/*.sql), sorted within each glob, so a policy that calls permdock_has, permitted_<scope>_ids or member_<scope>_ids before the file that defines permdock_has fails to apply. The check warns on each such file, and once when schema_paths leaves out the file that defines the helpers. pg-delta orders statements by their dependencies, so the check runs only when the schema workflow is migra. --only declarative (or --only supabase) runs PD043.

PD044: server-only grants with no endpoint

A snapshot carries portable conditions, so usePermission answers a where on the client. A grant it cannot carry (a closure, a graph relation through parent or links, a relation with a period) is portable: false, and the hook asks the decision endpoint. The check loads the policy, lists the permissions with such an allow, and warns once per usePermission call on one of them in the source scan when no app/**/api/permdock/route.ts mentions permdockHandler and no source file passes an endpoint string. Without either, the client always answers denied with reason server-only. Fix it by adding the route, passing endpoint to createPermDock or the provider, or moving the check to the server with getPermission. A portable row condition never warns: the browser evaluates it from the snapshot. --only next or --only endpoint runs PD044.

PD045: unparseable Supabase config

PD019 reads [auth] jwt_expiry, PD043 reads [db.migrations] schema_paths, and the schema workflow reads [experimental.pgdelta] from the Supabase project config. PermDock reads supabase/config.json, config.jsonc or config.toml, in the Supabase CLI's order, so a project that ran supabase config convert keeps its settings. A project with both config.json and config.jsonc is a finding: the CLI refuses to start. A value written as env(NAME) is read from the environment, and an unset NAME is a finding that names the key, which then reads as unset. Every fix text that prints a config block prints it in the format the project uses. When the file does not parse, they fall back to Supabase's defaults (3600 seconds, ./schemas/**/*.sql and no pgdelta block, so rls generate writes for pg-delta), PD068 stays silent, and PD045 names the first parse error so a finding is never based on a misread file. Run supabase config validate to see the CLI's own reading. --only supabase runs PD045.

PD046: helper schema exposed through the Data API

permdock rls writes its helpers, role_permissions, user_roles, authorize and the token hook into rls.schema, permdock by default, so the Data API never serves them. The security definer helpers answer for any user id they are given, so listing that schema in [api] schemas in supabase/config.toml turns each into an RPC that reports another user's memberships. The check runs when supabase/config.toml exists and warns when [api] schemas (default public, graphql_public) names the helper schema. Remove it from the list. --only sql (or --only supabase) runs PD046 to PD053, PD062 and PD063.

PD047: user metadata in SQL

raw_user_meta_data in auth.users and the user_metadata claim are written by the user through supabase.auth.updateUser, so a policy or function that decides on them lets the user decide. The check names each read in the migration folders by file and line. Read raw_app_meta_data / app_metadata, which only the service role writes, or a table the user cannot write.

PD048: functions without search_path

A function resolves unqualified names through the caller's search_path, so a caller can create an object that shadows one the function reads; for a security definer function that runs with the owner's rights. The check names each create function that neither sets search_path nor gets it from a later alter function ... set search_path, skipping language c and internal. Add set search_path = '' and qualify every name. Every function permdock rls writes sets it.

PD049: security definer functions clients can call

Postgres grants execute on every new function to public, and Supabase also grants it to anon in the public schema. The check names each security definer function, trigger functions excepted, that no later revoke execute (on the function, on all functions in its schema, or through alter default privileges) takes from public and, in public, from anon. Revoke both and grant execute to authenticated only where a client must call it, as the generated authorize does.

A function named in supabase.hook.claims or supabase.hook.before is a hook claim function: it returns the claims of any user id or event it is given, so the check names it, security definer or not, until public, anon and authenticated are all revoked. Regenerate the hook with permdock rls generate, which writes revoke all on function <fn>(uuid) from public, anon, authenticated (jsonb for a before function) before the supabase_auth_admin grant (Supabase hook).

PD050: tables without row level security

Supabase's Data API serves every table in an exposed schema, and the default privileges let anon and authenticated read and write it, so a public table without row level security is open to anyone with the anon key. The check names each create table in public that no alter table ... enable row level security in the migrations follows and no later drop table removes. It is an error: there is no safe reading of an open table.

PD051: per-row auth.uid() in a policy

auth.uid() and auth.jwt() are functions, and a bare call in using or with check runs once for each row the query reads. Wrapped as (select auth.uid()), Postgres evaluates it once per statement as an init plan. The check names each policy with a bare call. The policies permdock rls writes already wrap them.

PD052: update policies without with check

Postgres checks the new row of an update against with check, falling back to using when there is none. The fallback is right only when the two conditions should be the same; a policy that lets a user update their own rows usually also needs to stop them moving a row to another tenant or owner. The check names each create policy ... for update without with check so the choice is explicit.

PD053: foreign keys without an index

Postgres indexes the referenced key but not the referencing column. A policy that joins on that column, and every delete or key update of the referenced row, then scans the table. The check reads references in create table and alter table ... add constraint, and names each foreign key column that no create index, primary key or unique constraint starts with. Add an index whose first column is the foreign key.

PD054: stale role_permissions seeds

The helpers answer from role_permissions, so a policy change reaches the database only when a migration seeds the new rows. With --split ...,seeds those rows are a versioned migration of their own, and a policy change without a new one leaves the helpers on the old grants. With an rls or supabase config, the check finds the last statement in the migration folders that seeds role_permissions in rls.schema (or clears it), compiles the policy's rows from the same rls settings rls generate reads (levels, custom roles, row helpers), and names how many are missing and how many are stale, with examples. The seeds may be inserts, the body of <schema>.seed() (rls.seeds: 'function') or the values of the role_permissions view (rls.seeds: 'view'). With rls.staticGrants: 'ref' the view reads the policy bundle instead, so the check compares the bundle hash the view pins with the hash the policy compiles to; permdock policy bundle --check covers the loaded bundle itself. Run permdock rls generate and apply the new seeds; with declarative schemas, --seeds-out supabase/migrations/ writes them as a new migration. --only seeds (or --only supabase) runs PD054.

PD055: custom roles stored under a former key

A key renamed with definePermissions(..., { renamed }) keeps resolving in stored custom roles, so nothing breaks the day it is renamed. Removing the alias does break them, and permdock diff reports that as alias-removed. The check runs validateCustomRole over the doctor.memberships fixture and prints, for each stored former key, the update that rewrites it in custom_role_permissions. Apply it, or the same rewrite in your own role storage, before removing the alias. --only renamed (or --only custom-roles) runs PD055.

PD056: callers of a legacy helper

With rls.migrate.helpers set, the check counts calls to each legacy helper name in the migration folders, leaving out the statements that create, grant or drop the helper itself. A remaining call keeps the legacy function, or its shim, in use. Run permdock rls migrate for the policies, rewrite function bodies, views and triggers onto the PermDock helpers by hand, then drop the function. --only shims (or --only sql) runs PD056.

PD057: anonymous sign-ins mapped as users

With rls.anonymousSignIns: 'deny', the generated policies refuse a signInAnonymously() token, but subjectFromSupabase maps it as a signed-in user unless it gets the same option, so the server and the database disagree. The check names each subjectFromSupabase or subjectFromSupabaseSession call whose options object does not set anonymousSignIns: 'deny'; options passed as a variable are not read. --only anonymous (or --only supabase) runs PD057.

PD058: stale Sync Streams

With powersync in the config, the check compiles the policy to Sync Streams and compares the result with powersync.out (default sync-config.yaml). A missing or different file means the PowerSync service syncs by an older policy: a revoked grant still syncs rows to devices. With powersync.manifest set, the manifest file is compared as JSON with localSnapshotManifest(policy): a stale one makes the device build snapshots by an older policy. A config that does not compile to Sync Streams is a finding with the compiler's message. A membership source of a synced scope that has no stream form is a finding that names its table and why: it has expiresAt, or it was not built with the two helpers: build it with tableMembershipSource or junctionMembershipSource without expiresAt, or serve its members from the server. Run permdock generate --only powersync and deploy the files. permdock powersync verify --db-url-stdin also reports PD058 for a synced table outside public that the powersync publication leaves out. --only powersync runs PD058.

PD059: policy module did not load

Doctor loads the policy module once and every policy check reads that load. When the module throws, or exports no policy from definePolicy, those checks have nothing to read; without PD059 the report would be clean for the wrong reason. The finding names the path and the error. --only project runs PD059 and PD060 alone.

PD060: unparsable source file

collect, usage and doctor scan every file under collect.srcPath with oxc-parser. A file with a syntax error is scanned only as far as it parses, so a permission it references can be missing from the catalog. The finding names the file, the line and the parser's message.

PD061: permissions a suspended scope keeps

rls.suspension.scopes.<scope>.keep names permissions that members of a suspended instance, and of every instance nested in it, still hold, so a suspended organization can still restore itself or cancel its scheduled deletion (suspension). The check warns once per scope with the kept keys, so each one is a visible decision in review, and once more for a key the definitions do not declare (a former key from renamed is named with its current key): such a key never matches a check, so the suspended scope keeps nothing for it. rls.suspension.memberships.keep gets the same two warnings for what a suspended membership still holds (suspended memberships). Keep permission references rather than keys to have the type checker catch a rename. --only suspension (or --only rls) runs PD061.

PD062: legacy JWT claim settings

PostgREST 12 sets the verified claims as one JSON setting, request.jwt.claims; the per-claim request.jwt.claim.<name> settings are gone. withPostgresClient from @supabase/server, PermDock's withSubject and permdock rls verify set only request.jwt.claims too, so a policy or function that reads request.jwt.claim.sub gets null and denies. A test or job that sets it impersonates nobody. The check names each statement in the migration folders that uses a legacy setting; a function replaced by a later migration counts only by its last definition. Read the subject with (select permdock.permdock_user_id()) or (select auth.uid()), read another claim with (select auth.jwt()) ->> '<name>', and set request.jwt.claims in tests. --only sql (or --only supabase) runs PD062.

PD063: statements supautils rejects

Supabase runs the supautils extension, which refuses some role statements to postgres, the role that runs migrations, so supabase db push stops on them. The check reports each such statement in the migration folders as an error:

  • alter role or alter user on a reserved role: anon, authenticated, service_role, authenticator, dashboard_user, pgbouncer and the supabase_* roles. alter role … set and alter role … reset on anon, authenticated, service_role and authenticator are allowed.
  • drop role on a reserved role.
  • A grant of a reserved membership, through grant … to or create role … in role: authenticator, dashboard_user, pgbouncer, the supabase_* admin roles and pg_read_server_files, pg_write_server_files and pg_execute_server_program.

The lists are those of supabase/postgres 17.11.0.002 (supautils 3.4.4), and are unchanged in 17.11.0.006 and on the PostgreSQL 17.11 native stack that Supabase CLI 3.4.0 runs. Grant your own role to authenticator instead: grant app_reader to authenticator is allowed. permdock rls generate refuses to write a rejected statement. --only sql (or --only supabase) runs PD063.

PD064: assignment trigger missing

With rls.assignments and a role that declares assigns, every membership table rls.memberships maps, the global-roles table (rls.roles, else supabase.hook.roles) and every table in rls.assignments.tables should carry the permdock_assignment trigger permdock rls generate writes (assignment triggers). The check reads the .sql files under doctor.migrations and the rls.out file (its helpers and policies parts with {part}) and warns once per guarded table no create trigger "permdock_assignment" ... on <table> names: until a migration applies it, a client that may write the table may write any role there, its own included. Run permdock rls generate and apply its output, or point rls.out or doctor.migrations at where the output lives. --only assignments (or --only rls) runs PD064.

PD065: server-only grants in React Native code

A React Native app answers portable grants from the persisted snapshot, offline included. A grant the snapshot cannot carry (a closure, a graph relation through parent or links, a relation with a period) goes to the decision endpoint, so without a connection the hook answers denied with reason server-only. The check loads the policy, lists the permissions with such an allow, and warns once per usePermission call or permission reference on one of them in a source file that imports permdock/react-native, whether or not an endpoint is configured. Fix it by expressing the grant with a portable condition when the screen must work offline, or by showing the offline state for that check (React Native offline behaviour). --only react-native (or --only endpoint) runs PD065.

PD066: a materialised table still created

With rls.migrate.tables set, the check replays the migration folders the way rls migrate does and warns once per listed table that a migration still creates and none drops. While a policy on another table, a view or a function still reads it, the message counts the readers and names the first with its file and line; rewrite them onto the PermDock helpers. With no reader left, the message says so: run permdock rls migrate --retire-out and apply the migration it writes. --only shims (or --only sql) runs PD066.

PD067: an operation bound to an undeclared permission

With operations set in permdock.config.ts, the check reads the operations the catalog would carry and reports each operation whose permission or results key is not a permission of the configured permissions module. defineOperations already throws for a permission outside the tree it is given, so this fires when the operations module builds on another tree than the one the config names, such as a stale copy or a merged tree.

PD070: oauthScopes missing from the catalog

authorizationProvider in permdock/better-supabase builds better-supabase's delegation.scopes from the catalog, so a coarse scope the policy declares in oauthScopes reaches member_can and the other SQL checks only through permissions.catalog.json. The check loads the policy and, when it declares oauthScopes, warns when the catalog on disk lists none (a catalog written before PermDock carried them) or lists another set. Until then a token whose scope holds only mcp:read is denied in SQL while TypeScript grants it. Run permdock collect (better-supabase). --only catalog (or --only better-supabase) runs PD070.

PD071: write verbs without an rls.actions entry

A verb with no rls.actions entry and no default compiles to 'none': no SQL policy, and its grants are still seeded for permdock_has (action verbs). That default never adds a write, but a verb that writes rows through the API role then has no policy that lets the write through. The check lists each unmapped verb that starts with create, update, delete, remove, send, mark, cancel, approve, receive, fulfill, reimburse, withdraw, writeOff, confirm or pause, followed by the end of the name, a capital, a digit, _ or -, with the permissions that use it. Map each one on purpose, to a command or to 'none'. --only rls runs PD071.

PD072: tenant-written role rows read through a source

A membership source whose role column is a through reference to rls.customRoleWrites.roles reads keys from a table tenants write. A tenant row named owner would then grant the declared owner role. The helpers rls generate writes read such a row as no role, and the permdock_custom_role_name_guard trigger on the roles table refuses it (declared-role, name-taken); a row with no tenant (a global or shared role) is not affected. The check reports each source that reads through the table, unless a file under supabase/schemas, the migration folders (doctor.migrations) or rls.out creates the permdock_custom_role_name_guard trigger, so a hand-written helper or a config that predates the guard is regenerated (custom role writes). --only rls runs PD072.

PD073: role for that no source can hold

A role declared with for: ['employee'] can only be held through a membership whose kind is in that list, and a membership gets its kind from the via of its source. When no source of the role's scope has a via that matches, nobody can hold the role, and the check reports it as an error, naming the role, its for list and the kinds the sources hold. Set via on the source, or change for (ownership). --only rls and --only ownership run PD073.

PD074: custom access token hook missing from config.toml

supabase.hook generates custom_access_token_hook, but Auth calls it only when supabase/config.toml has [auth.hook.custom_access_token] with enabled = true and uri = "pg-functions://postgres/<schema>/custom_access_token_hook". Without it a local stack and every Supabase branch push issue tokens with no memberships, and tenant-scoped checks deny. The check warns on a missing table, enabled not true and a uri for another function, and stays silent without a config.toml. The fix prints the stanza; hosted rollout covers a hosted project.

PD075: two resources on one table

Two resources that rls.tables maps to the same table give the same rows two sets of permission keys (file.read and fileNode.read), two row helpers and two catalog entries, and a check of the wrong key denies or grants a different set of rows. One resource can carry both the organisation-wide role grant (a memberOf relation) and the per-row relation grants, so the check names both resources and the table and points to merging resources, where permdock keys rename <from> <to> retires each key (keys). A via entry counts through its table. When two resources share a table on purpose, declare the second one with tableOf; the owner resource writes the table's policies and the check skips the declared resource:

permdock.config.ts
export default defineConfig({
  rls: {
    tables: { document: "public.documents", draft: { tableOf: "document" } },
  },
});

--only rls runs PD075.

PD076: rls.actions entries that change nothing

An rls.actions entry set to 'none' changes nothing when the verb is not one of the six default verbs and does not read as a write: generate already compiles it to no policy. An entry for a verb no permission uses changes nothing either, and is often a misspelling. PD076 lists both kinds in one hint each, with the entries to delete:

info PD076  rls.actions sets export, market to 'none', which is already what those verbs compile to
            fix: delete these entries: export, market

A 'none' entry on a verb that reads as a write (approve, markPaid) stays, because it is how you tell PD071 the verb is mapped on purpose. A 'none' entry on a default verb (read, update) stays too, because it changes what that verb compiles to. PD076 is info, so --fail-on warning does not fail on it. --only rls runs PD076.

PD077: config names the policy does not declare

The keys of rls.tables, rls.scopeTypes, rls.actions, rls.memberships.scopes and rls.suspension.scopes, the {placeholder} of each rls.realtime.topics key, each rls.storage.buckets.<b>.scope, and powersync.resources and powersync.action must name a resource, scope or action the policy declares. A misspelt name maps nothing, or fails later in rls generate, so PD077 reports each one with the declared names:

error PD077  rls.realtime.topics['org:{organisation}:quotes'] names the scope 'organisation', which the policy does not declare
             fix: use one of organization, team, tenant, or pass the policy value to defineConfig to catch this at compile time

Typed config reports the same names when the config compiles.

PD077 also reports a SQL helper name rls generate cannot write: a scope and a resource that both give permitted_<name>_ids (scope project beside a graph resource project), or a name longer than the 63 bytes Postgres keeps, which Postgres would truncate into another helper's name. rls generate and supabase inspect refuse the same config with config_invalid. --only rls and --only scopes run PD077.

PD078: active tenant read from another place

better-supabase's switch_organization writes the active tenant where blocks.permissions.activeTenant says: app_metadata.<auth.tenant.claim> for "claim", or the profile column for { profileColumn, key? }. PermDock's token hook reads it from supabase.hook.activeFrom, by default app_metadata.<claim>, where the claim is better-supabase's auth.tenant.claim (or claims.tenant in a flat config), then rls.tenantClaim, then tenant_id when a better-supabase.config.* exports an object or throws while loading; plain Supabase keeps app_metadata.active_<first scope>. When the two differ, switching organizations never changes the tenant claim. The check loads better-supabase.config.ts and reports the activeFrom to set:

warning PD078  blocks.permissions.activeTenant is "claim", so better-supabase's switch_organization writes app_metadata.tenant_id, but PermDock's token hook reads the active tenant from app_metadata.custom. Set supabase.hook.activeFrom: "app_metadata.tenant_id" and run permdock supabase hook generate, or set supabase.hook.activeTenant: "request" when the request resolves the tenant.

When the app resolves the tenant per request, declare it once in permdock.config.ts:

permdock.config.ts
supabase: { hook: { activeTenant: "request" } },

PD078 then reports nothing, and the manifest's hook.activeTenant makes authorizationProvider state tokenHook.activeOrganizationFrom: "resolver", which better-supabase's BS409 accepts without a blocks.permissions.activeTenant entry. "resolver", better-supabase's default, takes the tenant from the request, so PD078 reports nothing for it either. authorizationProvider({ activeTenant }) reports the same mismatch in problems (better-supabase). --only supabase (or --only better-supabase) runs PD078.

PD079: block permission keys missing from the catalog

Each better-supabase block checks permission keys through the provider: its defaults (audit.read, audit.revert, teams.read, notifications.send, …) or the keys blocks.<block>.permissions maps them to. A key the catalog does not list has no role that holds it, so the block's SQL check denies it for everyone. The check loads better-supabase.config.ts, asks the project's better-supabase/sql for every key the configured blocks check, and reports each one missing from permissions.catalog.json with the block actions that use it:

error PD079  notifications.send (blocks.notifications.permissions.send) is not in permissions.catalog.json, so no role holds it and better-supabase's SQL check denies it

Declare the key in the policy and run permdock collect, or map the block action to a key the catalog lists. PD079 is also an error when better-supabase/sql does not export modulePermissionKeys: the keys cannot be listed, and an unchecked key is a block that denies. A block action key that better-supabase 0.58 renamed (view is read, viewAll is readAll, viewSensitive is readSensitive, edit is write, admin is manage) is a separate PD079 error, because better-supabase refuses the config with former_permission_key before it lists a key:

error PD079  blocks.audit.permissions.view is a former block action key: better-supabase renamed it to read and refuses the config

Run better-supabase codemod naming to rename it. defineBlocksConfig<typeof policy>() from permdock/better-supabase rejects an unknown key at compile time. --only catalog (or --only better-supabase) runs PD079.

PD080 and PD081: sources and caches created per call

postgrestSources, memoryVersionCache, claimsFirst and instanceCache keep nothing worth having until a second call reuses them. Created inside a function, every request gets a fresh one: no version read is shared and no instance is reused. The check reads each call to one of them imported from permdock (named or through a namespace) and warns when it sits in a function, arrow function or method:

warning PD081  src/lib/access.ts:7 creates instanceCache() inside a function, so every call gets an empty cache and no instance is reused

A claimsFirst created per call costs more than its own reads: the instance cache compares sources by identity, so each new wrapper is a new owner and no instance is reused:

warning PD080  src/lib/access.ts:6 creates claimsFirst() inside a function, so every call passes a new memberships source, which the instance cache compares by identity, and no instance is reused

Move the call to module scope and pass the same object to every adapter; with better-supabase, spread permdockFor(...).sources(versions) (One instance per version). These build the object once and pass: cache ??= instanceCache(), cache ||= instanceCache(), if (!cache) cache = instanceCache(), and a call passed to a function named in doctor.cacheHelpers, as in once(() => instanceCache()). PD080 covers the sources, claimsFirst and the version cache, PD081 the instance cache. --only caching runs both.

PD082: two authorization version tables

better-supabase's blocks.sessions.authzVersions writes better_supabase.user_authz_versions with its own bump trigger, while PermDock's hook keeps permdock_authz_version and writes authz_ver from it. The two tables bump on different triggers, and only PermDock's reaches the claim:

warning PD082  supabase.hook keeps permdock_authz_version and better-supabase's blocks.sessions.authzVersions keeps user_authz_versions: two version tables bump on different triggers, and only PermDock's reaches the authz_ver claim

Turn blocks.sessions.authzVersions off. PermDock's trigger broadcasts each bump as { user_id, version } with event changed on better_supabase:authz and authz:<uid>, the topics better-supabase's subscribeAuthzVersions and SessionProvider read (supabase hook). --only supabase (or --only better-supabase) runs PD082.

PD083: a hook file without authz_version_for

postgrestSources(client).memberships.version calls only authz_version_for(p_user). A hook file from before that function existed defines subject_for alone, so every version read throws and every claimsFirst check denies:

error PD083  src/lib/permdock.ts uses postgrestSources and supabase/migrations/0001_hook.sql defines subject_for but no authz_version_for, so every version read fails and claimsFirst denies

Run permdock supabase hook generate, with supabase.hook.api for the PostgREST wrappers, and apply the migration it writes (PostgREST sources). --only supabase runs PD083.

PD084: PowerSync stream reads a token claim

PowerSync keeps the claims a connection started with. A stream whose query reads auth.parameter(...), from a grant condition on principal.claims.<name>, keeps syncing by the old claims after a role or tenant change until the app refreshes the Supabase session and reconnects:

warning PD084  stream job reads token claims region, team_ids: PowerSync keeps the claims it connected with, so refresh the session and reconnect after a role or tenant change (/docs/adapters/react-native#role-and-tenant-changes)

Pass nativeRefresh to refreshOn: on each authz:<uid> message it refreshes the session, reconnects PowerSync and refreshes the snapshot. The doctor is quiet when a file under doctor.srcPath calls nativeRefresh(, or when the sources call authzChangeRefresh( and .refreshSession(, the shape of an app bridge that already owns the authz:<uid> channel and the PowerSync reconnect. permdock generate --only powersync and permdock powersync verify print the same line, and the generated file names the streams in its header. --only powersync (or --only react-native) runs PD084.

PD085: the token hook fails as supabase_auth_admin

GoTrue calls custom_access_token_hook as supabase_auth_admin at every sign-in and refresh, and a hook that raises blocks the sign-in. With --db-url-stdin, PD085 runs the hook the same way: begin, set local role supabase_auth_admin, select <schema>.custom_access_token_hook($1::jsonb), rollback. It runs once for a user with no rows, and once per doctor.claims sample that has a sub. Each Postgres error is an error finding:

error PD085  permdock.custom_access_token_hook fails as supabase_auth_admin for a user with no rows (permission denied for table memberships), so that sign-in gets no token

The common cause is a migration that left out the grants and read policies the invoker hook needs on a table it reads. Apply the hook migration in full, or set supabase.hook.security: "definer" so the hook reads with its owner's rights (Supabase token hook). Without --db-url-stdin, PD085 runs nothing. --only supabase (or --only hook) runs PD085.

printf %s "$DATABASE_URL" | permdock doctor --only PD085 --db-url-stdin

PD086: a sqlFunction set variant names a missing column or drops row args

A sqlFunction with set calls the set-returning helper once per statement as "column" in (select name(args without row fields)). PD086 checks every set variant under an rls config:

error PD086  post.read (role member): sqlFunction job_permitted set compares post.nope, which the resource does not declare
warning PD086  post.read (role member): sqlFunction job_permitted set passes row fields (id), which the set form drops: the function is called once per statement

The error means the generated policy would name a column the table does not have, or that the resource schema does not expose; fix set.column or add the column to the schema. The warning means the function will not receive the row fields: pass only the function's own arguments, or drop set to call the helper per row. When the resource has no JSON Schema, PD086 skips the column check but still warns about dropped row-field args. --only rls runs PD086.

PD091: a tenant operation has no permission

A route that operationPermissions does not list is denied by the HTTP gate. PD091 compares the openapi.operations declaration with each openapi.doc document, with the function testOperationCoverage runs:

error PD091  openapi.json: POST /api/orgs/{orgId}/posts is under a tenant path and has no entry in src/operations.ts#operations, so the gate denies it
error PD091  openapi.json: src/operations.ts#operations declares GET /orgs/{org}/old, which the document does not contain

Set openapi.operations to "<module>#<export>", openapi.tenantPaths to the path templates that act on a tenant (["/orgs/{orgId}"], a {param} matching any name) and openapi.base to the prefix the document's paths carry and the keys do not. Declare the missing operation or remove the stale entry. Set openapi.enforcement to "kernel" to check only the operations the kernel enforces, leaving out those marked x-permdock-enforcement: handler. An operation outside tenantPaths may stay undeclared. The check is skipped unless all of openapi.operations, openapi.tenantPaths and openapi.doc are set. --only openapi runs PD091.

PD092: two peer variants of permdock

pnpm installs one copy of permdock per distinct set of resolved peers, so an app whose workspace packages pin different react, zod or next versions gets two copies. Module-level state does not cross copies except through Symbol.for brands, so a client store, a cache or an instance created from one copy is not the other copy's. PD092 reads only the snapshots: section of pnpm-lock.yaml, because packages: names every version once without peers, and lists each permdock@<version>(…) key beyond the first with the peers that differ:

warning PD092  pnpm-lock.yaml resolves permdock@0.21.0 twice: (react@19.1.0) and (react@19.2.0)

Align the peer versions across workspace packages, or add a pnpm.overrides entry for the peer. --only project runs PD092.

PD087: the hook and better-supabase disagree on the broadcast topic or the config

supabase.hook broadcasts each authorization version bump on better_supabase:authz when better-supabase is installed, and better-supabase's subscribeAuthzVersions and SessionProvider listen on that topic. PD087 warns when supabase.hook.broadcast.topic pins another topic, and when better-supabase is a dependency of the nearest package.json or a workspace package while its better-supabase.config.* is not found from permdock.config.ts up to the workspace root:

warning PD087  better-supabase is a dependency but its config file was not found from permdock.config.ts up to the workspace root, so supabase.hook cannot read its tenant claim or sessions block

Set betterSupabase.config in permdock.config.ts to the config file, or remove the pinned topic. With only the dependency found, the hook takes better-supabase's topic and leaves activeFrom and the receive policy at their defaults.

PD088: text cast on a row helper

The row helpers permitted_<resource>_rows and can_<resource> return and take the resource's id type: uuid on the supabase dialect, text on neon, and whatever rls.idTypes sets. A ::text cast around a call, or on the column compared to its result, defeats the index on the id column and fails against a uuid helper. The check reports each such statement in the migration folders, outside function bodies. It does not run on the neon dialect or with rls.idTypes: { '*': 'text' }. Compare the column to the helper's own type, set rls.idTypes for a column that is not uuid, and run permdock rls generate. --only sql (or --only supabase) runs PD088.

PD089: one id tested against the whole row set

$1 in (select permitted_doc_rows('doc.read')) and $1 = any(array(select permitted_doc_rows('doc.read'))), with a bound parameter, a p_<name> function parameter, new.<column> or old.<column> on the left, build the permitted set to test one id. PD089 reads policies and create function bodies, and skips the permitted_* helpers permdock rls generate writes. The can_<resource>(id, permission) form evaluates that row alone: on a 5,000-row table in 10 tenants, tests/integration/bench/row-helpers-hot-path.test.ts measures a one-id check at about 0.4 ms with can_item and about 1.5 ms through a wrapper over permitted_item_rows. --only sql (or --only supabase) runs PD089.

PD090: repeated read-only actor guard

permdock rls generate writes a restrictive <table>_<command>_read_only_actors policy per write command with rls.readOnlyActors. A hand-written policy on the same table and command that also calls permdock_actor_may_write() runs the guard twice. The check reads the migration folders, supabase/schemas and rls.out, even when doctor.migrations lists other folders, and warns once per such policy. A policy counts as guarded when it calls the function or inlines the expression that rls generate wrote before 0.25. Remove the call from the hand-written policy. --only sql (or --only supabase) runs PD090.

PD093: hand-written own_subject

The hook migration writes permdock_subject(), the signed-in user's subject. With subject: true on authorizationProvider, better-supabase's bootstrap calls it through functions.subject, so an app needs no own_subject() of its own. The check reads the migration folders and warns once per create function own_subject. --only sql runs PD093.

PD094: a supplied better-supabase value is set again

better-supabase fills blocks.memberships.options.roleThrough from a provider role source with the same through, and blocks.permissions.disabled.tenant and .user from the provider's suspension rows under blocks.permissions.model: "provider". The check builds the provider from permdock.config.ts and the policy, as supabase inspect does, and reports a config value only when it equals what the provider would fill; a different value overrides the provider and stays. It reports blocks.invitations.options.platformRoles only when every key equals the provider's platformRoles, comparing SQL without whitespace runs or casts on null; a narrower override, such as a through.where the provider has no globalScope for, stays. Delete the reported key from the better-supabase config. --only better-supabase runs PD094.

PD095: schema SQL pg-delta cannot diff

A file under supabase/schemas is an error when it contains a do block whose body creates an object, grant … on all, two definitions of one signature, a trigger on a view, if not exists on create table, create index or create policy, or a drop trigger before a create trigger. pg-delta diffs the file against the database, so each statement is a plain create, a create or replace, or absent. A schema file without a PermDock header that creates a function or policy a PermDock schema file also creates is an error that names both files: supabase/schemas/public/tables/doc.sql and supabase/schemas/permdock/helpers.sql both create doc_select on public.doc. An export writes these copies; permdock generate removes them. Files in _custom/ and _cluster/ are left out. A migration whose first line is a versioned -- permdock:<part> v1 marker is an error when it repeats DDL or a grant for a name a PermDock schema file already defines. The check reads PermDock's schema files, not another tool's. Rewrite the schema file as plain create or replace statements, and delete the marked migration statement the schema file owns. --only rls or --only supabase runs PD095.

PD096: a through pair deciding columns omit

through.on pairs the membership join. A pair whose column is not in the deciding columns is a pair the hook, the PowerSync stream and the manifest can drop. Regenerate those three so every pair is used. --only supabase or --only powersync runs PD096.

PD100: two factories for one app

An app with both adapters calls definePermDock from permdock/better-supabase and passes the result to createPermDock from permdock/supabase/middleware. Calling definePermDock from permdock/supabase as well builds a second version cache, instance cache and subject cache, so a role change reaches only one of them. PD100 is an error when a source file imports definePermDock from permdock/supabase and a better-supabase config exists. Pass the subject options to the better-supabase factory. --only better-supabase or --only supabase runs PD100.

PD101: app policies on a follows child table

rls.tables.<resource>.follows writes select, insert, update and delete policies on each child table, which call can_<resource> on the parent row. Permissive policies add up, so a hand-written policy on the same table for a command the generated policies allow widens them. PD101 is a warning for each permissive policy on a child table in a schema file the app wrote (as restrictive is not reported). Delete it, or drop the table from follows. --only rls or --only supabase runs PD101.

PD102: a stale junction stream

roles: "many" on blockMembershipSource reads every member's role rows, so the stream syncs the junction for each member of the caller's tenants. A sync-config.yaml generated before that still filters the junction with membership_roles.user_id = auth.user_id(), and a member sees only their own roles on the device. Run permdock generate --only powersync and deploy the file. --only powersync runs PD102.

PD098: the transaction pooler

The generated helpers are called as prepared statements. Supabase's transaction pooler (port 6543) does not keep a prepared statement between statements, so use the session pooler (port 5432) or set prepare: false on the driver. The better-supabase provider templates and supabasePostgresQuery take the same setting.

PD099: an update policy with no select policy

Postgres reads a row before it updates it, so an update policy on a table with no select policy matches no rows and returns none, with no error. permdock generate writes a select policy beside every write policy it writes; this check covers hand-written policies in supabase/schemas and supabase/migrations.

Performance checks

PD103 to PD108 read the statements of supabase/schemas, rls.out and the migration folders. The generated files are included, so output from an older release is reported until you run permdock rls generate. --only performance runs PD103 to PD112.

PD103: a PermDock call per row

permitted_<resource>_row(row, 'key') and can_<resource>(row.id, 'key') are security definer functions. Postgres cannot inline them, so a scan makes one call per row, and a table of 1M rows makes 1M calls. Lead the policy with the tenant, tenant_id = any((select permdock.permitted_<scope>_id_array('key'))), which Postgres evaluates once and matches against the tenant index. PD103 is a warning for each policy that calls either form. A can_ call whose arguments are all literals or auth.uid() is not reported.

PD103 also reports a set helper (permitted_<resource>_rows, _rows_for, _ids_in, _count, permitted_<scope>_permission_keys and its _for form) that a policy passes a column of its own row, such as permitted_deal_rows('deal.read', array[id]). The column makes the call a correlated subquery, which Postgres runs again for every row. A column of a subquery alias, as in the tenant-led permitted_<resource>_rows('key', t.id) over unnest(…) t(id) that rls.tables.<resource>.follows writes, is not the row and is not reported.

PD103 also reports a policy that calls permitted_<resource>_rows('key') when the project defines that helper and its last definition has no when 'key' arm. The body then calls permitted_<resource>_match for every row, which a 5,500-row file_nodes table turned into a 57 s folder page. Regenerate with permdock rls generate: the current helper states each key's arm in the set query.

PD104: multiple permissive policies

Postgres evaluates every permissive policy for a command and ORs the results. PD104 is a warning when two or more permissive policies cover one command of a table and at least one is hand-written. Generated policies alone never trigger it, so rls.policyPerRole output is not reported. as restrictive policies are not counted. Merge the policy into the generated predicate or make it restrictive.

PD105: an unindexed lookup column

follows child tables, via parents and walk chains filter and join on one column each. PD105 is a warning when rls.tables names a follows foreign key, a via.key, the parent's via.column or a walk user column that no create index leads in the schema files or migrations. permdock rls generate writes these indexes to indexes.sql; an index whose first column is another column does not count.

PD106: a text cast on a key

id::text = any(ids) compares text, so the index on id cannot serve it. PD106 is a warning for each statement in a file the app wrote that casts a column named id or ending in id to text. Cast the other side instead: id = any(ids::uuid[]). PD088 reports the same cast around a generated helper call.

PD107: an unsargable custom-role probe

custom_role_permissions and custom_role_includes carry a (tenant_id, …) index. A probe written as tenant_id::text = p_tenant or tenant_id is not distinct from p_tenant cannot use it and scans every tenant's roles: 4M rows at 1,000 tenants with 20 roles of 200 permissions. Compare tenant_id = p_tenant::uuid, with explicit is null branches for shared roles. PD107 is a warning for each such statement, including generated files from before the fix, unless a later migration or the schema files define the same function again: the database runs the last definition. authorize() from permdock/supabase assigns the requested tenant to a variable of the column's type and compares it uncast.

PD108: _rows(p) without a tenant

permitted_<resource>_rows(p) returns the rows of every tenant the caller can read, so a query for one tenant still scans all of them. Lead the policy with permitted_<scope>_id_array or permitted_<scope>_ids_by_permission. Passing the row's own tenant column, permitted_<resource>_rows(p, tenant_id), makes a correlated call that runs once per row, which PD103 reports. PD108 is a warning for each app policy that calls the one-argument form with no tenant lead. A generated policy is not reported: permdock generate writes the one-argument form only where no tenant can lead the set.

PD109: custom roles in jwt mode

With rls.authorize: "jwt" the helpers read memberships[].grants from the token, and the generated hook writes no grants. A custom role therefore resolves to no permissions. PD109 is an error until rls.authorize is database or supabase.hook.claims names a function that writes grants. This is a known gap, not a planned feature: custom roles resolve only in database mode.

PD110: token size

With --db-url-stdin, doctor runs custom_access_token_hook for the sample users in doctor.claims inside a transaction it rolls back, adds the claims a Supabase token carries beside the hook's, and measures the compact JWT in characters. better-supabase's BS405 measures the claims against tokenHook.budget in the same way. PD110 is a warning above 4,096 characters: the token is sent in every Authorization header, and @supabase/ssr splits a session cookie into 3,180-byte chunks. supabase.hook.budget (1,024 bytes by default) bounds memberships; the claims it does not bound are hook.claims entries and team_ids.

PD111: an optional limit

A list that takes no limit returns every row the policies allow, and Lienlink's jobs API did so at 1M rows. PD111 is a warning for a GET on a collection path in an openapi.doc document whose limit query parameter is not required and has no default and maximum (on its schema in OpenAPI 3), and for a source file that builds an MCP server (permdock/mcp, registerTool(, .tool() with limit: …optional() on a line that sets no default. Make limit required, or give it a default and a maximum.

PD112: snapshot size

permdock snapshot size measures the compact snapshot of one role. PD112 measures the role with the most grants, held in three tenants, and is a warning above 65,536 bytes of JSON. A Next.js page serialises that snapshot into the Flight stream for each PermDockProvider. The message names the largest part, usually grants or assignable, and the bytes of typeLevel, scopes and requires, which no option leaves out. omitAssignable drops assignable on a page with no role editor, and omitStatic replaces grants with references into the generated bundle. When gen.kinds includes bundle, PD112 measures with omitStatic, as the project's pages do. --only snapshot runs PD112.

PD113: legacy HS256 verification

A Supabase project that still signs with the legacy shared secret verifies a token only by calling GET /auth/v1/user, or by holding the secret, which also mints any user's token. Asymmetric signing keys (ES256) let the app verify locally against /auth/v1/.well-known/jwks.json, and supabase.auth.getClaims() does that for you. PD113 is a warning for each source file that reads SUPABASE_JWT_SECRET or JWT_SECRET from the environment, or passes algorithms: ["HS256"]. Rotate to an ES256 signing key, verify with permdock/jwt or subjectFromSupabaseClient, and drop the secret. --only supabase or --only jwt runs PD113. See signing keys and JWTs.

PD114: truncated tokens in jwt mode

With rls.authorize: "jwt" the helpers read the memberships claim and nothing else. When the hook budget cuts a user's memberships it sets memberships_truncated and keeps a prefix, and the helpers see only that prefix: the user loses the other organisations with no error. PD114 is a warning for a project that sets both a token hook and jwt mode. With --db-url-stdin it runs the hook for the doctor.claims sample users, as PD110 does, and is an error for a sample whose token is truncated. Use rls.authorize: "database": with a hook the helpers read the claims first and the tables when the token is truncated (token shape).

In database mode PD114 is information: with --db-url-stdin it names the sample users whose token keeps a partial membership list. RLS loses nothing, because the helpers read the tables for such a token. Each instance built for that user rereads the subject from the database. Raise supabase.hook.budget, or set supabase.hook.membershipsClaim: false so no token carries a partial list. A token from membershipsClaim: false is not reported. --only hook runs PD114.

PD115: a migration behind the schema file

permdock generate --only rls writes -- permdock helpers (…) sha-256:<digest> as the first line of the helpers, where the digest covers every line after it. The digest depends on the helper text only, so a release that writes the same helpers writes the same line. PD115 compares the newest migration in the migration folders that holds that line with the schema file (supabase/schemas or rls.out). A different digest means a policy change reached the schema file and no migration applies it. The check is silent when either side has no stamp, which is the case for a migration that supabase db diff wrote, since a diff carries no comments. --only drift runs PD115.

PD120: config restates its default

permdock config --print lists the resolved value of each key in an opened section (rls, supabase.hook, gen, collect, doctor) and names the keys that took a default. PD120 warns about each key set to that same default: rls.schema: "permdock", supabase.hook.jwtExpiry: 900, collect.srcPath: ["./src"]. Lists whose order no command reads compare as sets, and strings compare with whitespace runs collapsed. Run permdock codemod config --prune to remove them.

PD121: membership facts declared twice

rls.memberships and rls.suspension are derived from supabase.hook.memberships (or rls.membershipSources) and supabase.hook.suspension (membership derivation). PD121 warns at rls.memberships.scopes.<scope> when the written table reads a scope differently from its source, and at the same path or rls.suspension when the entry restates the derived value. Delete a restated entry with permdock codemod config --prune; fix a disagreeing one so both declarations say the same, then delete it. PD121 reads the config file as written, so a key a plugin such as supabaseRls() fills is not reported.

PD122: verbs that compile to none

A verb with no rls.actions entry, no default and no default-verb prefix compiles to none: the permission is seeded, and no SQL policy admits that command. PD122 lists those verbs once, as information, with the verbs that infer a command. PD071 reports the ones whose name reads as a write. Map a verb only when its permission should reach a table.

PD123: block actions the catalog does not answer

better-supabase checks a permission key for each action of a block, record type, bucket and topic. The key comes from blocks.<name>.permissions in the config, then from the provider's actionKeys (a permission's meta.answers), then from the block's own default. PD123 asks the project's better-supabase/sql for that list through listActions (better-supabase 0.84.0) and reports, as an error, each action that falls back to its default key while permissions.catalog.json does not list that key, or that has no key at all. No role holds such a key, so better-supabase denies the action for everyone. Add the action, such as blocks.audit.readAll, to meta.answers of the permission that decides it, then run permdock collect. PD079 reads the blocks from the raw config and also reports a missing default block key, under the key; PD123 reads the resolved config with the provider's actionKeys, covers record types, buckets and topics, and targets the action to answer. Without better-supabase, a catalog or a better-supabase config there is nothing to check; an older better-supabase, or a config better-supabase refuses, is a warning. --only better-supabase runs PD123.

PD134: resource without a table

rls generate binds a resource with no rls.tables entry to the table of the same name, or to its snake_case plural when only that one exists in supabase/schemas or supabase/migrations. PD134 lists each resource for which neither exists, as information: name the table in rls.tables, or set the entry to false for a resource that has none. The check is silent without schema files.

PD135: seeds in a declarative project

With pg-delta turned on explicitly (enabled = true under [experimental.pgdelta] in supabase/config.toml, or supabase.schemas: 'pg-delta'), the role_permissions rows still go in a data migration, because pg-delta does not diff rows. rls generate --seeds-out <dir> writes only the rows that changed since the newest seeds migration and stamps it at the later of now and one second past the newest migration, but the migrations still accumulate. PD135 suggests rls.seeds: 'view', which writes the rows as a view in the helpers part. It is silent once rls.seeds or rls.staticGrants: 'ref' is set.

PD130: repeated version reads

A request that builds one instance through permdockFor and another with its own memberships, customRoles, versions or instances reads the authorization version twice: the second instance never finds the instanceCache entry or the version cache that permdockFor shares. PD130 reads the project's sources and warns at each such getPermDock or createPermDock call when the project also calls permdockFor. Spread permdockFor.sources() into the options or resolve the instance through permdockFor. In development, postgrestSources also warns when one user's version is read twice within a second and names both reads with their intent and whether each was live; onSourceCall reports intent, live and reason (live, stale or truncated) in production.

PD124: published tables with PermDock policies

Logical replication copies rows past row level security: Supabase Pipelines, ETL and a subscriber database receive every row of a published table. With a database URL (--db-url-stdin or --local), PD124 lists each table whose policies call the rls.schema helpers and that belongs to a publication. The supabase_realtime publications and powersync are left out, because Realtime checks realtime.messages policies per subscriber and PowerSync applies its sync rules. Check who reads the destination, or drop the table from the publication. --only supabase and --only rls run PD124.

PD125: schema directory dependency order

pg-delta orders the declarative schema directory by the dependencies @supabase/pg-topo reads from each statement. PD125 runs pg-topo's analyzeAndSort over the directory and reports:

  • CYCLE_DETECTED: statements that depend on each other.
  • DUPLICATE_PRODUCER: an object two statements create. The finding names both files.
  • UNRESOLVED_DEPENDENCY on a table rls.tables names: no schema file creates it.

pg-topo 1.0.0-alpha.8 cannot tell overloads of one function apart: it drops array bounds from a signature and reads %type as a type. PD125 leaves out a duplicate whose producers declare different argument lists, and a cycle between overloads of one function, until pg-topo tells overloads apart. It also leaves out a schema that only create schema if not exists statements create, such as the create schema if not exists permdock that the RLS helpers, the auth hook and the SCIM output each write: such statements run in any order. A plain create schema next to such a statement is still reported, because the repeat may run first and make it fail.

PD125 resolves @supabase/pg-topo from the app, then from the installed better-supabase, which pins it and whose BS709 tells the app to remove its own entry. Without either it prints one info finding that names the package. When the better-supabase config's authorization sets doctor.command, as authorizationProvider does, better-supabase's doctor runs PermDock's under BS705 and reports cycles and duplicates as BS722 and BS723, so PD125 reports only the unresolved table. It runs only in the pg-delta workflow. --only supabase and --only sql run PD125.

PD126: a second parser copy

permdock depends on oxc-parser and pgsql-parser at exact versions, because codemod edits and doctor findings depend on the parser version. PD126 reads the app's package.json and, for each of the two it lists, the version the app resolves; when that differs from the version permdock resolves, the project holds two copies. Remove the package from package.json; permdock installs its own. --only project runs PD126.

PD127: Supabase Lite on SQLite

With [db] driver set to sqlite or sqlite-postgres in the Supabase project config, Supabase Lite stores data in SQLite: there are no Postgres functions and no row level security, so the policies and helpers permdock rls generate writes never exist. PD127 warns when rls is configured on such a project. can() in the app still decides; the database enforces nothing. --only supabase and --only rls run PD127.

PD128: a tenant table that reads by row

rls.tableReads in permdock.manifest.json tells better-supabase which tables one cache entry per tenant may serve (provider tables). PD128 reads the committed manifest, reads the select policies again from the schema files, migrations and rls.out, and fails for each table the manifest marks tenant that is now row or no longer exists. The message names the rules the table breaks. better-supabase's BS428 checks the generated policies against the provider's tables; PD128 also sees hand-written policies, so both run. PD128 reads files only, not pg_policies. Run permdock supabase inspect --out to rewrite the manifest, or restore the select policy. --only rls and --only supabase run PD128.

PD131: many policies for one command

Postgres evaluates every permissive policy of a command, or-ed, and every restrictive one, and-ed, for each row. PD131 counts the policies the schema files and migrations leave on each table for one command and authenticated (a to public policy counts), and warns above doctor.policies.max, 4 by default. The name, the unit and the default are those of better-supabase's BS641, so one number means the same in both configs. The finding lists each policy with permissive or restrictive and its origin (library, provider or app); fold the provider or app policies into fewer conditions. permdock rls report shows the helper calls each policy adds.

better-supabase measured a 1,000-row read at 0.92 ms with nine policies and 1.00 ms with thirteen (its ADR 1218), so PD131 stays a warning. When the better-supabase config's authorization sets doctor.command, as authorizationProvider does, better-supabase's doctor runs PermDock's under BS705 and reports the count itself as BS641, so PD131 reports nothing. --only rls, --only supabase and --only performance run PD131.

PD132: over a size budget

budgets in permdock.config.ts sets byte budgets for the client bundle, the snapshot of the role with the most grants and the memberships claim (budgets). PD132 is an error for each budget the policy is over and names the size, the gzip size, the budget and the largest part. permdock generate --check fails on the same budgets. --only snapshot runs PD132.

PD133: a bundle built in a server module

clientBundle(policy) in a module without "use client", passed to a provider's bundle prop, crosses into the client as props: React serialises the whole bundle into every document that renders the provider. Generate it with permdock gen --kind bundle and pass the clientBundle export of that "use client" module, which reaches the browser as a module reference. --only next runs PD133.

PD136: Supabase CLI below 3.2.0

PermDock supports Supabase CLI 3.2.0 and later, the floor better-supabase's BS710 names. --local and the config.jsonc reader were checked on 3.2.0 once; CI runs the 3.4.0 pin only (decision 0081). PD136 reads the version of the supabase package the project installs and warns below 3.2.0. A project that runs a global supabase binary gets no finding. --only supabase runs PD136.

PD137: a shared function that reads a row table

rls.sharedFunctions in permdock.manifest.json lists the functions better-supabase may call in a share: "tenant" cache fill (shared functions). PD137 reads the committed manifest, reads the schema files, migrations and rls.out again, and fails for each listed function that no longer qualifies: it reads a table that is now row, reads the caller (auth.*, current_user, current_setting, a helper of the helpers' schema), is no longer stable or immutable and security invoker, or no longer exists. The message names the tables. It also fails when rls.permissionFilters names a helper from rls.tenantPureHelpers: that helper takes a tenant argument, and better-supabase 0.87 checks the key argument only, so a caller could pass another tenant and share the result. better-supabase's BS430 checks the same function properties against the database; PD137 needs files only. Run permdock supabase inspect --out to rewrite the list. --only rls and --only supabase run PD137.

PD138: users the budget truncates

With a database URL (--db-url-stdin or --local) and supabase.hook, PD138 runs the hook for the first 5,000 users of auth.users (ordered by id) inside a transaction it rolls back, and counts the tokens that carry memberships_truncated. It reports info with the count, the sample size and the budget. A truncated user reads the database for every request, and the shared cache gives that user a share key only for the active tenant when the cut kept an entry outside it (shared cache). The check never writes a token or a row.

PD116: unguarded Server Actions

Every export of a module that starts with 'use server' is a Server Action, which Next.js serves as a POST endpoint to anyone who can load a page that references it. PD116 reads each such module under doctor.srcPath and warns for an exported function whose body calls none of protectAction, requirePermission, getPermission or .assert. Wrap the handler with protectAction(permission, { input }) (Server Actions) or call requirePermission before the write. The check reads text: an action that checks through a helper of your own warns until the module calls one of the four names, and a 'use server' directive inside a function body is not read. --only actions runs PD116.

Side effects

What each command may change; side effects explains each one.

CommandSide effects
permdock doctorfiles, database:read

database:read applies only with --db-url-stdin: PD085 runs the token hook in a transaction it rolls back.

Why

  • config.toml goes through a TOML parser. Line-by-line matching misreads comments, multi-line arrays and quoted section names, and a misread jwt_expiry would silence PD019, a security warning.
  • PD001 reads direct imports, not an import graph. A graph needs module resolution for every bundler's aliases, and a wrong resolution produces a false path to a server module. The bundle measurement already fails on a server import reachable from a client entry; doctor catches the common case, a client file importing a server entry, in milliseconds. doctor.clientEntries replaces guessing client roots from folder names.
  • security_invoker is a warning, not generated SQL. A view over application data is application SQL, and some views are meant to bypass RLS (a public aggregate), so the warning names the view and the choice stays explicit. The only views permdock rls writes are the opt-in field views, which are security_invoker, and their owner-rights companion, which is marked so the check can tell it apart.
  • PD030 is a warning, not an error. Many apps never expose a table to clients (a server-only connection, no Data API), and there pick is the whole control. Where clients do read the table, the warning names each column so the fix is one flag.
  • One project load per run. Doctor reads the config, the source files, the policy module and the collect --check scan once, on first use, and passes them to every check in a table of checks. Each check used to load the policy and rescan the sources itself; on a 2,000-file tree that halved the run, from 850 ms to 429 ms. A --only run still loads only what its checks read.
  • Docs drift is a maintainer check, not a doctor check. Whether the PermDock docs list every CLI flag and public export is a property of this repository; scripts/check-docs-drift.ts and a CLI test, which reads each command's flag definitions, run it in the PermDock CI, and doctor stays about the consumer's project.

PD068: pg-delta files without pg-delta

rls generate and supabase hook generate write for pg-delta unless the project opts out (schema workflow). pg-delta is the default of Supabase CLI 3.x, and [experimental.pgdelta] enabled = false switches the project back to migra. migra drops function privileges, so the hook loses its supabase_auth_admin grant and the helpers keep Postgres's default execute for public. The check runs when supabase.schemas is unset or pg-delta, the Supabase config parses and sets enabled = false, and a file under the declarative schema directory starts with a PermDock marker. Remove enabled = false, or set supabase.schemas: 'migra' and regenerate with --grants-out (migra). --only declarative (or --only supabase) runs PD068.

PD069: migra leftovers under pg-delta

pg-delta orders the schema files by their dependencies, so [db.migrations] schema_paths and numbered parts are no longer needed, and a numbered part next to the per-schema layout declares the same functions twice. Under pg-delta the check warns once when schema_paths is set, and once per PermDock file under the declarative schema directory whose name starts with digits and _permdock_. Remove schema_paths and the numbered parts, then regenerate without --out (move from migra to pg-delta). --only declarative (or --only supabase) runs PD069.

Last updated on

On this page

UsageAccept a findingWhere doctor reads source filesChecksPD001: server-only imports in client entriesPD002: unknown permission referencesPD003: used but ungrantedPD004: stale catalogPD005: skillsPD006: TypeScript versionPD007: validation modePD008: reserved identifiersPD009: duplicate copiesPD010: roles or tenant from an unverified claimPD011: tenant from an optional claimPD012: stale draft pinPD013: polymorphic EdDSAPD014: discovery and issuer configurationPD015: token typePD016: RLS opaque grants and unverified twinsExample reportPD017: sensitive verbs without approvalPD018: static separation of dutyPD019: JWT-mode authorize() with long-lived tokensPD020: hostable permissions compiled into RLSPD021: hostable permissions without Cloud variablesPD022: views without security_invokerPD023: custom-role keys outside the ceilingPD024: approvals the requester can givePD025: memberships the named scopes dropPD026: scopes nobody has to keepPD027: request context in an RLS policyPD028: attributes and memberships a user could setPD029: API keys that never expirePD030: field-limited columns the database still returnsPD031: graph declarations that do nothingPD032: graph resources RLS cannot namePD033: activation without a ceiling, or held standingPD034: break-glass under an RLS configPD035: support access without an actorPD036: id route without a row loaderPD037: helper calls for row-conditioned permissionsPD038: tenant claim mismatchPD039: Supabase hook setupPD040: auth.role() in a migrationPD041: HS256 capability tokensPD042: hook grants missing from the migrationsPD043: helpers applied after their callersPD044: server-only grants with no endpointPD045: unparseable Supabase configPD046: helper schema exposed through the Data APIPD047: user metadata in SQLPD048: functions without search_pathPD049: security definer functions clients can callPD050: tables without row level securityPD051: per-row auth.uid() in a policyPD052: update policies without with checkPD053: foreign keys without an indexPD054: stale role_permissions seedsPD055: custom roles stored under a former keyPD056: callers of a legacy helperPD057: anonymous sign-ins mapped as usersPD058: stale Sync StreamsPD059: policy module did not loadPD060: unparsable source filePD061: permissions a suspended scope keepsPD062: legacy JWT claim settingsPD063: statements supautils rejectsPD064: assignment trigger missingPD065: server-only grants in React Native codePD066: a materialised table still createdPD067: an operation bound to an undeclared permissionPD070: oauthScopes missing from the catalogPD071: write verbs without an rls.actions entryPD072: tenant-written role rows read through a sourcePD073: role for that no source can holdPD074: custom access token hook missing from config.tomlPD075: two resources on one tablePD076: rls.actions entries that change nothingPD077: config names the policy does not declarePD078: active tenant read from another placePD079: block permission keys missing from the catalogPD080 and PD081: sources and caches created per callPD082: two authorization version tablesPD083: a hook file without authz_version_forPD084: PowerSync stream reads a token claimPD085: the token hook fails as supabase_auth_adminPD086: a sqlFunction set variant names a missing column or drops row argsPD091: a tenant operation has no permissionPD092: two peer variants of permdockPD087: the hook and better-supabase disagree on the broadcast topic or the configPD088: text cast on a row helperPD089: one id tested against the whole row setPD090: repeated read-only actor guardPD093: hand-written own_subjectPD094: a supplied better-supabase value is set againPD095: schema SQL pg-delta cannot diffPD096: a through pair deciding columns omitPD100: two factories for one appPD101: app policies on a follows child tablePD102: a stale junction streamPD098: the transaction poolerPD099: an update policy with no select policyPerformance checksPD103: a PermDock call per rowPD104: multiple permissive policiesPD105: an unindexed lookup columnPD106: a text cast on a keyPD107: an unsargable custom-role probePD108: _rows(p) without a tenantPD109: custom roles in jwt modePD110: token sizePD111: an optional limitPD112: snapshot sizePD113: legacy HS256 verificationPD114: truncated tokens in jwt modePD115: a migration behind the schema filePD120: config restates its defaultPD121: membership facts declared twicePD122: verbs that compile to nonePD123: block actions the catalog does not answerPD134: resource without a tablePD135: seeds in a declarative projectPD130: repeated version readsPD124: published tables with PermDock policiesPD125: schema directory dependency orderPD126: a second parser copyPD127: Supabase Lite on SQLitePD128: a tenant table that reads by rowPD131: many policies for one commandPD132: over a size budgetPD133: a bundle built in a server modulePD136: Supabase CLI below 3.2.0PD137: a shared function that reads a row tablePD138: users the budget truncatesPD116: unguarded Server ActionsSide effectsWhyRelatedPD068: pg-delta files without pg-deltaPD069: migra leftovers under pg-delta