PermDock

Changelog

Every PermDock release, newest first.

Changelog

Every PermDock release, newest first. Per-package detail is in packages/permdock/CHANGELOG.md.

0.35.1 (2026-11-26)

  • permdock_custom_role_system_guard lets a signed-in caller insert or update a platform role row, one with no tenant, that has the skip column set, as long as the row stays a platform row. Since 0.34 it refused these writes with 42501 system-role, so platform staff could no longer create platform catalog roles through the Data API under the app's own policies. skip has no effect on a platform row, so the guard did not need to cover it. Moving a row that has skip into or out of a tenant is still refused. Rerun permdock rls generate.

0.35.0 (2026-11-26)

  • rls.tokenScopes: { delegations: true } compiles policy delegations to actor('oauth-client') (every client, or { kind: 'oauth-client', id }) from authenticated() into the SQL helpers, so an OAuth client token whose scopes are identity-only (as Supabase Auth issues them) is capped at the delegation on the Data API too, instead of holding nothing. A token with other scopes needs both the delegation and a covering scope, as in process. tokenScopes: true is unchanged.

    Doctor fixes: PD058 compares sync-config.yaml with the publication statement in the schema files, as permdock generate --only powersync writes it, so a current file is no longer reported stale, and its fix names permdock generate --only powersync. PD053 counts unique nulls not distinct (...) and unique nulls distinct (...) constraints as indexes.

0.34.0 (2026-11-26)

  • Breaking: snapshotFor leaves custom-role grants out of the snapshot and names the roles in custom.held; customRoleRecord(policy, customRoles, tenant) writes the tenant-level record and fromSnapshot(snapshot, { customRoles }) merges it. A snapshot read without the record grants nothing from custom roles. A member with 10 custom roles drops from 9,095 to 4,975 bytes.
  • Breaking: the hook writes memberships as { s, r, v, e, o }, with 22 character ids and role indexes, so the 1,024-byte budget keeps 25 CentraKit memberships instead of 9. readMemberships, subjectFromSupabase and the jwt-mode authorize read both forms; code that reads the raw claim as an array uses expandMemberships from permdock/supabase. permdock claims size reports the compact fit.
  • The Supabase hook writes suspended_in, the tenants where the user is a member and the tenant is suspended, outside the memberships budget; permdock_subject() returns it as suspendedIn and principal.suspendedIn exposes it. RLS still denies.
  • The generated permdock_token_current() accepts the compact memberships object the hook writes as well as the older array, so the claims-first helpers take the token again instead of always reading the database. Rerun permdock rls generate.
  • authorizationHooks().shareKey answers for the active tenant of a token with memberships_truncated when the token holds an entry of another tenant, because the hook keeps the active tenant's entries first. Doctor PD138 counts the users the hook budget truncates.
  • claimsFirst(source, { versions }) serves the custom-role version of a tenant from the version cache, so a page of a member with a custom role reads it at most once per maxStaleMs. permdock supabase hook generate adds authz_versions_for(p_user, p_tenant), which postgrestSources calls when both versions are needed in one tick, and a development warning names a custom-role version read twice within a second.
  • permdock rls measure --as <user> runs requests as a user against the app's database and prints the version reads per request, the helper times from pg_stat_user_functions and pg_stat_statements, and the share of tenant tokens that get a share key.
  • permdock supabase inspect --functions <pattern> prints, for each function the schema files define that matches the pattern (public.*_payload), a pass or every reason it is not shared: its header, a read of the caller, an unknown call, or the row table it reads with the rule behind it.
  • permdock supabase inspect writes rls.permissionFilters: permdock_<root>_has_active(p_grant) and permitted_<root>_permission_keys_active(p_keys), which call the two-argument helpers with the tenant the token names. authorizationProvider fills better-supabase's permissionFilters from that list. Passing permissionFilters: true is no longer accepted. The two-argument helpers stay out of the list, because better-supabase 0.87 checks the key argument only.
  • permdock now requires better-supabase 0.87.0 or newer. The previous floor was 0.85.0. A project on 0.85 or 0.86 has to upgrade: 0.85 rejects permissionFilters as an unknown provider key.
  • postgrestSources turns a client that throws synchronously during a batched version read into a rejected read, so the caller's check settles and denies instead of hanging with an uncaught error.
  • rls.readOnlyActors keeps its restrictive policies: on CentraKit's schema 579 of them add a median 0.06 to 0.08 ms to parsing, rewriting and planning a write, inside the 0.11 to 0.13 ms noise of the measurement, and the function they call takes 0.14 µs. No trigger-function mode is added.
  • rls.tableReads[].tenantFor lists the keys under which a row table reads as tenant. authorizationProvider({ tables: true, widened: true }) lists such a table as tenant, and authorizationHooks({ widened: widenedKeys(manifest) }) makes shareKey answer null for a caller who holds none of them.
  • rls.tableReads gives every row table a reason: the policy and file behind each owner, condition and restrictive entry, what permdock supabase inspect could not read for an unknown one, and for a form table the policy, tenant column or migration that keeps permdock codemod bsb-access-tags from moving it. codemod bsb-access-tags --check prints would move N of M tables.

0.33.0 (2026-11-25)

  • With rls.customRoleWrites.roles.skip set, permdock rls generate writes permdock_custom_role_system_guard, which refuses a signed-in caller that marks a role row as a system role or renames or moves one (system-role). Before, the name guard trusted the flag, so a tenant who could edit role rows could mark a custom role it holds as a system role and rename it to owner. Rerun permdock rls generate.
  • permdock supabase inspect lists p_resource on permdock_request_approver_ids when delegations are on, so authorizationProvider requires the function with its real signature and passes the request kind's resource to it, and it lists pg_catalog.split_part among the functions the template calls.
  • permdock_approver_for_ids(p_tenant, p_resource) follows the covers of one tenant and resource, next to the argument-less form, which since the cover scope fix follows only covers with no tenant, resources or permissions. Upgrade notes: a policy that relied on permdock_approver_for_ids() for tenant covers should call the two-argument form. permdock_request_approver_ids gained p_resource, and the generated SQL drops the old signature first, so drop or recreate a policy or view that calls permdock_request_approver_ids(p_requester, p_tenant) in the same migration.
  • permdock_request_approver_ids and permdock_approver_for_ids follow a cover's tenant, resources and permissions, so a cover limited to one kind of request, one tenant or some permissions no longer makes the delegate an approver of every request. permdock_request_approver_ids takes an optional p_resource, and authorizationProvider passes the request kind's resource to it; rerun permdock rls generate and permdock supabase inspect --out.

0.32.0 (2026-11-24)

  • The 0.31 upgrade guide opens with one ordered checklist for an app that goes from permdock 0.28.0 to 0.31.0 with better-supabase 0.82.0 to 0.85.0, and names for each step the step of better-supabase's guide it comes before or after.
  • authorizationProvider fills portalSubjects only with portalSubjects: true: in 0.31.0 a contact's <scope>.read let them read every comment and internal note on their own record. portalParties: false leaves out portalParties.
  • authorizer(...).warm(), authorizationHooks(...).warm() and warm(policy) from permdock/next build one anonymous instance and run one can, so the first request skips them. They never reject and answer { ok, ms }.
  • permdock codemod 0.31 is the codemod of this release, and 0.32 stays an alias of it. The config error for doctor.waivers and doctor.ignore says "in 0.31", and the upgrade guide moves from guides/upgrade-0-32 to guides/upgrade-0-31, with the columns "0.30" and "0.31".
  • permdock rls report counts rls.tableReads per rule (form, follows, via, walk, owner, condition, restrictive, fields, unknown) and lists each row table with its rules. For a form table, permdock codemod bsb-access-tags --check, permdock rls explain and rls.tableReads[].reason in the manifest name the grant that keeps the policy off an @bsb access tag.
  • permdock supabase inspect writes rls.sharedFunctions (functions that pass better-supabase's BS430 and read only tenant tables) and rls.tenantPureHelpers (the helpers that answer the same for callers with an equal grantFingerprint); authorizationProvider({ tables: true, sharedFunctions: true }) emits the functions, and doctor PD137 fails for a listed function that now reads a row table.
  • rls generate refuses global grants to delegated tokens in permdock_has. A token with an API key claim holds a global grant only when rls.apiKeys caps it by its scopes, and a token with a non-empty client_id or an act only when rls.tokenScopes caps it by its scope claim. Before, a policy delegation that left platform permissions out did not reach SQL, so an OAuth client a platform admin authorized could insert into a global-roles table or call a definer function gated by permdock_has with the admin's own global roles. The helper memo keys those tokens apart from the user's session, and the _for helpers, which name their user, are unchanged. permdock_can_assign gates its global branches the same way. Regenerate after upgrading. A project that relies on OAuth clients, support sessions or API keys holding global grants sets rls.tokenScopes or rls.apiKeys. Two more cases change: session tokens from an identity provider that always carry client_id (Cognito access tokens, for example) lose global grants without rls.tokenScopes, and on the guc dialect permdock_has now reads <prefix>.api_key and <prefix>.act as JSON, so a non-JSON value there raises.
  • rls.tableReads leaves out a table a later migration drops and follows alter table … rename to, and permdock rls verify --shadow finds supabase/schemas above the package directory in a monorepo.
  • scripts/centrakit-latency.ts measures the Server Action, the shared bsb.kept entry, runtimeCacheVersionStore and the cold instance on the CentraKit fixture; the Shared cache guide lists the before and after numbers, including 3 to 1 version reads for a Server Action that asks database-write.

0.31.0 (2026-11-24)

  • An action's meta.answers lists the better-supabase actions it decides (blocks.invoices.recordPayment), the catalog carries it as answers, and authorizationProvider emits it as better-supabase's actionKeys.
  • BREAKING: permdock doctor reads accepted findings from doctor.baseline, a JSON file in better-supabase's grouped format [{ code, reason, targets }]; an entry without a reason or one that matches no finding is an error, --update-baseline rewrites the file, and doctor.failOn: "warning" fails on warnings. doctor.waivers and doctor.ignore are removed, and permdock codemod 0.32 moves both into the baseline file.
  • BREAKING: subjectFromEve from permdock/eve takes the principal from the turn's caller, session.auth.current, and falls back to session.auth.initiator only when the turn has none. actorFromEve always answers { id: "eve:app", kind: "eve" }. A follow-up from another person in a shared session was decided with the initiator's grants before; it is now decided with the sender's (#360).
  • BREAKING: snapshots are wire format v: 2 (schemas/snapshot-v2.json), and parseSnapshot, fromSnapshot, snapshotFromClaims and React Native storage refuse v: 1, so a client discards a cached v1 snapshot and fetches a new one. v2 writes each requires holding once in a requires table, memberships as [shape, id], typeLevel as bit sets over the bundle's keys, and leaves vocabulary, scopes and shared grants to the client bundle (bundle, static.shared). On CentraKit's policy a 12-membership snapshot falls from 19,828 B to 1,850 B and each extra membership from 275 B to 40 B. readSnapshot(snapshot, { bundle }) returns the flat form, maxGrantsPerTenant leaves an oversized tenant to the server (truncated), and getSnapshot from permdock/better-supabase now lists every membership instead of one tenant's.
  • Breaking: rls.memberships and rls.suspension are derived from supabase.hook.memberships and supabase.hook.suspension when unset, so a project with junction sources gets claims-first helpers. Doctor PD121 reports a written entry that disagrees with or restates its source, and permdock codemod config --prune deletes a restated one.
  • Doctor PD037, PD051, PD052 and PD090 and permdock rls import --sql read create policy statements through libpg_query instead of regular expressions. PD052 and PD090 no longer take a for update in a subquery as the policy command, PD037 keeps the key of a policy whose expression holds ';', rls import reads on public.orders as table orders and role public in lower case, and a dump libpg_query rejects now stops rls import with its line and column instead of falling back to text.
  • Doctor PD103, PD104 and PD108 read policies through libpg_query, so a for update inside a subquery no longer becomes the command of a policy without a for clause. permdock rls generate and permdock supabase hook generate no longer write a moved grant twice when it has a comment after its ;.
  • Doctor PD123 reports a better-supabase block, record type, bucket or topic action that falls back to its default key while the catalog lacks that key; answer it with meta.answers. It reads listActions from better-supabase 0.84.0.
  • Doctor PD125 no longer reports a schema that only create schema if not exists statements create, such as the permdock schema the RLS helpers, the auth hook and the SCIM output each create.
  • Doctor PD094 compares resolved values as better-supabase's BS427 does (sorted keys, collapsed whitespace, case of unquoted SQL names), also reports blocks.impersonation.options.claimsHook and block permission keys the provider supplies, and warns when blocks.permissions.disabled is a column string where the provider supplies the row form, because a user or tenant with no row then passes better-supabase's block functions.
  • Doctor PD114 also runs in rls.authorize: 'database' mode: with --db-url-stdin it reports, as information, the sample users whose token keeps a partial membership list. supabase.hook.membershipsClaim keeps its default true; the hook docs record the claims-branch and table-branch timings behind that.
  • Doctor checks PD007, PD008, PD010, PD011, PD013, PD036, PD038, PD041 and PD057 read the parsed source, so text in a comment or a string no longer raises or silences them; PD013 reads only the algorithms array and PD008 also reads export { x as dock }.
  • Doctor info PD126 reports an app that lists oxc-parser or pgsql-parser and installs another version than the one permdock pins, which leaves two copies in the project.
  • PD095, PD099 and PD101 and the rls generate index and table scan read SQL through libpg_query, so a statement inside a comment, a string or a function body no longer counts; the generate trigger notes read create or replace trigger and skip triggers inside function bodies.
  • The CLI reads TypeScript and SQL through parsers. permdock codemod finds defineConfig from permdock through consts, satisfies, aliased imports and module.exports, and reports a value it cannot follow. Vue and Svelte <script generic="T extends Record<string, any>"> blocks are read, doctor PD084 no longer counts nativeRefresh in a comment, and the SQL statement splitter handles 'a--b', "a;b", E'it\'s;x' and $a1$ bodies.
  • The CLI reads supabase/config.json and config.jsonc as well as config.toml, resolves env(NAME) values (PD045 names an unset one), and doctor, generate, supabase hook generate, rls and powersync verify take --local [--stack <name>] to connect to the local Supabase stack. Doctor PD068 now fires only when the config sets [experimental.pgdelta] enabled = false, and the new PD136 warns about a Supabase CLI older than 3.2.0.
  • The CLI's agent detection follows @vercel/detect-agent 1.2.7: OPENCODE=1 now switches it to agent mode, as OPENCODE_CLIENT already did.
  • The permdock-data skill and the Drizzle, Kysely, Prisma and RLS pages name better-supabase doctor BS642 beside the leakproof note: under RLS a status filter never uses a composite (<tenant column>, status, ...) index.
  • The generated helpers read the permission-to-grant-key map from one view, <schema>.permission_keys(permission, scope, effect, grant_key, conditioned), instead of inlining it in grant_keys, every permitted_<scope>_permission_keys and permdock_bootstrap_permissions.
  • The server kernel and every adapter built on it take waitUntil (from @vercel/functions or cloudflare:workers), which keeps the function alive for each pending sink write and one flush() per tick, as permdock/next already does with after().
  • Under pg-delta, permdock generate removes the copies of PermDock's functions and policies that supabase db schema declarative generate writes, and never writes into _custom/ or _cluster/. PD095 reports a copy that remains and names both files.
  • Under pg-delta, when a schema file creates the powersync publication, permdock powersync generate writes alter publication powersync add table ... to <schemaDir>/permdock/powersync_publication.sql instead of a comment in sync-config.yaml, so the declarative sync adds the synced tables outside public.
  • With rls.readOnlyActors and --helpers-only, rls generate writes a read-only actor guard for every table whose supabase/schemas files let authenticated write, into permdock/read_only_actors.sql under pg-delta. rls verify counts better_supabase.actor_may_write() as a guard.
  • --format findings prints { findings: [{ code, severity, message, target, help }] }, the list better-supabase doctor reads for BS705.
  • @supabase/pg-delta (>=1.0.0-alpha.61 <1.0.0) and @supabase/pg-topo (>=1.0.0-alpha.8 <1.0.0) are optional peers, for rls verify --shadow and doctor PD125; both resolve from the installed better-supabase when the app does not list them.
  • Intent adds 'database-write', which authorizer from permdock/better-supabase selects for a write whose context.enforcement is rls. It reads the authorization version from the cache; definer and unset writes stay live.
  • SourceCall adds intent, live and reason, the development warning for a repeated version read names both reads, and doctor PD130 warns when a project builds an instance with its own sources next to permdockFor.
  • VersionStore takes better-supabase's shape: get answers { version, at } and set(id, version, at) carries the database read time, so maxStaleMs counts from the read on every instance. Breaking for a custom store, which must store at. runtimeCacheVersionStore and postgresCacheVersionStore are new.
  • authorizationHooks sets shareKey, and grantFingerprint from permdock/better-supabase returns the gf1: digest of a caller's grants for a list of permissions, so callers with equal grants share one share: "tenant" cache entry.
  • authorizationProvider adds an operations entry <resource>:<action> for each permission whose allows require an approval, with approval.steps from the approval's by, stages and quorum, so better-supabase's approvals block applies the same floor.
  • authorizationProvider fills portalParties and portalSubjects from a child scope whose memberships name via, teamIdsOf from the one child scope without via, versions from the hook's authz_version_for, and wildcards: 'none' when no catalog key holds a *.
  • authorizationProvider from permdock/better-supabase no longer sets functions.approverFor. better-supabase reads it as the users who may decide a request, and permdock_approver_for_ids() answers the users the caller decides for. Tested against better-supabase 0.84.0.
  • authorizationProvider sets doctor.command to permdock doctor --format findings, so better-supabase doctor reports PermDock's findings as BS705, and takes doctor: { timeoutMs } for better-supabase's doctor.timeoutMs.
  • authorizationProvider sets tenant on each roleSources entry, scopes its where by the custom-role table's scope column, and asks platformRoles.canAssign at the 'global' scope, so blocks.memberships.options.roleThrough and blocks.invitations.options.platformRoles become restated. rls.customRoleWrites.roles.globalScope names the scope value of a platform role row for platformRoles.through.where.
  • authorizationProvider takes tables: true, which fills better-supabase's tables from the manifest and catalog so share: "tenant" entries can key on the grant.
  • budgets in permdock.config.ts sets byte budgets for the client bundle, the snapshot and the memberships claim; permdock generate --check exits 1 and doctor error PD132 reports one the policy is over. permdock bundle size reports the bundle per role and shared part, the generated bundle module records its bytes and gzip bytes under the header, PD112 probes with omitStatic when the bundle kind is generated and names typeLevel, scopes and requires, and doctor warning PD133 reports clientBundle(policy) passed to a provider from a server module.
  • decideCustomRole(permdock, role) decides whether the subject may save a tenant or platform custom role: it runs validateCustomRole and denies with not-assignable-by any key or level outside assignablePermissions and assignableLevels, listed in beyond.
  • permdock codemod 0.26 reads the parsed source: it removes inferred rls.actions entries only under a config object's rls, rewrites SQL helper names only in string and template literals and .sql files, and edits only the tableOf owner it read. It now rewrites .sql files and lists a versioned migration as a follow-up instead of editing it.
  • permdock codemod bsb-access-tags moves plain permitted_<scope>_ids('<key>') tenant policies into a better-supabase @bsb access tag when the key's rows are provably the same. rls verify --introspect treats the policies those tags render as generated.
  • permdock codemod bsb-action-keys moves the keys a better-supabase.config.ts blocks entry names under permissions into the answers of the matching permission, so authorizationProvider sends them as actionKeys.
  • permdock codemod config --prune also removes a rls.actions verb set to 'none' that compiles to no command, and rls.tables and rls.scopeTypes entries equal to what the schema files resolve. The schema readers, the read-only actor guards and rls report find supabase/ in the nearest parent directory of the same checkout, so a config in a workspace package reads the repository's Supabase project; rls.readOnlyActors then guards the write policies of that project's tables too.
  • permdock config --print reports the effective config with each default filled in, doctor PD120 warns about a key set to its default, and permdock codemod config --prune removes such keys after proving every generated file stays byte-identical.
  • permdock doctor adds PD116, a warning for a Server Action exported from a 'use server' module that calls none of protectAction, requirePermission, getPermission or assert.
  • permdock doctor adds PD124: with a database URL, an info finding for each table whose policies call PermDock's helpers and that belongs to a publication other than supabase_realtime and powersync, since logical replication copies rows past row level security.
  • permdock doctor adds PD125: @supabase/pg-topo reads the declarative schema directory and reports a dependency cycle, an object two schema files create, or a table rls.tables names that no schema file creates. It resolves pg-topo from the app, then from the installed better-supabase.
  • permdock doctor adds PD127: a warning when rls is configured and the Supabase project config sets [db] driver to sqlite or sqlite-postgres (Supabase Lite), where the generated policies and helpers do not exist.
  • permdock doctor no longer reports PD069 or PD106 on better-supabase module files (-- better-supabase module: with a @bsb-hash header); better-supabase doctor owns them.
  • permdock explain <action> decides every fixture for one permission with explain: true and prints the grant that decided, the denial reasons, the denies that matched and the grants passed over.
  • permdock generate without a database no longer reads the permdock folders under supabase/schemas and the migration folders when it looks for existing indexes and tables, so another plugin's output from the same run never changes the rls notes.
  • permdock keys rename <from> <to> retires a permission key: it moves the action in the permissions module, adds "from": "to" to definePermissions(..., { renamed }), and, with custom roles stored in the database, writes a data migration that moves stored grants to the new key.
  • permdock openapi annotate --routes --write-spec <file> writes x-authorization and x-oauth-scopes from route comments into an existing OpenAPI document. x-authorization: "handler" now marks a handler-checked operation instead of naming a permission key handler.
  • permdock openapi annotate takes the JSDoc block directly above each handler, so a file header @permission no longer lands on the first handler. It also reads export const GET and export { handler as GET }, maps app/route.ts to / and an optional catch-all [[...slug]] to {slug}.
  • permdock rls report [--json] lists each table's policies by command and role, with permissive or restrictive, the origin (library, provider, app), the helpers and keys each calls, sorted by helper calls per statement; with --db-url-stdin or --local it reads pg_policies and lists the indexed columns whose = is not leakproof. Doctor warning PD131 reports a table with more than doctor.policies.max (default 4, as better-supabase's BS641) policies for one command and authenticated.
  • permdock rls verify --introspect and permdock rls report treat Stripe Data Pipeline schemas (stripe_sdp…, owned by the stripe_sdp role) as platform schemas and leave their policies out.
  • permdock rls verify --shadow <url|stack> loads the declarative schema directory into a shadow database with @supabase/pg-delta and reports each policy expression, function body or grant of a PermDock object that differs from the live database.
  • permdock supabase inspect writes rls.tableReads into permdock.manifest.json: per table, whether its select policies filter by tenant alone (share: 'tenant') or by row, with the rules that make it row. authorizationProvider({ tables: true }) reads it, and doctor PD128 fails when the manifest marks a table tenant that its policies no longer allow.
  • permdock/better-supabase needs better-supabase 0.85.0 or later as a peer (>=0.85.0, was >=0.81.0): it imports ShareKeyHook, AuthorizationTableShare, AuthorizationEnforcement and VersionStoreEntry, which 0.85.0 adds.
  • permdock/eve's EveApprovalContext types session.parent, so an actor or delegation option can give a subagent's session its own actor id and narrower scopes.
  • permdock/server, permdock/supabase/middleware and permdock/next add tenantFromPath, which resolves a tenant slug in the URL to a tenant id through the app's resolve. The id is the active tenant only when the subject holds a membership there; an unresolved slug leaves the instance without a tenant instead of the token's.
  • permdock requires Node.js 26 or later (engines.node is >=26), and the CLI no longer passes --experimental-strip-types to its watch worker.
  • rls generate --seeds-out <dir> writes only the role_permissions rows that changed since the newest seeds migration, stamped at the later of now and one second past the newest migration. Doctor PD135 suggests rls.seeds: 'view' for a pg-delta project.
  • rls generate compiles a verb with no rls.actions entry and no inferred command to none instead of failing; doctor PD122 lists those verbs. A resource without an rls.tables entry binds to its snake_case plural table when only that one exists in the schema files, a scope without rls.scopeTypes takes its table's id type, and doctor PD134 lists a resource whose table neither name finds.
  • rls verify --shadow, rls explain and doctor PD090, PD103, PD104 and PD108 treat the policies an @bsb access tag renders as generated, reading them from better-supabase's accessPolicies instead of the bsb_access_ name prefix; rls explain --json lists them under tagged.
  • rls.approvals.managers takes a self-referencing table, { table, id, reportsTo, user, tenant, active? }, and adds permdock_manages_row, permdock_managed_row_ids_in, permdock_managed_row_ids, permdock_accessible_row_ids and permdock_request_approver_ids; authorizationProvider fills approverFor from the last. permdock codemod manager-chain rewrites hand-written walks to them.
  • rls.memberships is derived from the membership sources only when every source maps to its own scope; a config with a source the table form cannot describe keeps reading the sources.
  • subjectFromCiOidc takes provider: 'vercel', which verifies a Vercel OIDC token against https://oidc.vercel.com (or a team issuer) and returns a workload principal with the team id as owner, the project id as project and environment.
  • supabase.hook.activeTenant: "request" declares that the app resolves the active tenant per request: doctor PD078 stays silent, and authorizationProvider states tokenHook.activeOrganizationFrom: "resolver", so better-supabase's BS409 needs no blocks.permissions.activeTenant entry.
  • workflowSdkWaiter registers its hook with getConflict() before parking and takes a pending(token) step, so a request decided before the hook registered no longer leaves the run parked.

0.30.0 (2026-11-21)

  • BREAKING: permdock/eve needs eve 1.2.0 or later, the ai and chat peers need 7.0.177 and 4.45.0, and permdock/better-supabase needs better-supabase 0.81.0 or later. EveResponseContext takes request.interactionId and request.principal in place of request.requestId, the decision is "approve" | "deny" with no cancel, and the session reads id and initiator. A response on another instance now recomputes the approval token with request.principal as the caller. approvalFor from permdock/eve combines with better-supabase's strictestApproval; see Eve with better-supabase.

0.29.0 (2026-11-19)

  • authorizationProvider({ ..., roleIn: true }) fills better-supabase's functions.roleIn with permdock_role_in, so with blocks.memberships.options.roles.many its membership_roles trigger refuses another organization's custom role (SQLSTATE 23514, MEMBERSHIP_ROLE_SCOPE). The option needs better-supabase 0.77.0, since older releases refuse the key, and is off by default; problems reports it when the manifest lists no permdock_role_in.
  • permdock rls generate writes permdock_role_in(p_role, p_tenant) with rls.customRoles in database mode: whether a role is declared or a custom role of the tenant (or one with no tenant), read from the rls.customRoleWrites.roles table or else the custom-role tables. Only trusted SQL may execute it, and permdock supabase inspect lists it in rls.helpers. Regenerate the helpers and the manifest to pick it up.

0.28.1 (2026-11-19)

  • PD054 understands rls.staticGrants: 'ref'. When role_permissions is the view over the policy bundle, the check compares the bundle hash the view pins with the hash the policy compiles to, instead of reporting every compiled row as missing.
  • PD084 reads the doctor sources and is quiet when the app wires the refresh: a call to nativeRefresh, or an app bridge that calls refreshSession() and refreshes PermDock through authzChangeRefresh. Before, it warned for every stream that reads a token claim, even with the refresh in place.
  • PD107 no longer reports a custom-role probe in a function that a later migration or the schema files define again, since the database runs the last definition. authorize() from permdock/supabase now compares the custom-role tenant_id uncast, through a variable of the column's type, so the tenant index serves it. Regenerate the authorize() SQL to pick it up.

0.28.0 (2026-11-16)

  • Breaking: permdock/better-supabase needs better-supabase 0.63.2 or later (>=0.63.2); upgrade better-supabase before this release. authorizer and permdockFor ignore a bootstrap subject seeded for another tenant.
  • permitted_<scope>_ids_by_permission and its _for forms read the caller's memberships once per call instead of once per grant key, for policies without custom roles. Rerun permdock generate to pick it up.
  • usePermDock no longer logs "A component was suspended by an uncached promise" on the first check under the lazy evaluator. The store now keeps returning the evaluator load it suspended on after that load settles, so a render React replays sees the same promise.

0.27.3 (2026-11-12)

  • The ceiling checks permdock_api_key_allows, permdock_token_scope_allows and permdock_interactive_allows are now PL/pgSQL. Each helper runs them once for every grant key it reads, and as SQL functions Postgres planned them again on every call, which for permdock_token_scope_allows also meant folding the whole scope map. A caller in many organizations with several grant keys per statement paid this most: in an adopting app, a single-row read behind a permitted_<resource>_rows set policy drops from 1.9 ms to 1.2 ms for an 11-organization admin. Run permdock generate to pick up the new helpers.

0.27.2 (2026-11-12)

  • grant_keys and permitted_<resource>_match are now PL/pgSQL. A can_<resource>(row, permission) policy calls the match once per row, and Postgres never inlines a security definer SQL function, so it parsed and planned the body and the permission map again for each row. PL/pgSQL keeps the parsed statements for the session. In an adopting app, a list of 46 rows behind a can_<resource> select policy drops from about 39 ms to 7 ms, and a single-row read drops from 1.7 ms to 1.0 ms. Run permdock generate to pick up the new helpers.

0.27.1 (2026-11-12)

  • The scope and permission-key helpers check the API key, token scope and interactive-only ceilings once instead of per row. permitted_<scope>_ids(p_grant) evaluates permdock_api_key_allows, permdock_token_scope_allows and permdock_interactive_allows once per call, where it used to call all three for every instance it returned. permitted_<scope>_permission_keys and its holders form first check once whether the session carries an API key, an OAuth client or an act, so a plain session skips the three calls for every grant key. permdock_bootstrap_permissions reads the platform keys from one permitted_<root>_permission_keys(null) call instead of one permdock_has_permission call per global key. On a member of 11 organizations with about 200 grant keys each, permdock_bootstrap_permissions drops from about 440 ms to about 40 ms on a small Supabase instance. Regenerate the RLS SQL to pick this up.

0.27.0 (2026-11-12)

  • Row helpers evaluate the calls their arms repeat once per call. permitted_<resource>_rows, its tenant form and permitted_<resource>_match read permdock_user_id(), permdock_has_permission(key) and permitted_<scope>_ids_by_permission(key) from a one-row permdock_hoisted CTE when more than one arm names them, computed only for the permissions whose arms read them. With rls.apiKeys or rls.tokenScopes, every permdock_api_key_allows and permdock_token_scope_allows call in those helpers first checks once whether the session carries an API key or a delegated token, so a plain session skips them. The match enters only the relation memos its own predicate reads, where it used to enter those of every resource in the policy. Regenerate the RLS SQL to pick this up.
  • permdock gen writes only the kinds that gen.kinds or --kind lists. types and sql are now kinds of their own, with types() and sql() plugins in permdock/cli/plugins/app, and constants writes only constants.ts (and fields.ts with gen.fields). Before, constants also wrote types.ts and the server-only sql.ts, so an app that listed only constants and react got two modules nobody imported. zod, valibot and factories add types, which they import. With no gen.kinds, gen still writes constants, types and sql. An app that imports sql.ts or types.ts and sets gen.kinds adds sql or types to it; a plugins config adds sql() or types().

0.26.0 (2026-11-12)

  • A generate cache hit is reported as Skipped (cache) on stderr. summary.skipped counts those files. A config key PermDock does not read warns with the reason code unknown_key.

  • A token that holds a custom role stays claims-first: MembershipSource.customRolesVersion and Principal.customRolesVersion (the custom_roles_ver claim) are compared with the tenant's version, and only a token behind either version reads the subject. postgrestSources reads custom_roles_version_for (wrapper permdock_custom_roles_version_for with supabase.hook.api), SubjectCache.record takes the tenant versions and SubjectRecord.customRolesVersions carries them, so a custom-role edit no longer serves stale grants. A truncated token reads the versions before the subject, so the subject cache serves it. The instance cache key and the custom-role answers include the tenant version. A token without the claim, or a source without the method, is read live as before.

  • Add assignableFor(policy, user, { tenant }), which returns the assignable entry of one tenant on demand, the entry snapshotFor(…, { tenants: "all" }) carries for it. snapshotFor's v option now accepts only 1, the one wire version, and throws a TypeError for anything else instead of ignoring it. No generated SQL changes.

  • Add permdock roles grants [--role <name>], which lists the grants each role holds, one row per permission after allow(permissions.invoice) expands. Roles still do not inherit from one another. No files are written and no generated SQL changes.

  • Add permdock snapshot size (bytes of a role's client snapshot by part, raw and gzip) and permdock claims size (the memberships claim, token characters and the memberships the hook budget keeps). Neither writes files or changes generated SQL.

  • Add subject_for(p_user, p_tenant) to the generated Supabase hook: subject_for(p_user) for one tenant, reading that tenant's memberships through the new memberships_for(p_user, p_tenant text). Global roles and the authorization version stay the user's; custom roles are those pinned to the tenant plus shared and platform roles; an unknown tenant, a tenant without a membership and a null tenant return memberships: []. supabase.hook.api also writes the <prefix>subject_for wrapper for the two-argument form, granted to service_role only. permdock generate --only rls and permdock supabase hook generate rewrite the hook file with the two new functions (an additive diff); no data migration is needed, because the change adds functions and no table or column. Docs: custom-role version and compiled roles, the custom_roles_ver claim, AuthZEN resource search paging, and where(permission, { tenant }) on the Drizzle and Kysely pages.

  • Add supabase.hook.refresh ('reuse' default, 'full') and supabase.hook.oauth ('full' default, 'slim'). A token refresh whose incoming authz_ver equals the current version keeps its roles, memberships and team_ids instead of reading them again, for sources without expiresAt or a scope suspension table; oauth: 'slim' returns empty roles and memberships for a token with a client_id. The generated custom_access_token_hook changes for every hook whose sources qualify: run permdock generate --only supabaseHook and apply the rewritten migration. No data migration is needed.

  • AuthZEN search/resource hands resources.<type>.list the compiled access condition, the page limit and the request's page.token as cursor, and skips list when the action reaches no row. A list that answers { rows, next } makes its own pages; the handler still decides every row, and the page answers next_token from next with no total. An array answer is paged in memory as before.

  • Breaking: PD075 and a differing hook topic (PD087) are errors. PD017 matches a camelCase prefix and lists a waived key under ignored. A deny counts only when it excludes the requester. PD069 flags any SQL file directly in the schema directory. PD094, PD095 and PD096 report a restated provider setting, schema SQL pg-delta rejects, and a through.on pair the deciding columns omit.

  • Breaking: PD079 is an error. It also fails when better-supabase/sql does not export modulePermissionKeys, because the keys the blocks check cannot be listed. permdock/better-supabase exports defineBlocksConfig<typeof policy>(), which rejects a blocks.<name>.permissions value that is not a permission key of the policy at compile time.

  • Breaking: approve, reject, cancel, send, withdraw, confirm, fulfill, receive, reimburse and writeOff compile as update, remove as delete and duplicate as insert. mark*, pause* and resume* compile as update. An rls.actions entry still wins, so remove: "none" stays.

  • Breaking: authorizationProvider({ personas: 'roles' }) sends personas: 'roles' with fixtureRoles instead of an expanded persona list; a tenant role's setup inserts the role id when memberships read roles through a roles table, and a global role goes into rls.roles. The provider also fills functions.subjectForTenant, bootstrapPermissions and canIn, permissions[].levels and tokenHook.teamIdsTruncatedClaim.

  • Breaking: authorizationProvider fills platformRoles from rls.roles and functions.subject from permdock_subject() unless platformRoles or subject is false. suspension.userKey is rls.suspension.users.id. personas: "roles" builds one persona per catalog role. A role source where lists that scope's roles and treats a non-null customRoleTenant as a custom role. approverFor and managedUsers call permdock_approver_for_ids and permdock_managed_user_ids when the manifest lists them. Pass permissions to type the provider's keys.

  • Breaking: claimsFirst with onStale: 'reread' rereads a token that names a role the policy does not declare, and keeps the actor. subjectFromSupabase keeps those global roles when customRoles is set, and a client_id with no scope or authorization_details stays actor-less. useAssignablePermissions returns { permissions, status }; a local snapshot answers status: 'server-only'.

  • Breaking: member_team_ids_for and member_team_ids_of are written by rls generate, and the hook calls the reader instead of the teams table. team_ids has its own budget: on overflow the claim is omitted and team_ids_truncated is set. A change to supabase.hook.teams bumps authz_ver for the old and new holder.

  • Breaking: permdock codemod no longer runs the 0.5 or 0.8 rename tables. Those names stay on the Naming page as history. permdock codemod 0.26 rewrites a stored catalog and the generate commands this release removed.

  • Breaking: permdock rls generate is removed. Set out, split, target, schemas and seeds on rls() and run permdock generate --only rls. The old command fails with one suggestion. seeds: false replaces --no-seeds, and seeds: { out, backfill } replaces --seeds-out and --backfill-out. rls.seeds still accepts 'function' and 'view'.

  • Breaking: permdock/better-supabase needs better-supabase 0.58.0 or later (>=0.58.0); upgrade better-supabase before this release. authorizationProvider returns better-supabase's AuthorizationProvider, and the PermDockAuthorizationProvider type is removed: import AuthorizationProvider from better-supabase/contract instead. blockApprovalStore reads a request with the approvals block's consumed status as approved and consumed.

  • Breaking: permdock/mcp treats a token with no scopes and no authorization_details as a session token. It passes the scope check in tools/list and in calls, raises no scope challenge, and gets no actor and no delegation, where it was refused with insufficient_scope. A token with scopes, none of them the policy's, is still governed by unscopedTokens.

  • Breaking: permdock_<resource>_chain() starts at the caller's own row, the row whose rls.tables.<resource>.user column (the id column by default) is the caller, and returns every row below it in that row's tenant. It no longer treats the parent column as a user id. A path guard and a depth cap of 32 end a cycle or a self-parented row, and an active cover adds the delegator's row and every row below it.

  • Breaking: permdock_approver_for_ids() and permdock_managed_user_ids(p_tenant) return setof uuid on Supabase and setof text elsewhere, and cast no column. rls.approvals.managers.tenant names the column of the manager table that holds each edge's tenant. It is required when the policy has a tenant scope, otherwise generate fails with config_invalid. permdock_managed_user_ids, permdock_manages_for and permdock_manages keep only the edges of the request's tenant, so a manager in one organisation no longer reaches reports in another. The better-supabase provider template is permdock_managed_user_ids({tenant}).

  • Breaking: permitted_<resource>_ids and permdock_link_<resource>_<link> return the resource id type from rls.idTypes. Callers compare that type directly. A closure comparison casts ancestor and descendant to the id type. The closure table itself stays text.

  • Breaking: problemFromDecision no longer takes a subject. The detail never named it. Pass the options object as the third argument.

  • Breaking: rls.jsonSchema: 'auto' is refused. Set true or false. The attrs privilege check and the custom-role backfill are functions, not do blocks.

  • Breaking: supabase hook generate, powersync generate, scim generate, openapi emit and gen are removed. Run permdock generate, with --only supabaseHook, --only powersync, --only scim or --only openapi for one plugin. gen output is part of permdock generate when gen is set in the config. Each old command fails with one suggestion.

  • Breaking: a Storage bucket policy calls can_<resource> with the object id in the folder. It no longer calls permitted_<scope>_ids_by_permission, so the resource's row conditions apply.

  • Breaking: a Supabase manifest whose row helper omits idType is refused. Run permdock generate. PermDock no longer reads a missing idType as uuid. platformRoles and personas are fields of the better-supabase 0.53 provider.

  • Breaking: a team or teams scope's member_<scope>_ids_for is (p_user uuid, p_active text default null), the signature of the supabase.hook.teams reader, and its one-argument form is dropped; global_roles_for is security definer, so the invoker hook no longer grants supabase_auth_admin select on the membership, roles or referenced user tables. memberships_for drops a suspended user's entries and entries in a suspended tenant for every source, a suspended-tenant table turns off the refresh fast path (an explicit supabase.hook.refresh: 'reuse' then fails), and supabase.hook.teams takes disabledAt.

  • Breaking: a level grant key is <permission>@<level>, with the level condition only. It is no longer crossed with a #n condition group, and orderedLevels no longer adds the lower levels to the SQL reach list. An empty level is the whole tenant.

  • Breaking: a resource stream is emitted only for a name in powersync.resources. membership_roles lists every member of the caller's non-disabled organisations and skips a disabled membership. The hook version table is not a second stream.

  • Breaking: a signed-in custom-role write is checked even when another trigger wrote it. The check is skipped only when the transaction sets permdock.sync. customRoleWrites.requires is matched at global scope for a global role and at the role's tenant otherwise. Deleting a role calls permdock_trusted_delete_custom_role_grants and removes include_role references, never a declared role.

  • Breaking: a verb that does not infer and has no rls.actions entry is config_invalid. The error names the verbs that infer. rls.approvals writes permdock_approver_for_ids() (the caller plus active delegators, one hop) and, with managers, permdock_managed_user_ids(p_tenant), which walks down and leaves the caller out.

  • Breaking: an insert into a membership roles table bumps authz_ver, and a moved row bumps the old holder and the new one. supabase.hook.memberships defaults to the rls.memberships scope tables.

  • Breaking: the CLI --json output follows better-supabase CLI contract 3 (cli-result-v2.json, replacing cli-result-v1.json): a failure prints one error document line on stderr with reason, message, data, userActionRequired and retryable, and nothing on stdout, and next steps carry argv. Exit code 3 is gone (auth_required, input_required and confirmation_required exit 2), consent_required with --confirm <token> is confirmation_required with --yes --effects-digest <digest>, and dirty_worktree, write_failed and catalog_invalid are file_conflict (exit 1), failed and invalid_input.

  • Breaking: the catalog wire format is catalog-v2.json with version: 2. A stored approval that still uses mode: any|all|sequential or a boolean distinct fails closed. permdock codemod 0.26 rewrites a stored catalog-v1 document.

  • Breaking: the closure backfill select moves into the seeds migration, and is skipped when rls.seeds is view. An inherited row helper is defined once. A role enum is a plain create type.

  • Breaking: the hook reader membership_entries_for is memberships_for. It is security definer and execute stays with supabase_auth_admin only. Re-run permdock supabase hook generate.

  • Breaking: the row-valued and per-id helpers are can_<resource>(p_row | p_id, p_permission). permitted_<resource>_row is no longer generated. Both forms call permitted_<resource>_match.

  • Breaking: under pg-delta, rls.realtime and rls.storage policies are static SQL beside the schema directory, at supabase/service/realtime/permdock.sql and supabase/service/storage/permdock.sql. The authz receive policy is supabase/service/realtime/authz.sql. A scoped declarative sync does not load them. Apply them where the service tables exist. They are no longer do blocks in the seeds migration.

  • Doctor PD103 also reports a policy that passes a column of its own row to a set helper (permitted_<resource>_rows, _rows_for, _ids_in, _count, permitted_<scope>_permission_keys), such as better-supabase's permitted_<resource>_rows('key', array[id]), which Postgres runs again for every row. A better_supabase.can_subject(…) call is better-supabase's one-row check and is not reported.

    PD108 no longer reports a generated policy, accepts permitted_<scope>_ids_by_permission as a tenant lead, and stops suggesting permitted_<resource>_rows(p, <tenant column>), which PD103 now reports.

  • Doctor, permdock supabase inspect and permdock generate read the output paths from the rls(), supabaseHook() and supabase() plugins. The plugins fold their out, split and hook out into rls.out, rls.split and supabase.hook.out, so PD039 and PD064 find the generated helpers, the manifest's hook.out names the file the hook plugin writes, and rls() with seeds.out uses rls.split from the config instead of failing with "--seeds-out needs --split". definePlugin takes an optional config member for this.

  • Files under the pg-delta schema directory are declarative SQL, including {part} paths and supabase.hook.out. create table and create unique index drop if not exists, and a trigger is create or replace trigger.

  • Generated raise exception using statements list hint before message, so better-supabase's doctor BS627, which reads the raise line and the two after it, finds the stable code PermDock already passes. The errors are unchanged. Run permdock generate.

  • Instances with many custom roles build and decide faster: custom roles and grants are indexed per instance, mayUse reads one snapshot per instance, decideIds builds one instance per tenant, and definePermDock().forClient(client) returns the same bound definition for the same client. where() returns one in for equal-field alternatives and subtracts each deny once. The client batch posts at most 256 evaluations and 1 MiB per request and keeps at most 5,000 answers.

  • Lienlink files that go once it upgrades: supabase/schemas/job_parties/040_rls.sql (the follows part writes those policies), private.trg_drop_platform_custom_role (the cascade trigger deletes a platform role's grants for a staff caller with no membership), trg_role_permissions_assignable and its pg_trigger_depth guard (customRoles.from.sync: "trigger" guards a signed-in write), and the scopeChallenge delete in apps/mcp/src/handler.ts (a session token raises no scope challenge). supabase/schemas/realtime/authz.sql goes too: generate writes the receive policy only to supabase/service/realtime/authz.sql. The declarative-jobs fixture matches Lienlink's config, and a second generate writes nothing.

  • PD072, PD064, PD090, PD115 and the plan checks expand a {part} in rls.out to each split part before they read it, so a guard trigger in the helpers part of rls({ out: "db/{part}.sql" }) no longer reports PD072. PD111 accepts an optional limit with a default and a maximum, as its fix text says.

  • PD094 reports blocks.invitations.options.platformRoles only when it equals the platformRoles the provider fills. It reported any config that named permdock_can_assign_any, so a deliberately narrower override, such as canAssign for the global scope with a through.where, failed the doctor.

  • PD094 reports blocks.memberships.options.roleThrough and blocks.permissions.disabled.tenant or .user only when the value equals what better-supabase would fill from the provider: a role source with the same through, or a suspension row under blocks.permissions.model: "provider". A value that overrides the provider no longer fails the doctor, and a top-level roleThrough is no longer reported.

  • PD095 also reports if not exists on create table, create index and create policy, and a drop trigger before a create trigger in a PermDock schema file.

  • Security: an action can set meta.interactiveOnly: true to keep it to the user's own session. decide, mayUse and client snapshots refuse it to a subject with an actor or a delegation, and no OAuth scope maps to it. The generated SQL helpers, can_<resource> and table policies refuse it to a token with an API key claim, client_id or act, and their memo keeps those tokens apart from the user's session. permdock_can_assign refuses transferOnly roles to the same tokens. authorizationProvider lists the keys as delegation.interactiveOnly for better-supabase. Mark ownership transfer, organization deletion and similar actions, then run permdock collect and permdock rls generate.

  • The Supabase manifest schema accepts the permdock_interactive_allows helper that rls generate writes for interactive-only actions. Before, permdock supabase inspect wrote it and parseSupabaseManifest refused the manifest, so better-supabase gen failed in an app that marks an action interactiveOnly.

  • The authorization version bumps once per statement. A direct membership table gets permdock_authz_version_insert, _update and _delete statement triggers with transition tables in place of the row trigger permdock_authz_version, and the version table broadcasts from two statement triggers. A bulk insert of 100 rows for one user bumps that user once and sends one broadcast. Source tables that read their user through another table keep their row triggers.

  • The claims-first helpers read auth.jwt() once per call: permdock_token_current() and the memberships claim rows parse the token one time instead of three to four times. permdock generate --only rls rewrites the helper files; no data migration is needed.

  • The generated helpers read a declared role's grant keys through one function, permdock_role_grant_keys(scope, role), where each body joined role_permissions itself. permdock generate --only rls rewrites the helpers file, and the decisions are unchanged; no data migration is needed. Run permdock generate and apply the new migration; the function is created with the helpers.

  • The generated helpers start with -- permdock helpers (…) sha-256:<digest>, the digest of the helper text after that line, and doctor PD115 warns when the newest migration that holds the helpers carries a different digest from the schema file. permdock generate prints seeds: +N rows, -M rows against the newest seeds migration when a new one is due. permdock generate --only rls rewrites the helpers file once, for the header line only; the function bodies are unchanged and no data migration is needed.

  • The hook writes permdock_subject(p_tenant text), the caller's subject_for record for one tenant or null, and rls generate on Supabase writes permdock_bootstrap_permissions(p_tenant text default null), the caller's keys as better-supabase's compact bootstrap wire; authenticated may execute both. permdock supabase inspect adds fixtureRoles to the manifest: the roles the defineSeeds fixtures give a member, or every root-scope and global role.

  • The instance cache serialises a deeply frozen claims object once instead of on every request, and supabaseClaims() checks a frozen claims object once. An object that is not frozen is still serialised and checked on each call, so a changed object never reuses an old key. No generated SQL changes.

  • The token hook writes the active tenant claim whenever the user holds a membership in that tenant, also when the budget left it out of memberships, and counts user_role, the tenant claim and the custom-role version in the budget. With 12 to 500 memberships and 1 to 20 roles each, the default 1024-byte budget gives a whole token of at most 2,154 characters. The instanceCache maxAgeMs default is 30,000 ms, as the code always had; the docs said 5,000.

  • The token hook's active tenant source no longer depends on run order. A better-supabase.config.* that throws while loading, for example because it reads a permdock.manifest.json or catalog that permdock generate has not written yet, was treated as absent, so the first run wrote the hook against app_metadata.active_<first scope> and the next against app_metadata.tenant_id. It now counts as a better-supabase config that sets no claim, and the CLI prints a [better_supabase_config] warning with the load error.

  • When rls.split has no policies part, no table policy is written. The CLI prints one line naming the skipped part.

  • With rls.memo, permitted_<resource>_rows(p_permission) and its p_tenant form keep their ids in the same transaction-local memo as permitted_<scope>_ids, keyed and invalidated the same way, so the policies that read a row set in one statement share one evaluation instead of evaluating it once per reference. The resource table and the tables the set reads get the memo generation trigger. A set above 10,000 ids is not stored. The answers do not change.

  • With rls.seeds: 'view', the memo triggers skip the role_permissions view. They stay on the membership, suspension, custom-role and roles tables.

  • authorizationProvider writes functions.subject as permdock.permdock_subject, the schema.function name better-supabase calls with (). It wrote the full call before, so better-supabase 0.58.3 and later generated permdock.permdock_subject()() in bootstrap_app, which failed on every call.

  • custom_role_permissions and custom_role_includes get a unique … nulls not distinct index named *_nnd_key in place of the coalesce(...) expression index (Postgres 15 or later; pg-delta drops the old *_key index, a migration project drops it once; on conflict (coalesce(...)) in app SQL becomes on conflict do nothing or the column list). The approval store's pending index is partial (expires_at where status = 'pending', named *_pending_expires). A membership source that reads its user through another table bumps the authorization version from statement triggers with transition tables, so a bulk write bumps each user once.

  • definePermDock(...).next() from permdock/better-supabase adds getSnapshot(source, { tenant, include?, omitAssignable?, omitStatic? }), which builds one tenant's snapshot listing only that tenant's memberships: on the CentraKit-shaped admin with omitStatic it stays at 4,832 B for 1, 50 and 150 memberships, where the default snapshot grows to 7,322 B and 12,472 B. readSubjectRecord keeps a record's tenant, so a bootstrap subject read for one tenant seeds the subject cache under that tenant and never replaces the all-tenants record.

  • defineSeeds is imported from permdock/seeds, a new entry, so no runtime bundle carries it. Its data is emitted by the RLS plugin: default roles become an idempotent role_permissions migration, and fixtures become supabase/seeds/permdock.sql. permdock/testing adds memorySources and applySeeds. Doctor PD097 fails when fixture data is in a migration or schema file, and prints the [db.seed] sql_paths line to add. PermDock does not edit config.toml.

  • mayUse and mayUseMany read the instance's expanded snapshot without the wire compaction and the type-level table, so an MCP tools/list or tool call with 150 memberships of 20 roles over 300 tools takes 24 ms instead of 290 ms. The permdock/better-supabase authorizer() serialises a claims object once per request scope instead of once per check; the memo key is unchanged.

  • permdock <name> runs a PermDockPlugin.commands entry that has a run function when no built-in command has that name. The constants kind exports planNames and PlanName. Zod and Valibot row schemas end in satisfies against the types.ts row type, and an optional row field is typed field?: T | undefined; the generated validators import ./types.ts, so generate constants with them.

  • permdock codemod 0.26 names each rls.actions entry it drops because it repeats the inferred command, as rls.actions approve: "update" → inferred, instead of one rls.actions → "" line that read like a no-op. A file whose text a codemod leaves unchanged is no longer reported as changed.

  • permdock codemod 0.26 renames permitted_<resource>_row( to can_<resource>(, removes ::text around a helper call, deletes own_subject(), and moves { tableOf } onto the owner's also list.

    It also drops rls.actions entries that repeat the inferred command (remove: "none" stays) and reports roleThrough, blocks.permissions.disabled and a canAssign that names permdock_can_assign_any in better-supabase.config.* as follow-ups, not deletions: the provider supplies them only for a matching role source, under blocks.permissions.model: "provider" and for its own tenant scope, so PD094 decides which values to delete. A removed generate command keeps each flag permdock generate does not take, such as --out, and reports it as a follow-up.

  • permdock doctor PD079 reports a blocks.<name>.permissions key that better-supabase 0.58 renamed (view, viewAll, viewSensitive, edit, admin) as its own error, naming the new key and better-supabase codemod naming. Before, better-supabase's former_permission_key refusal showed as a missing modulePermissionKeys export.

  • permdock doctor adds PD103 to PD111: a PermDock helper called per row in a policy, two permissive policies on one command, an unindexed follows, via or walk column, a ::text cast on a key, an unsargable custom-role probe, permitted_*_rows(p) without a tenant, rls.customRoles in jwt mode (error), an access token over 4,096 characters (with --db-url-stdin) and an optional limit on a list endpoint. --only performance runs them. permdock rls verify --advisors also runs supabase db advisors --type performance and maps multiple_permissive_policies to PD104 and unindexed_foreign_keys to PD105.

  • permdock doctor reports PD112 as a warning when the snapshot of the role with the most grants is over 65,536 bytes of JSON, and names the largest part. --only snapshot runs it alone; the Next.js adapter page explains how to measure with permdock snapshot size. No generated SQL changes.

  • permdock doctor reports PD114 for rls.authorize: "jwt" with a token hook: the helpers read only the memberships the hook budget keeps. With --db-url-stdin it is an error for a sample user whose token is truncated. No generated SQL changes; use rls.authorize: "database", which reads the tables for a truncated token.

  • permdock generate --dry-run and --check print one row per changed file with its byte delta, and --json files carry bytes and delta. The hook budget measure in permdock.manifest.json now counts user_role, the active tenant claim and 20 bytes for custom_roles_ver, which the SQL already counted. permdock supabase help names permdock generate --only supabaseHook, and PermDockProvider no longer passes omitAssignable to the client provider. No generated SQL changes and no data migration; permdock generate --only rls rewrites nothing.

  • permdock generate --watch generates again when a policy, config or plugin input changes. Each cycle loads the policy in a new worker and prints one receipt. --json prints one JSON line per cycle. Ctrl-C exits 130.

  • permdock generate writes membership indexes as (user, scope) include (role) where disabled_at is null, and under pg-delta an existing schema directory always gets indexes.sql. Memoised permitted_<scope>_ids helpers carry rows 10 for the planner, and the defaults seed migration sets a 5 s lock_timeout and 30 s statement_timeout. permdock doctor adds PD098, a database URL on the transaction pooler (port 6543), and PD099, a hand-written update policy on a table with no select policy.

  • permdock generate writes typed modules to src/permdock/ with one file per kind and no barrel: constants.ts, types.ts, sql.ts (server-only), zod.ts, valibot.ts, arktype.ts, json-schema.json, standard-schema.ts, factories.ts, messages.json, react.ts, vue.ts, svelte.ts, solid.ts. Every name is one export per unit (orgQuotesTopic, quoteFilesPath, permittedOrganizationIds, projectFactory), so a bundler drops what a page does not import, and every schema constructor carries /* @__PURE__ */. gen.zod.specifier: "zod/mini" writes the functional Zod API, gen.fields replaces gen.fieldMeta and writes fields.ts, and permdock/testing adds sequence, resetFactories, idOf, factoryUuid and factoryText. Every module starts with a header naming the plugin version, the policy and a model digest. permdock codemod 0.26 rewrites imports of the old files and gen.fieldMeta.

    OldNew
    permdock.generated.tsconstants.ts, types.ts, sql.ts
    permdock.zod.ts, permdock.valibot.ts, permdock.arktype.tszod.ts, valibot.ts, arktype.ts
    permdock.schemas.ts, permdock.schemas.jsonstandard-schema.ts, json-schema.json
    permdock.factories.ts, permdock.react.ts, permdock.svelte-stores.tsfactories.ts, react.ts, svelte.ts
    scopes, rolesscopeNames, roleNames
    topics.<name>, paths.<name><name>Topic, <name>Path
    sqlNames.*one export per helper in sql.ts, <resource>Table
    factories.<resource>, factories.subject<resource>Factory, subjectFactory
    AppVocabulary, AppScope, AppRolesOptionsVocabulary, ScopeName, RolesOptions
    gen.fieldMeta, <resource>Fields inside each validator filegen.fields, fields.ts
    gen.out default src/generatedsrc/permdock
  • permdock openapi annotate --doc <file> writes the operations map from an OpenAPI document: operations with operationId, operationGroups by first tag or path segment, and with --tenant-path <param> operationTenants. Each key is checked against --permissions; unknown, duplicate or missing keys exit 1 and write nothing.

  • permdock openapi annotate --routes reads @permission, @permissionCheck and @oauthScopes from route handlers and writes the operations map. operationPermissionsFromOpenApi reads x-authorization and x-oauth-scopes; emission still writes x-permdock-* and security. permdock generate --only openapi emits the map when the plugin sets routes.

  • permdock powersync generate widens the junction of blockMembershipSource({ roles: "many" }) to every member of the caller's organisations, whatever the table is called, and no longer widens a plain junction named membership_roles. The caller's and the listed member's membership both keep the source's disabledAt column. PD102 warns when sync-config.yaml still filters that junction with <table>.user_id = auth.user_id().

  • permdock rls verify --advisors --grant-calls --db-url-stdin also lists the executions of the statements that name each permission key, read from pg_stat_statements, and adds grantCalls to the JSON. It only reads. permdock generate --only rls rewrites nothing and no data migration is needed.

  • permdock supabase inspect builds the manifest of an rls.authorize: 'database' project without supabase.hook from its rls.memberships tables when it sets no rls.membershipSources. It failed with "supabase.hook.memberships needs at least one … source", and doctor PD094 skipped such a project.

  • permdock supabase inspect lists permdock_approver_for_ids and permdock_managed_user_ids in permdock.manifest.json, so authorizationProvider fills approverFor and managedUsers from a generated manifest. A rls.approvals.managers table without a tenant column leaves managedUsers unset, because better-supabase calls it with {tenant}.

  • permdock.permittedScopeIds(permission, { tenant }) lists the scope instances inside one tenant where the subject holds a permission, permdock.mayUseMany(permissions) answers a tool list from one snapshot read, and permdock.filterIds(permission, ids) keeps the ids that name a scope instance the subject holds the permission on, without loading rows. None of them is a decision.

  • permdock.where(permission, { tenant }) compiles for that tenant's memberships instead of the active tenant's, and the result's subject carries the tenant, so toWhere for Drizzle, Kysely and Prisma compiles memberOf for it. A tenant the subject does not hold reaches no row.

  • permdock/better-supabase exports definePermDock. It owns the version, instance and subject caches, loads client() on first use, and adds .server, .fromClient, .authorizer and .next. It takes the permdock/supabase subject and api options, and createPermDock(definition) from permdock/supabase/middleware accepts it and reads the same caches. PD100 reports a source file that imports definePermDock from permdock/supabase while a better-supabase config exists. permdock/app still has no .next or .authorizer.

  • permdock/eve accepts Eve's approval response decision deny. A cancel decision from an earlier Eve release still rejects the stored request. EvePrincipal.attributes is Eve's map of strings and string arrays.

  • permdock/jwt caps the JWKS cache at 600 seconds for a Supabase issuer, and joseTokenVerifier returns a JoseTokenVerifier with purgeKeys(). supabase.hook.claims cannot name jti, nbf, acr, act, client_id, scope or custom_roles_ver. Doctor adds PD113, a warning for source that reads the legacy HS256 secret, and PD110 and permdock claims size measure a token with OAuth-sized user_metadata, a long email and a client_id. No generated SQL changes: permdock generate --only rls rewrites nothing and no data migration is needed.

  • permdock/next taints its options and each instance when React exposes experimental_taintObjectReference, and createNextConfig() sets experimental.taint. getSnapshot({ context }) and <PermDockProvider context> keep only the named subject.context keys. evaluator="lazy" on the Next provider renders the lazy-evaluator provider. getSnapshot warns once in development under 30 seconds as well as under 300, and an uncached PermDockProvider warns once. permdock/react adds onlineRefresh() for useRefreshOn.

  • permdock/next writes one snapshot copy to the Flight stream for nested PermDockProviders with equal options: PermDockProvider and getSnapshot share one memoised promise per request. In development one warning reports an equal snapshot passed as two separate snapshot promises.

  • permdock/react/lazy and the evaluator: "lazy" provider of permdock/next no longer load SHA-256 or expand the snapshot before the evaluator arrives: the first chunk of PermDockProvider plus usePermission falls from 15,301 B to 13,840 B gzipped. A check without a row still answers from the snapshot's typeLevel, and the evaluator loads on the first check that needs it.

  • permdock/supabase exports definePermDock and subjectFromSupabaseClient, and permdock/supabase/middleware's createPermDock accepts that definition with subject optional. permdock/cli/plugins/supabase adds supabase(), which writes the RLS SQL, the hook SQL and permdock.manifest.json; it conflicts with rls() and supabaseHook().

  • permdock/testing adds memoryPostgrestSources and rolePersonas, which read defineSeeds fixtures without a database. permdock rls verify --kind pgtap --personas roles writes one pgTAP persona per role the fixtures hold. CASL and Casbin imports emit defineSeeds defaults with the policy.

  • permitted_<resource>_match(p_row, p_permission) is the stable row predicate. permitted_<resource>_rows, its id-list form and both permitted_<resource>_row forms call it. The jsonb term map inside the row helper is gone. permitted_<resource>_rows keeps a leading tenant predicate for a root-scope key. A relation-id helper keeps its answer until the memo generation bumps, and the row match calls it once per statement.

  • permitted_<resource>_rows(p_permission) states each permission's arm in the set query for closure and link-walk resources, so its sub-selects run once per statement instead of once per row through permitted_<resource>_match. A 5,500-row file_nodes folder page that took 57 s now takes tens of milliseconds. permdock doctor PD103 reports a policy that calls a permitted_<resource>_rows('key') from an older release, whose body has no arm for the key. Regenerate with permdock rls generate.

  • permitted_<resource>_rows carries an arm that reads only the row inline, so its permitted_<scope>_ids calls run once per statement and not once per row. The tenant prefilter applies with custom roles and levels. A custom role is probed once per membership, and permitted_<scope>_ids reads its keys once per distinct set of entries. With rls.seeds: 'view', the helpers read grant keys from permdock_role_keys(scope, role). The token hook reads the roles, memberships, teams and authz_ver in one statement, and the budget counts roles, memberships, team_ids, attrs and authz_ver: a supabase inspect manifest marks roles and authz_ver as budget claims, and budget.measure lists them. Helper names and signatures do not change, so better-supabase 0.53 works as before.

  • permitted_<scope>_users(p_permission, p_id) over an rls.memberships table is one query: it reads the grant keys of the instance's membership rows and of the global-role holders, and applies the allow and deny keys of p_permission once, instead of calling permitted_<scope>_ids_by_permission_for and permdock_has_permission_for per candidate. The answer is unchanged, including denies, custom roles, expiry and suspension. On PGlite with 200 organizations, 30 multi-tenant admins and 370 holders (tests/integration/bench/permitted-users.test.ts) it runs in 3 ms instead of 46 ms. Scopes whose memberships come from sources keep the per-candidate form; run permdock generate to rewrite the helper.

  • postgrestSources(client, { tenantScoped: true }) reads the memberships of the instance's tenant through subject_for(p_user, p_tenant) instead of every tenant's, and without a tenant it reads none. SubjectRecord.tenant and a fourth tenant argument on SubjectCache.record keep one cache entry per user and tenant, and postgrestFixture takes tenantSubjects. permdock generate rewrites no files and no data migration is needed.

  • powersync.memberLevel.<resource> ({ table, column }, type PowerSyncMemberLevel) narrows a generated PowerSync stream by the member's level: a membership column holding own, team, all or null syncs the rows of the resource's own or team level, or the whole tenant, instead of every row of the tenant on each device.

  • rls generate --split writes the follows part whenever rls.tables.<resource>.follows is set, to <schemaDir>/permdock/follows.sql under pg-delta and to {part} otherwise, with or without the policies part. The policies part no longer holds the child-table policies. PD101 warns when a schema file defines a permissive policy on a follows child table.

  • rls generate compiles each stored custom role into permdock.custom_role_compiled from statement triggers, and the policies, subject_for and the probe read one indexed row per held role instead of calling permdock_custom_keys. A custom-role edit bumps permdock.custom_role_version once per tenant, the hook writes the active tenant's version as custom_roles_ver, and custom_roles_version_for(p_tenant) reads it. Run select permdock.permdock_recompile_custom_roles() once after upgrading: a role stored before has no compiled row and grants nothing until then. The custom-role writers match the stored role by = instead of is not distinct from, so a save no longer scans custom_role_permissions.

  • rls generate grants supabase_auth_admin execute on every member_<scope>_ids_for it writes, next to the function, and the manifest lists the role. better-supabase's memberIdsFor, which authorizationProvider fills whenever the manifest lists the helper, now has the grant it declares without supabase.hook.claims or supabase.hook.teams, and in rls.authorize: 'database' mode without a hook. A single migration file wraps the grant in a do block that runs only where the role exists; a --split schema file grants it outright. Run permdock generate.

  • rls generate writes five set helpers (#302): permitted_<scope>_id_array(p_grant), permdock_<root scope>_has(p_grant, p_tenant), and for each rls.rowHelpers resource permitted_<resource>_rows(p_permission, p_tenant), permitted_<resource>_ids_in(p_permission, p_ids) and permitted_<resource>_count(p_permission, p_tenant, p_cap). The tenant and count forms need a memberOf relation to the root scope.

  • rls generate writes the scope-key predicate as "orgId" = any(array(select permdock.permitted_organization_ids('k'))) instead of "orgId" in (select …), so Postgres reads the array once and uses the tenant index instead of a hashed SubPlan over a Seq Scan; rls import reads both forms. The custom-role probe compares tenant_id uncast and the custom-role tables gain custom_role_permissions_probe_idx and custom_role_includes_probe_idx. The closure refresh casts its id array to the id type, not the id column. The helper memo key uses the session_id claim instead of an md5 of the whole token. subject_for starts from the roles a user holds instead of unioning both custom-role tables. Re-run permdock generate and apply the diff.

    rls.tables.<resource>.follows and a permitted_<resource>_rows arm read the parent rows of the caller's tenants through the tenant index when every allow of the permission is a root-scope role; other permissions keep can_<resource>(parent, …). The upward manager walk and the delegation policies cast the parameter, not the column. rls generate indexes the follows foreign keys, the walk parent and user columns, the manager table's user and manager columns with the tenant, and approval_delegations (delegator, "until"). The role-key version bump runs as statement triggers over transition tables and skips rows whose key and ids did not change. Member, approval-set and walk helpers carry cost, rows and parallel safe.

  • rls.customRoleWrites.roles writes its cascade trigger as create or replace trigger. member_team_ids_for is granted to supabase_auth_admin only when supabase.hook.security is invoker, which is the default; a definer hook runs it as its owner. A scope with no memberships table returns two columns from the grant-set helpers, so a team scope without a team table no longer fails to create permitted_<scope>_permission_keys.

  • rls.memo defaults to 'none' in database mode on Supabase: the helpers write no set_config memo and are language sql stable parallel safe, and every setof helper carries rows 10. Set rls.memo: 'permdock' to keep the transaction-local memo. Breaking for a project that counted on the memo: regenerate and apply the helpers.

  • rls.staticGrants: 'ref' leaves the role_permissions rows out of the generated SQL and pins the sha-256: hash of a policy-bundle v1 document. permdock policy bundle writes the bundle (--kind sql writes the statement that loads it into <schema>.permdock_policy_bundle). A missing or mismatched bundle denies every static grant. permdock generate --only rls rewrites the helpers part when you switch to 'ref' and the pinned hash after each grant change, and the bundle load is a data migration you apply with it. The default 'inline' keeps today's SQL byte for byte.

  • rls.tables.<resource>.follows policies always match the foreign key against one set of parent rows read once per statement, never exists (… can_<resource>(p, …)) per child row: a permission held through root-scope roles reads permitted_<resource>_rows(p, t) over the caller's tenants, a global role adds permitted_<resource>_rows(p) only for a caller who holds one of its grant keys, and any other grantee reads permitted_<resource>_rows(p). Run permdock generate --only rls to rewrite the follows part; no data migration is needed.

  • rls.tables.<resource>.follows writes select, insert, update and delete policies on each child table. They call can_<resource> on the parent row. also names resources that share the table and get no policies of their own. walk: "recursive" writes permdock_<resource>_chain(), and with rls.approvals.delegations the chain also starts from an active cover.

  • rls.treeValues now picks the self-parented resource when several resources map to the same table, so a file resource listed before a self-parented fileNode on public.file_nodes no longer fails with "must be a self-parented folder". Two self-parented resources on one table fail with an error that names both.

  • rls.treeValues writes permdock_tree_<resource>() for each named folder. The helper walks that table only, and only rows in the caller's tenants.

  • snapshot({ omitStatic: true }) and snapshotFor(..., { omitStatic: true }) replace the grants of declared roles with static references, a new optional field of the v1 snapshot: { held: [role, membershipIndex | null][], digests: Record<role, "sha-256:…"> }. permdock generate with gen.kinds: ["bundle"] writes bundle.ts, a "use client" module exporting clientBundle, and the providers of permdock/react, vue, svelte and solid, createClientStore and the permdock/next provider take it as bundle. A client without a bundle, or with a stale digest, denies what the roles granted. meta.clientBundle: false keeps a role inline. permdock snapshot size --omit-static reports the effect. On the CentraKit-shaped fixture the snapshot falls from 34,937 B to 5,661 B.

    Behaviour change: a snapshot now ships only the active tenant's grants by default, as the docs already said. A subject with several memberships and an active tenant used to receive every membership's grants; pass tenants: "all" for the old output. grantedPermissions still reads every tenant. A request with no active tenant is unchanged.

    PermDock-Cloud reads the snapshot: it must ignore static or resolve it against the bundle of the policy it holds.

  • supabase.hook.membershipsClaim: false keeps the token hook's memberships claim empty and sets memberships_truncated for a member, so readers take the subject from the database. At 500 memberships the claims stay at 588 bytes instead of 28.8 KB unbudgeted (scripts/hook-bench.json). It needs rls.authorize: 'database'; generate exits 2 in jwt mode.

0.26.0

permdock generate replaces the hand edits these apps carried:

  • Deleted view triggers. Triggers stay on the six real tables. rls.seeds: "view" does not put a trigger on the role_permissions view.
  • The membership_roles widen. The stream is not filtered to user_id = auth.user_id(). The caller's own membership must be active, and the id uses every through.on pair.
  • The dropped permdock_authz_version stream. The table stays. Generate does not stream it.
  • The deleted scopeChallenge for a subject token. A token with no scope claim and no authorization_details is the user. challengeFor returns no insufficient_scope when the call decides on the subject.
  • The custom-role assignable trigger. The sync guard skips when the caller is signed out or permdock.sync is on. pg_trigger_depth() is not the guard.
  • The platform-role before-delete trigger. The provider supplies platformRoles from rls.roles, including permdock_can_assign_any when the manifest lists it.
  • The duplicated membership block and ::text casts. permdock codemod 0.26 removes ::text around a helper call and deletes a second copy of the membership block the generator now writes.
  • permdock/testing memoryPostgrestSources and rolePersonas answer membership and persona reads from defineSeeds fixtures. permdock rls verify --kind pgtap --personas roles writes one persona per role those fixtures hold.
  • CASL and Casbin imports emit defineSeeds defaults beside the policy.
  • Adoption fixtures cover a TypeScript-only app, plain Postgres, Supabase, better-supabase, and a third-party plugin that calls only definePlugin.

0.25.1 (2026-11-06)

  • permdock rls generate with rls.seeds: "view" no longer writes the memo generation triggers on the role_permissions view. Postgres refuses after triggers on a view, so the generated helpers failed to apply. The view's rows change only with a migration, so the transaction-local memo never needs that bump.

0.25.0 (2026-11-05)

  • Breaking: permdock rls generate writes each *_read_only_actors policy as (select permdock_actor_may_write()) instead of inlining the act expression; regenerate and apply the output. permdock doctor PD090 also reads supabase/schemas and rls.out and flags a hand-written policy that inlines the 0.24 guard.
  • The permdock-wire skill passes the unawaited loader promise to the permdock/next PermDockProvider as snapshot, not snapshotPromise, and says a layout fetches while pages, loaders and actions decide.
  • Snapshot is now one compact form: each distinct grant condition is stored once in conditions and a grant is { permission, cond } (an admin snapshot of 1,790 grants drops from 467,592 to 58,412 bytes). Breaking: code that reads snapshot().grants[i].effect or .where directly must call expandSnapshot; the { v: 1 } option, SnapshotInput, CompactSnapshot and the flat public Snapshot are removed, and parseSnapshot rejects v: 2. schemas/snapshot-v1.json describes the compact form. Reissue PermDock Cloud snapshot consumers that read the wire format before upgrading.
  • authorizationHooks installs delegation only when you pass delegation: true or delegation: { permissions }, and authorizationHooks({ policy }) returns { apiVersion, name, sessionTags }. Breaking: an app that relied on the implicit delegation hook adds delegation: true.
  • definePermDock takes sources: (client) => { memberships?, customRoles?, subjects? } and adds app.forClient(client), a definition bound to that client with its sources cached in a WeakMap. forClient throws a TypeError that names sources when the option is missing.
  • operationPermissionsFromOpenApi reads OAuth scopes from security and the new x-permdock-enforcement: "kernel" | "handler", and exposes kernel and handler maps. Behaviour change: an operation with OAuth scopes and no x-permdock-permissions becomes a scope-only entry where it used to be skipped as no-permission, an operation's security scopes now reach oauthScopes, and security: [] is skipped with the new cause public. permdock doctor PD091 gains openapi.enforcement: "kernel".
  • permdock doctor PD089 also reads create function bodies and the = any(array(select permitted_*_rows(…))) form, and recommends permitted_<resource>_row(id, permission). A measurement on 5,000 rows in 10 tenants shows the generated row helpers already read permitted_<scope>_ids_by_permission once per statement, so the generated SQL is unchanged; tests/integration/bench/row-helpers-hot-path.test.ts records the numbers.
  • permdock doctor PD092 reads only the snapshots: section of pnpm-lock.yaml, so a single copy of permdock no longer reports a second copy without peers from the packages: section.

0.24.0 (2026-11-04)

  • Breaking: permdock/better-supabase requires better-supabase 0.53.0 or later (>=0.53.0). The approvals and share-link bridges call the object-input block clients, and a policy step with escalateAfter throws. Upgrade better-supabase, run better-supabase codemod 0.53 and upgrade, then update permdock.
  • permdock/react ships the snapshot evaluator in its entry again, so a provider with a synchronous snapshot answers every check on the first render and in a server render, as before 0.23.0: in 0.23.0, usePermission(permission, data), useDecision, useGate, usePermDock, useFilter and <Protected> with row data suspended while the evaluator chunk loaded, even without suspend. permdock/next renders this provider. The on-demand evaluator moves to the new opt-in entry permdock/react/lazy, with the same exports: its hooks suspend until the chunk arrives and need a Suspense boundary. saas client react measures 21,184 B gzip; permdock/react/lazy measures 14,690 B initial and 21,708 B in total. The lazy entry's hooks also no longer throw React's conditional use() error when hydration retries after the chunk lands.

0.23.0 (2026-11-04)

  • On the supabase dialect in database mode, permdock_has(p_grant) memoizes its answer per statement in permdock.m.global.k<bucket>, keyed and invalidated like permitted_<scope>_ids. A policy site and every permdock_has_permission grant key now read the memo, so the global role and custom role lookup runs once per grant key per statement instead of once per call. The function becomes volatile plpgsql; permdock_has_for is unchanged. Regenerate the helpers and add the changed function to a migration.
  • authorizationProvider fills better-supabase's memberships[].disabledAt and platformRoles, takes personas and the opt-in subject: true and platformRoles: true, and the hook manifest lists permdock_subject(). permdock doctor reports a hand-written own_subject() as PD093.
  • permdock.grantedPermissions() evaluates the snapshot grants directly instead of building a snapshot instance, so a server bundle that never calls fromSnapshot no longer ships it. permdock/server drops 1.3 KB gzipped and permdock 1.3 KB.
  • permdock/react loads its evaluator on demand: the initial download of PermDockProvider + usePermission drops from 20,263 B to 14,637 B gzip. Breaking: usePermission(permission) without data returns { allowed, status, outcome } and no decision; use the new useDecision(permission, data?) for a Decision. usePermission(permission, data), useDecision, useGate and usePermDock suspend while the evaluator chunk loads. snapshot() adds an optional typeLevel field ({ granted, approval?, endpoint? }), and server entries that call it grow by 0.1 to 1.8 KB gzip.

0.22.1 (2026-11-04)

  • The better-supabase provider's rowsWith template casts better-supabase's text[] candidate ids to the row helpers' id type, so generated block functions such as can_subject no longer fail with 42883 function permitted_<resource>_rows(unknown, text[]) does not exist on uuid ids. permdock supabase inspect records each row helper's idType (from rls.idTypes, else uuid on Supabase and text on Neon) in names.resources, and the provider requires permitted_<resource>_rows(text, <idType>[]). A manifest written before this release has no idType and reads as uuid. When the row helpers take different id types, the template calls the one-argument permitted_<resource>_rows(permission), which answers the same without narrowing to the candidates. The cast is on the candidate array, never on the id column, so its index stays usable. Run permdock supabase inspect --out to record the id types.

0.22.0 (2026-11-04)

  • Add accessOutcome(decision), which reduces a decision to granted, approval-required, anonymous, no-tenant, no-membership or denied; permdock.memberships({ via, scope }); permdock.grantedPermissions({ tenant, scope, id }), which lists the permissions a rowless check grants; and isGlobalPermission(policy, permission).

  • Add postgrestFixture to permdock/testing/fixtures: a Supabase client double that answers subject_for, authz_version_for and members_of from SubjectRecords.

  • Add the SubjectCache extension interface, memorySubjectCache and testSubjectCache, and a subjects option on postgrestSources and permdockFor. postgrestSources().record() reads the cache before subject_for at the authorization version the instance resolved, and refuses to seed a record below a version already seen.

  • Add the permdock/app entry with definePermDock, which replaces defineApp and adds getPermDock, fromClaims, fromApiKey, sources and evict to the policy it returns. permdockFor, authorizer, authorizationHooks, supportPolicy, subscriberPolicy and postgrestSources read memberships, instances, versions and subjects from the definition. Breaking: change import { defineApp } from "permdock" to import { definePermDock } from "permdock/app"; permdock codemod 0.5 lists each import.

    OldNew
    defineApp(policy, options) from permdockdefinePermDock(policy, options) from permdock/app
  • BREAKING: jiti and oxc-parser are optional peers of permdock instead of dependencies. permdock doctor, scan, collect and codemod need oxc-parser, and a policy module Node cannot import natively needs jiti; a missing one fails with an install line. Run pnpm add -D oxc-parser jiti in a project that uses the CLI. The client store key is now Symbol.for("permdock.store"), and permdock doctor warns with PD092 when pnpm-lock.yaml resolves one permdock version with two peer sets.

  • Detect better-supabase through betterSupabase.config in permdock.config.ts or through a better-supabase dependency in the nearest package.json or a workspace package, not only through a better-supabase.config.* found upward from the config. The generated hook then broadcasts on better_supabase:authz, so a project whose better-supabase config sits in another package no longer gets permdock:authz. Doctor PD087 warns about a pinned topic better-supabase does not listen on and about a dependency whose config is not found.

  • Generated permission and row helpers carry cost 1000, and parallel safe where they use no set_config memo. rls.memo: 'better-supabase' keeps the permdock.m.* memo in better_supabase.memo_get and memo_set; the default 'permdock' is unchanged.

  • Keep the policy vocabulary in permdock/better-supabase: PermDockResolver, AuthorizerOptions, AuthorizationHooksOptions, SupportPolicyOptions, SubscriberPolicyOptions and AccessReviewApplierOptions take a V that authorizer, authorizationHooks, supportPolicy, subscriberPolicy and accessReviewApplier infer from policy. A permdockFor of another vocabulary next to policy is now a type error.

  • Row helpers use the resource's id type: permitted_<resource>_rows, _rows_for and the new permitted_<resource>_row(p_id, permission) take and return uuid on the supabase dialect and text on neon; set rls.idTypes per resource. This changes the generated signatures: regenerate, drop the old text[] overloads, and remove ::text casts around calls (doctor PD088). Root-scope keys start with a tenant prefilter, and PD089 flags id in (select permitted_*_rows(…)) where one id is known.

  • The relationships page documents manager chains: a self-parented employee with a { principal } relation walked through: 'parent' compiles to the closure subquery, so no RlsTableVia.recursive option is added.

  • authorizationHooks takes claims as an optional option. Without it the hooks omit automation, support and tickets, and passing service, support or tickets without claims is a type error.

  • memoryVersionCache and instanceCache default to 30,000 ms (maxStaleMs is optional; the 60 s ceiling stays), so a removed member keeps read access for up to 30 s by default. memoryVersionCache({ shared }) takes a VersionStore, betterSupabaseVersionCache(cache) in permdock/better-supabase wraps better-supabase's createVersionCache, and authorizer and permdockFor accept either cache. permdock/testing gains testVersionStore.

  • operationPermissions(...) from permdock/openapi gains entries(), operationPermissionsFromOpenApi gains onSkip(operation, cause), and testOperationCoverage in permdock/testing fails on a tenant-path operation with no entry. permdock doctor runs the same check as PD091 from the new openapi.operations, openapi.tenantPaths and openapi.base config keys.

  • permdock rls generate --helpers-only writes the rls.readOnlyActors policies as plain create policy statements instead of to_regclass guarded do blocks, so apply the helpers after the migrations that create the tables. Doctor PD090 flags a hand-written policy that repeats the generated permdock_actor_may_write() guard.

  • permdock rls generate maps a compound action whose first word is a default verb (updateStatus, list_archived) to that verb's SQL command, and rls explain lists each inferred action. rls.tables.<resource>: { tableOf: '<owner>' } stores a resource in its owner's table; the owner writes the policies. doctor.sharedTables is removed: declare the shared resource with tableOf, which PD075 skips.

    OldNew
    doctor.sharedTables: ['public.documents']rls.tables.<resource>: { tableOf: '<owner>' } on each resource that shares the table
  • permdock supabase hook generate creates the hook schema before membership_entries_for and global_roles_for, so the file applies to a database where the schema does not exist yet.

  • permdock supabase hook generate writes membership_entries_for(p_user) and global_roles_for(p_user) in the hook schema. The hook and subject_for call them instead of repeating the membership union and the global-roles aggregate. Re-run hook generate and apply the migration; the token and subject_for output are unchanged.

  • permitted_<resource>_row is faster in policies. A policy calls it once per row and Postgres cannot inline a security definer function, so every call used to rerun the grant lookups of the permission's arm. On Supabase with database authorization the row helper now runs those row-independent lookups once per statement and keeps their answers in one transaction-local setting, permdock.m.<resource>.r<bucket>, keyed like the scope memo by user, permission, authz_ver, memo generation, statement and token. Later calls in the statement check only the row's columns, so the cost per row no longer grows with the number of grants. The row-valued and the per-id forms both become language plpgsql volatile with the same signatures and grants, and share the memo. Answers are unchanged, insert ... returning still sees the new row, and the jwt mode and the guc and neon dialects keep the language sql form.

    The memo generation now also bumps on writes to the membership source tables and the global roles table the helpers read, and, with row helpers, to the tables the graph relation helpers read. Each gets a statement-level permdock_memo_generation trigger and a TRUNCATE trigger, so a function that adds a membership or a share and then reads in the same statement sees the change, with or without the token hook's version triggers.

  • protectAction from permdock/next takes args, a tuple of Standard Schemas for leading arguments, and the applied wrapper takes { after, result }. tenant and data receive (input, args), and the handler context gains args.

  • supabase.hook also emits <helpers schema>.permdock_subject(), which returns the signed-in user's subject_for record to authenticated and null otherwise. authorizer reads better-supabase's runtime.seed and, when it names the token's user at the live version, seeds the subjects cache so the instance makes no subject_for call. permdockFor results carry subject.

0.21.0 (2026-11-04)

  • Add omitAssignable to permdock.snapshot, snapshotFor, getSnapshot and the Next.js provider. It leaves assignable out of the snapshot, which repeats every assignable role and permission per tenant and made a tenants: "all" snapshot for a member of ten organisations about 270 KB larger. Checks are unchanged; assignableRoles and assignablePermissions return nothing on a snapshot built this way.

0.20.1 (2026-11-03)

  • permdock rls generate emits cheaper helpers. A helper reads the memberships already in the token when the token's authz_ver matches the stored version, and falls back to the membership tables otherwise, so a stale token never grants more than the tables. The token scope map is an immutable function the planner evaluates once. Suspension checks fold into the membership joins instead of running as correlated subselects. On Supabase with database authorization, permitted ids are memoized in transaction-local settings under at most 1024 keys per scope, and the stored value carries a discriminator for the grant, user, token version, memo generation and statement. A helper reuses the value only while the discriminator matches, so the key set stays bounded on a pooled backend and a permission, custom-role, role rename or suspension write, including TRUNCATE, recomputes inside the same statement. The invalidation triggers run once per statement. The memoized helpers are volatile because the memo write is volatile. Behaviour and grants are unchanged.

    Memberships written with row triggers off (session_replication_role = replica, disabled triggers or TRUNCATE) leave the stored authz_ver unchanged, so tokens minted before keep their memberships until they expire. The memo trusts the same session GUC store as request.jwt.claims: any role able to call set_config can forge both.

0.20.0 (2026-11-02)

  • Add the sqlFunction set variant: sqlFunction(name, { args, set: { column }, twin }) renders "<column>" in (select <name>(<args without row fields>)), so a set-returning helper runs once per statement instead of once per row. The in-memory evaluator, filter, where, snapshots and --inline-functions still use the twin. rls import reads col in (select fn(...)) and col = any (select fn(...)) back as the same form, and doctor PD086 checks the set column and warns when row-field args would be dropped.

0.19.0 (2026-10-29)

  • Approvals gain approval: { fallback: "confirm" } with approverDirectory on approvalsHandler and resolveApproval, which lets the principal approve while no other eligible approver exists. With rls.approvals.managers, the two-argument permdock_is_approver accepts manager approvers. rls.approvals.tenantPolicies takes table, function, columns and path, and tableApprovalPolicySource takes function. An adopted approvals table's token column carries the @bsb identifier tag.

  • permdock doctor gives every finding a target and an id of <code>:<target>, and accepts findings through doctor.ignore: [{ id, reason }] and --ignore. doctor.waivers: [{ code: "PD017", key, reason }] silences PD017 for one permission key. PD080 and PD081 also accept ||=, if (!x) x = ... and calls passed to a helper named in doctor.cacheHelpers. PD072 stays silent when the schema files, migrations or rls.out create permdock_custom_role_name_guard.

  • permdock powersync generate now joins a composite roles junction (a through with more than one on pair, such as better-supabase roles: "many") on every pair and selects an id for its rows; before, it joined on the first pair, so a member could sync another member's role, and PowerSync dropped the rows for want of an id. powersync verify checks the junction stream for leaks. On the device, readRows matches the junction on every pair and keeps every role; the device manifest's through gains an additive on. Rerun permdock powersync generate.

  • permdock/mcp: a tool registered with permission: null is public, listed and called with no check; leaving permission out still throws. A tool's permission may be a list, with anyOf: true for any-of, and rows(args) checks every row the call touches. The new unscopedTokens: "subject" option decides a token carrying none of the policy's scopes, such as a Supabase session token, on the subject with no scope check and no delegation; the default "deny" refuses it as before. permissionFor may return a list or null.

  • permdockFor from permdock/better-supabase is generic over the policy vocabulary, so its instances keep their typed permissions. The CLI finds better-supabase.config.* from the directory of permdock.config.ts up to the workspace root, so a monorepo app picks up the root config and its broadcast topic defaults to better_supabase:authz.

  • powerSyncSource returns a PowerSyncSnapshotSource with authzVersion(), the user's synced authz_version. nativeRefresh({ powersync: { source } }) reuses it for the foreground catch-up instead of its own query.

  • protect in permdock/orpc, permdock/trpc and the server kernel takes a permission list: every permission by default, one with anyOf: true. The rows option loads many rows in place of data; every row must be granted, a denial reports the first denied row, permdockData holds the rows, and no rows answers 404. openapi.security, openapi.spec and the oRPC permissionOf take or return the list; permissionOf now returns Permission | readonly Permission[] | undefined.

    Wire change: the Problem Details detail of a denial no longer names the subject. "post.delete denied for subject u_123: member (condition)." is now "post.delete denied: member (condition)."; the subject id stays in the error message and the audit event. A client that parsed the subject out of detail reads it from its own session. problemFromDecision ignores its subject argument.

  • rls.split in the config takes the --split parts, and the flag overrides it. permdock supabase inspect, supabase hook generate and doctor PD039 follow the split hook part of rls.out, and PD039 also scans pg-delta's helpers file, so a split or declarative setup no longer reports a missing hook or helper.

  • snapshot({ tenants }) takes a list of tenant ids as well as "all", and drops a tenant without a membership. Client providers take fetchSnapshot({ tenant }), which answers refresh() without a URL. subjectMembershipSource(subject) builds a MembershipSource from a subject's memberships. PermDockProvider with a snapshotPromise renders a settled promise's grants on the server, and hydrating components keep reading the server's view until the store updates.

  • supabase.hook.security: "definer" writes the access-token hook as security definer, grants execute to supabase_auth_admin only and skips the supabase_auth_admin read policies, so the hook reads tables with its owner's rights. The default stays "invoker". permdock doctor --db-url-stdin runs the new PD085, which calls the hook as supabase_auth_admin for each doctor.claims sample and reports a Postgres error such as permission denied for table.

  • supabaseRealtimeRefresh(client, { userId, channel, foreground }) takes an app-owned channel, which it binds without subscribing or removing, and a foreground subscription: in the background it leaves its own channel, and on return it rejoins and calls refresh() once.

0.18.1 (2026-10-29)

  • authorizationProvider({ requestApprovers: true }) writes pg_catalog.split_part in its isApprover template, so better-supabase 0.43, which refuses template calls without a schema, accepts it.

0.18.0 (2026-10-29)

  • Out-of-office covers now reach the approvers of a request's current step. permdock rls generate with rls.approvals.delegations or rls.approvals.managers writes a five-argument permdock_is_approver(p_approvers, p_tenant, p_requester, p_resource, p_request_approvers) that also checks the approvals block step's users, manager and permission, and authorizationProvider({ requestApprovers: true }) passes better-supabase's {approvers} to it for every kind. Set it only with a better-supabase release that fills {approvers}. With managers and delegations, a cover now passes a manager() leaf when the delegator manages the requester; before, a cover never passed one. rls.approvals: { store: false, delegations: true } writes the covers and approver checks without the approval store.

    blockApprovalStore(approvals, { tenantless }) files a request without a tenant tenantless and reads those requests, and resolve now calls the block's approve or reject with decidedBy instead of throwing, so approvalsHandler works over the block. blockApprovalPolicySource(approvals, { platform, permissions, effects }) reads platform policies, turns conditions into a check (before, a conditional policy applied to every call), matches * subject types and actions through an effect or the permission tree (before, such a policy applied to nothing), and takes required: "all" over users. BlockApprovalTenantPolicy.organizationId is string | null and a step's required is number | "all", as in better-supabase 0.41.

    Rerun permdock rls generate and migrate: permdock_cover_approves takes the requester as a fourth argument, and permdock_manages calls the new permdock_manages_for.

  • React Native and servers outside Next.js now load permissions once per authorization version. nativeRefresh from permdock/react-native refreshes the session, PowerSync and the snapshot when the user's authz:<uid> channel fires, and permdock powersync generate streams the user's authz_ver row so powerSyncSource sets snapshot.authzVersion. powersync generate and verify report streams that read token claims as PD084, and a claims-change fixture checks those streams' row sets.

    authorizer and authorizationHooks take permdockFor, and permdockFor(...).sources(versions) lets oRPC, MCP and permdock/next share its instances. createPermDock({ version }) and getPermDock({ version }) in permdock/next take a known authorization version for read-intent instances. instanceCache() caches a custom-role factory's answers per factory and principal. permdock doctor reports a claimsFirst created per call as PD080. rls.approvals.managers makes manager() approvers match in SQL and in authorizationHooks.

0.17.0 (2026-10-29)

  • Breaking: permdock/better-supabase now needs better-supabase 0.39.0 or later; run better-supabase codemod 0.32 for its auth renames (requireTenant, auth.tenant, bsb.claims(), bsb.evictSession()). authorizer reads context.intent, validates source: "input" rows and change pairs, and resumes PermDock-Approval tokens with the new store option; blockMembershipSource takes tables from blockTables(config); the token hook names memberships_truncated as its one truncatedClaim.

  • Breaking: permissions load once per authorization version. getPermDock({ instances: instanceCache() }) and permdockFor reuse an instance until the version moves, and VersionCache.seed and version: { known } skip the version read. Run permdock codemod 0.17 for the membership and approval literals; approval tokens issued before the upgrade no longer resume, because the token's policy input is now source.

    OldNew
    { tenant, roles }, { tenant, team, roles } memberships{ scope: 'tenant', id, roles }, { scope: 'team', id, within: { tenant }, roles }
    approval: { mode: 'any' | 'all' | 'sequential' }approval: { combine }
    approval: { distinct: false }approval: { mode: 'confirm' }; 'authorize' is the default
    ApprovalMode (the stage combinator)ApprovalCombine; ApprovalMode is 'confirm' | 'authorize'
    VersionCache.observeVersionCache.seed(id, version, at?)
    cacheLifeFor(snapshot) capped at the token's expiry{ stale: 300 }; cacheLifeFor(snapshot, { capToToken: true })
    postgrestSources version read falling back to subject_forThrows; doctor PD083 reports a hook file without authz_version_for
    CLI flags and commands renamed in 0.5.0 (flag_renamed, command_moved)unknown_flag, unknown_command; permdock codemod 0.5 still rewrites them

0.16.0 (2026-10-27)

  • rls.rowHelpers now writes permitted_<resource>_rows_for(p_user, p_permission, p_ids text[], p_claims jsonb default '{}') beside the existing _for form, outside the neon dialect. It answers which of the candidate ids p_user may act on with the permission, the same answer permitted_<resource>_rows(p_permission, p_ids) gives when p_user is the caller, so a security definer function serving a request with no signed-in user, such as a share-link calendar feed, can check a few stored rows against the link creator's access without reading the whole table. Like the other _for helpers, execute is revoked from public, anon and authenticated. A call that passes claims as an untyped third argument now matches both forms; cast it ('{...}'::jsonb) or pass p_claims by name. Regenerate the RLS SQL to pick this up.

0.15.0 (2026-10-27)

  • In a project with a better-supabase.config.*, the token hook's default supabase.hook.activeFrom and doctor PD078 now read the claim better-supabase writes: auth.organization.claim (or claims.tenant in a flat config), then rls.tenantClaim, then tenant_id. A project that renames the claim in better-supabase only now gets a hook that reads it; regenerate the hook SQL and manifest together.
  • The onError sink of protectServer in permdock/mcp now receives tenant next to permission and name (McpErrorContext), so a BetterSupabaseOnError from permdock/better-supabase can be passed as is. tenant is what the tenant option resolves for the call, or null.
  • The rls.customRoles.from.sync guard triggers now refuse a signed-in write of an entry PermDock cannot hold, as permdock_replace_custom_role_grants does: 22023 with outside-ceiling, unknown-permission, unknown-level or unknown-role. Before, the guard skipped such an entry and the after-row sync dropped it with a warning, so the legacy table kept a row that granted nothing. Writes without a caller (migrations, jobs, backfills) still drop with a warning. Regenerate the RLS SQL to pick this up.
  • permdock/react-native exports powerSyncSourceCache(db): its source(options) answers the same powerSyncSource for the same manifest and options, so a component that rebuilds its options on every render keeps one source and one set of db.watch subscriptions.

0.14.0 (2026-10-26)

  • Breaking: permdock/better-supabase requires better-supabase 0.29.0 or later. ShareLinkRow takes only subject: { type, id }, so a share-link row with subjectType and subjectId now denies, and authorizationHooks caps an automation run with bsb_permission_cap only. Before upgrading, run better-supabase migrate schema-first if your better-supabase.config.ts has tables or records, then better-supabase upgrade and generate a migration.

  • Cache PowerSync rows per query and coalesce watch bursts. Watch-triggered reads refresh only changed queries, concurrent reads share a refresh, and unchanged data reuses the snapshot. Explicit foreground reads still refresh every query, and membership expiry rebuilds the snapshot on the next read.

  • Check PowerSync followed-row fixtures shaped as { subject, table, row, expected } against parent access and the generated table stream. Reject invalid fixtures and report leaked or missing attachment rows instead of silently leaving followed tables unchecked.

  • Compile PowerSync memberships with disabledAt to IS NULL filters instead of excluding their streams. Honour rls.suspension.memberships.keep in declared grants, membership conditions and custom-role levels; keep expiresAt gaps and stop reporting suspension alone as a PD058 source gap.

  • Default the token hook's active source to app_metadata.<rls.tenantClaim ?? tenant_id> when a readable better-supabase.config.* exports an object. Generation, inspection and PD078 share detection. Explicit sources still win; absent, invalid or unreadable configs keep the plain Supabase app_metadata.active_<first scope> default.

    This changes the default for detected better-supabase projects. To keep the old source, set supabase.hook.activeFrom explicitly before regenerating SQL and the manifest. Regenerate and deploy both together; no wire-format fields change.

  • Document every authorizer option in permdock/better-supabase, including live memberships, the authorization version reader, the shared version cache, intent and error reporting. The example now uses the generated membership source and authzVersion reader together.

  • protectServer in permdock/mcp takes onError(error, { permission, name }), which receives a check that threw: a data loader, decide, an approval input or a subject a list cannot build. The call still refuses as PermDock built it, and a sink that throws is ignored.

0.13.0 (2026-10-26)

  • authorizationProvider({ rowHelpers: true }) fills better-supabase's rowsWith and rowsWithFor templates from the permitted_<resource>_rows helpers that rls.rowHelpers writes, so better-supabase record actions with rows check the rows a caller holds a permission on, as the generated policies decide them. It lists each helper in requires and, when the manifest names none, adds a problem. The option needs better-supabase 0.22 or later and is off by default, so providers for earlier releases are unchanged.

0.12.0 (2026-10-25)

  • rls generate --helpers-only with rls.readOnlyActors now writes the restrictive {table}_{op}_read_only_actors policies for each table rls.tables names, in the output or the helpers part, each skipped when its table does not exist. This changes helpers-only output: regenerate, and drop any hand-written restrictive policy that only calls permdock_actor_may_write() on those tables. A resource without an rls.tables entry still gets the warning.

0.11.0 (2026-10-25)

  • supabaseApprovalStore takes a beforeOpen hook that runs on every create, before the request is stored, with the request. Over an adopted table with rls.approvals.open: 'attach', insert the app's own row holding request.token there instead of wrapping create; a throw fails the open before anything is stored, and a repeated ask runs it again, so ignore a conflict on the token. The read-only actors docs now name the write-unguarded:<table>:<command> finding id that rls verify --introspect --helpers-only reports for a hand-written write policy without permdock_actor_may_write().

0.10.0 (2026-10-25)

  • The Supabase manifest records where the token hook reads the active tenant (hook.activeFrom), and authorizationProvider({ activeTenant }) reports in problems when better-supabase's blocks.permissions.activeTenant writes it elsewhere. permdock doctor reports the same mismatch as PD078 and lists each permission key a configured better-supabase block checks that the catalog lacks as PD079.
  • The betterSupabaseCatalog and betterSupabaseManifest fixtures in permdock/testing/fixtures name the audit key audit.read, as better-supabase's audit block does, instead of audit.view.
  • The better-supabase adapter page shows a calendar or feed URL on a share link with no expiry: subjectFromShareLink resolves the link on every poll, so revoking it empties the feed on the next request.
  • The docs and the permdock-wire skill use better-supabase 0.15's names (bsb, blocks.permissions, blocks.memberships, auth.authorization, requireOrganization), and the better-supabase page lists the 0.13 and 0.14 names next to them. CI tests permdock/better-supabase against better-supabase 0.13.0 and 0.18.0.
  • With rls.readOnlyActors, the approval_delegations insert, update and delete policies that rls.approvals.delegations generates now call permdock_actor_may_write(), so a read-only support or impersonation session can no longer write covers as the user. Run permdock rls generate and migrate. rls verify --introspect also accepts the restrictive <table>_<command>_read_only_actors policies rls generate writes, instead of reporting them as write-unguarded.
  • PermDockProvider from permdock/next takes snapshot, a promise from the app's 'use cache: private' loader around getSnapshot, so a prefetch carries the snapshot. With snapshot the provider builds none itself, and include or tenants next to it is a type error; without it the provider behaves as before.
  • authorizationHooks from permdock/better-supabase now caps an automation run on better-supabase 0.15 and later: automation.runAs writes the automation's keys to bsb_permission_cap, the claim 0.15 and 0.16 read, as well as bs_permission_cap for 0.13 and 0.14. Before, a run on 0.15 or 0.16 kept every permission of its publisher, or relied on 0.16's deprecated bs_permission_cap fallback.
  • authorizer and toolPolicy from permdock/better-supabase take onError(error, { permission, tenant }), a BetterSupabaseOnError, which receives every error a check throws; the check still denies.
  • authorizer from permdock/better-supabase takes memberships, versions and intent. It wraps memberships in claimsFirst(source, { onStale: 'reread', versions }) with the version cache better-supabase passes at runtime, and checks read, list and view actions and batches with intent read, every other check with write.
  • blockMembershipSource({ roles: "many" }) reads every role of a member from better-supabase 0.18's membership_roles, and a tableMembershipSource or junctionMembershipSource role through may now join on several columns. authorizationProvider names such a role set as the membership's rolesTable and fills tokenHook.activeOrganizationFrom from the manifest's hook.activeFrom, so better-supabase's doctor BS411 and BS409 check them. The Supabase manifest's through gains an optional on.
  • blockMembershipSource({ table?, roleThrough?, roles?, columns? }) from permdock/better-supabase is a MembershipSource over better-supabase's memberships block table, including a table the block runs over with assignmentGuard: "external". roleThrough reads the role key through a roles table and roles reads several roles per member from a junction.
  • permdock powersync generate compiles an inherit() grant into <field> IN (SELECT <parent id> FROM <parent> WHERE …), one query per query of the parent's read grants and one nested subquery per link hop, instead of leaving the grant out. powersync verify notes a row an inherit() stream syncs rather than failing on it.
  • permdock supabase hook generate writes member_team_ids_of(p_user uuid) returns setof uuid from supabase.hook.teams when no team scope has membership sources, and authorizationProvider from permdock/better-supabase fills teamIdsOf from it.
  • permdock/better-supabase joins better-supabase 0.15's version cache. subjectFromBetterSupabase accepts a SessionSnapshot from bsb.getRequestSession() and maps its iat and authz_ver claims. authorizer shares one instance per claims and tenant through the request-scope memo 0.15 passes to evaluate. One memoryVersionCache passed to both claimsFirst and createNext({ versions }) is evicted by bsb.invalidateSession and subscribeAuthzVersions.
  • powersync.tables syncs tables that are not resources, such as a notification inbox or a file table: the user's own rows by a user column, and the rows that point at a resource row the user reads through follow: [{ resource, field, match? }].
  • toolPolicy from permdock/better-supabase names the first denial reason in a refused tool's text (PermDock denied quotes.update: no-grant.) instead of PermDock denied quotes.update.
  • workflow.start(id, { resource: { type, id } }) binds a run to one record: the automation's permissions on that type go into an authorization_details entry with identifier, so they hold on that row only. The run ticket gains an optional resource claim (still run-v1), returned on StartAutomationResult.run and subject.context.run. hookCan and handlerCan from permdock/better-supabase take a data option that loads the row a permission is decided on.

0.9.0 (2026-10-25)

  • memoryVersionCache({ maxStaleMs }) shares authorization-version reads across instances through claimsFirst(source, { onStale: 'reread', versions }), so a page of ten Next.js private cache scopes makes at most one authz_version_for call. A token minted within maxStaleMs makes none. getPermDock(…, { intent }) picks how fresh the version must be: permdock/next rendering and GET, HEAD and OPTIONS in the HTTP adapters use read, while protectAction, other methods and core getPermDock use write, which always reads live. Sources now receive a per-instance memo, and subjectFromSupabase and permdock/jwt map iat to Subject.issuedAt. Breaking: postgrestSources keeps no answers between calls; outside an instance, each call now reads the database. To keep one read per version:

    1. Create postgrestSources(admin, { policy }) once at module scope, not per request.
    2. Pass versions: memoryVersionCache({ maxStaleMs }) to claimsFirst(sources.memberships, { onStale: 'reread', versions }), with the cache created at module scope too.
    3. In permdock/next, which reads with intent: 'read' by default, call getPermDock({ intent: 'write' }) before a mutation outside protectAction, so the version is read live.

    For Hono and oRPC with better-supabase, pass the same cache to the server and to claimsFirst (Hono, oRPC):

    // Once per process: a source or cache built per request keeps nothing.
    const sources = postgrestSources(admin, { api: {}, policy });
    const versions = memoryVersionCache({ maxStaleMs: 5_000 });
    
    const bsb = createHono(betterSupabase, { versions }); // or createOrpc(betterSupabase, { versions })
    const { protect } = createPermDock(policy, {
      subject: (c) => subjectFromBetterSupabase(c.get("auth")),
      memberships: claimsFirst(sources.memberships, {
        onStale: "reread",
        versions,
      }),
    });
  • rls.rowHelpers also writes permitted_<resource>_rows(p_permission text, p_ids text[]), which answers for the candidate ids only and finds them through the id column before it runs the row checks, so its cost follows the number of ids instead of the size of the table. Inside it and inside permitted_<resource>_row, a one-link or 'parent' inherit() asks the target's helper about the ids the checked rows point at, and a closure walk about those rows only, so a row check no longer reads the whole target table; the existing signatures and answers are unchanged. rls generate also compiles a one-link inherit() in a policy with no relation grant, which failed with "a related condition with link hops needs the policy resources".

0.8.0 (2026-10-22)

  • Breaking, types only: the members of the extension interfaces and the other public object types are declared as properties (get: (token: string) => …) instead of methods (get(token: string): …). TypeScript now checks their parameters contravariantly, so an implementation that declares a narrower parameter type than the interface fails to compile; widen the parameter to the declared type. Policy's principal, subject and context, ServerPermDock.protectOn, OperationData and OpenAiRunState stay methods, so a Policy<User> or a ServerPermDock<V> is still accepted where the default is.
  • Breaking: rls.tenantType, rls.teamType and the rls.memberships.tenant and .team shorthands are removed, and so are the tenant and team column shorthands on rls.memberships.scopes.* and rls.memberships.resource.* tables. Use rls.scopeTypes, rls.memberships.scopes and each table's columns, where tenant and team still name the first and second scope. permdock codemod 0.8 moves the old keys in defineConfig objects and permdock.config.* default exports.
  • Breaking: useRoles in permdock/react, permdock/react-native, permdock/vue and permdock/solid, and roles and rolesFor in permdock/svelte, take { scope, id } instead of { team: id }; useRoles({ team: id }) becomes useRoles({ scope: "team", id }). tenant still names the first scope. permdock codemod 0.8 reports each call to change.
  • Breaking, types only: a Permission keeps its row type, which RowOf<P> reads. can, decide, assert, explain and decideEach type check data against that row (a partial row or a { current, next } pair), with an overload for unknown or any data. permdock/next getPermission and requirePermission, the React, Vue and Solid usePermission, React useGate and Protected, and Svelte permission follow, so data that does not fit the row no longer compiles.
  • Breaking: permdock/better-supabase requires better-supabase 0.13.0 or later, and no peer range caps the major any more (jose is >=6, react is >=19). permdock rls generate writes member_<scope>_ids_of(p_user) on Supabase for a team or teams scope with membership sources; it answers only for the caller, and authorizationProvider fills better-supabase's teamIdsOf with it.
  • Security: with rls.customRoles.from.sync: 'trigger', a signed-in caller who wrote the application's role tables could hand out a permission they lack, including on a role they hold. permdock rls generate now adds permdock_sync_custom_role_guard_<table> before-row triggers that hold such a write to the checks of permdock_replace_custom_role_grants (not-member, manage-roles, not-assignable-by) against the copy as it stood before the statement. Regenerate and apply the helpers.
  • buildLocalSnapshot, localSnapshot and powerSyncSource in permdock/react-native now fill snapshot.assignable for the active tenant, so assignableRoles(), assignablePermissions() and assignableLevels() answer on the device as the server does. Regenerate the manifest with localSnapshotManifest(policy) (or permdock powersync generate) to get its new assignable section; an older manifest still yields no assignable permissions.
  • permdock rls verify --introspect matches each security definer helper by its full signature, so an overloaded helper such as permdock_permission_keys() and permdock_permission_keys(text) no longer reports a random overload. Breaking for rls.verify.ignore and --ignore: helper finding ids now carry the signature, helper-definer:permdock.permdock_has(text):helper instead of helper-definer:permdock.permdock_has:helper.
  • permdock/better-supabase works with better-supabase 0.14. subjectFromShareLink reads the share-link row's subject: { type, id } that better-supabase 0.14 returns, as well as subjectType and subjectId from 0.13, and ShareLinkRow accepts both shapes. authorizationProvider leaves the new portalSubjects and portalParties templates unset, so its functions type check against 0.14. The peer range stays >=0.13.0 with no upper bound.
  • resource(…, { orderedLevels: true }) marks levels declared from narrowest to widest: a holder of a level may hand out every earlier level in assignableLevels, assignableRoles, the snapshot and the SQL custom-role write functions. Decisions are unchanged, and the catalog marks such permissions with orderedLevels: true. permdock_custom_role_guard and permdock_custom_role_beyond are now documented as stable for an app's own security definer write path.

0.7.0 (2026-10-21)

  • A custom-role grant with a level its resource does not declare still allows nothing. It now reports schema with an unknown-level cause on on('auth'), and explain() lists it in trace.skipped with why: "unknown-level" and the level.

  • A stale token no longer keeps a revoked platform role. claimsFirst(source, { onStale: 'reread' }) now also replaces principal.roles through the new optional MembershipSource.globalRolesFor, which postgrestSources().memberships implements, and postgrestSources().refresh(subject) rereads the principal while keeping actor, delegation, session and the token's other claims, so a stale OAuth client keeps its delegation ceiling.

  • A tenant-scoped check on a subject with no active tenant now denies with the new reason no-tenant. A requested tenant the subject does not hold still denies with no-membership. PermDock Cloud and other consumers that switch on the closed reason list handle no-tenant.

  • Breaking default: permdock/cloud and permdock cloud push no longer read VERCEL_ENV or fall back to production. The environment is environment (or --project), then PERMDOCK_CLOUD_ENV, then the one the new GET /v1/environment route names for the key. Without a configured environment, cloud().issuer and cloud().jwks are unset until cloud().endpoints() resolves, cloudEndpoints() throws, and resolveCloudEndpoints() asks the Cloud. cloud({ verifier }) also accepts (endpoints) => TokenVerifier. Set PERMDOCK_CLOUD_ENV to keep the old name-based resolution.

  • Breaking, permdock rls generate: every role, assignable or not, now gets the same <grant key>@<level> keys; rls.customRoleWrites.roles.skip and the backfill skip tenant rows only, so a global or shared role marked is_system is copied and cascaded (only a declared name excludes it) and stores no scope_id; and the backfill drops the stored level of a permission that has no levels instead of refusing it. Regenerate the helpers and rerun --backfill-out.

  • Breaking: the better-supabase peer range is >=0.11.0 <0.13.0, the versions CI tests. Apps on better-supabase 0.9 or 0.10 must upgrade to 0.11 before they take this release, and each new better-supabase minor needs a PermDock release that raises the bound.

  • Doctor PD054 compiles the role_permissions rows from the same context permdock rls generate builds, so a levelled resource no longer reports the rows generate writes as missing or stale. It also reads the rows of an rls.seeds: 'view' view.

  • Doctor PD074 warns when supabase.hook is set and supabase/config.toml does not enable [auth.hook.custom_access_token] with the generated function's uri. permdock supabase inspect adds managementApi (hook_custom_access_token_enabled, hook_custom_access_token_uri, jwt_exp) to its output and to the manifest file, and the manifest schema gains that optional field.

  • Every JSON Schema in permdock/schemas is served at its $id, https://permdock.com/schemas/<name>.json, with Access-Control-Allow-Origin: *.

  • Every scope-key read in can, where() and snapshots goes through the relations.self lookup, so a resource that declares only self is checked on its own id at a nested scope too.

  • Fix two permdock rls generate holes in database mode: the membership source helpers (permitted_<scope>_ids, permdock_permission_keys and their _for forms) now read a custom role's stored level, so job.read@own no longer widens to every row; and a tenant row of rls.customRoleWrites.roles named like a declared role (owner) reads as no role, with a permdock_custom_role_name_guard trigger that refuses it (declared-role, name-taken). New doctor check PD072.

  • New claim(path) from permdock returns the condition ref principal.claims.<path> typed SubjectRef, so where: { teamId: { in: claim("team_ids") } } compiles under noUncheckedIndexedAccess and noPropertyAccessFromIndexSignature. principal.claims is now a declared ref field.

  • New doctor check PD075 warns when rls.tables maps two resources to one table, as with file and fileNode on file_nodes, and links to the merge guide. List a table that is split on purpose, with each resource covering disjoint rows, in the new doctor.sharedTables option.

  • New entry permdock/testing/core exports policyMatrix(policy, config), testRlsParity and testOrmParity without importing a test runner, so node:test, Bun, Deno or Jest can run a policy matrix. policyMatrix returns { cells, missing } with the failures of each cell; describePolicy now asserts that report under Vitest, and permdock/testing re-exports the core.

  • The Supabase page documents the OIDC-only OAuth pattern: one policy delegation from authenticated() to actor("oauth-client") with permission subtrees, and which stale-token path keeps the ceiling.

  • The better-supabase adapter page documents how act.read_only, act.tools and team_ids are read by each library, and that an agent token needs a policy delegation to actor("agent"). The next-better-supabase example adds quotes.read and quotes.update agent tools and a stack test for agent-tool-not-delegated and read-only write refusal.

  • The connector-v1 siem kind takes an optional config.headers map for the collector credential (Splunk HEC Authorization, Datadog DD-API-KEY), so the credential never sits in the endpoint URL. This is an additive v1 change: every body that was valid stays valid, and a validator built from the earlier connector-v1.json rejects headers. A store seals header values and lists only their names.

  • The generated Supabase token hook runs revoke all on function <fn>(uuid|jsonb) from public, anon, authenticated before granting each supabase.hook.claims and supabase.hook.before function to supabase_auth_admin, because those functions return any user's claims. Doctor PD049 names such a function while a client role can execute it. An app that calls one from the client grants it again in its own migration.

  • The policies page shows an owner-only billing.manage grant gating Stripe Checkout and Billing Portal sessions; the permdock/testing SaaS preset already models it.

  • The webhook receiver examples on the Cloud integrations and Standard Webhooks pages answer 403, 503, 204 and 400 for the verifyWebhook failure causes, as cloudApprovalWaiter does.

  • RUN_TICKET_CLAIMS from permdock/server lists the vnd.permdock.run+jwt claim names parseRunTicket keeps, the properties of run-v1.json.

  • cloud-api-v1.json and the Cloud adapter page list the evidence:read and approvals:read OAuth scopes and the read key kind (PERMDOCK_CLOUD_TOKEN), and the project item carries optional slug and updatedAt.

  • parseCatalog now rejects a role on an undeclared scope, an operation, grant, delegation or OAuth scope that names an undeclared permission key, and duplicate keys, with every issue's path. parseCatalog(json, { requireMeta: ['title', 'risk', 'effects'] }) also requires those permission meta fields.

  • permdock cloud push, with or without --dry-run, checks the built catalog before it sends anything and prints every issue as path: message. With --json the error is a catalog_invalid Problem with issues; the exit code is 1.

  • permdock collect --check and permdock catalog --check no longer fail when only usages[].line changed. They exit 0 with the notice catalog usages moved (lines only), and --json reports positionsMoved: true.

  • permdock doctor findings can be info, a hint that --fail-on warning never fails on (::notice on GitHub, a SARIF note). The new PD076 hint lists rls.actions entries that change nothing: 'none' on a verb that already compiles to no policy, and entries for a verb no permission uses.

  • permdock powersync generate no longer fails on a membership table whose role column is a { column, map }.

  • permdock powersync generate reads rls.membershipSources for a scope rls.memberships does not map, and syncs tenant custom roles per level, with sqlFunction conditions compiled through their twin. The stream for a deciding column's role is the union of every source that holds the role. Tables outside public are queried as "<schema>"."<table>", and are renamed on the device to <schema>_<table> only when another synced table has the same name.

    powerSyncSource(db, { manifest, user, tenant?, attributes? }) builds the snapshot from the tables named in the manifest's new rows section. powersync verify now fails on a granted row that no stream syncs unless generate warned for it. With a database, it also fails with PD058 when a synced table is missing from the powersync publication. permdock doctor reports PD058 for each membership source with no stream form.

  • permdock rls generate --fields mask (rls.fields: 'mask') writes the --fields views output plus <schema>.<table>_mask(p_row) per field view: a security invoker function that returns the row with each restricted column the caller may not read set to null, so a security definer RPC can return what <table>_visible would. --fields views output is unchanged.

  • permdock rls generate --no-seeds skips the seeds part under --split, and any command that writes a file writes a character device such as /dev/null in place instead of failing with EPERM.

  • permdock rls generate warns when rls.approvals.delegations is set with --authorize jwt: permdock_is_approver cannot read a delegator's permissions from the caller's token, so a cover never satisfies a holder() approver in SQL.

  • permdock rls generate with rls.capabilities grants anon usage on a non-public helper schema. Without it the <table>_select_anon policies could not call permdock_capability_ids, and a share-link capability read no rows.

  • permdock rls verify gives every finding a stable id, <code>:<table>:<key>, printed at the end of its line, in GitHub annotations and as the SARIF permdockId/v1 fingerprint. rls.verify.ignore: [{ id, reason }] and --ignore <id> accept a finding without failing the run, an entry that matches no finding warns, and --json data is { findings, ignored, stale }.

  • permdock rls verify with the guc dialect now sets each fixture claims entry as app.<name>, as withSubject does, so a policy that reads a claim (principal.claims.team_ids) is checked against the database with that claim set.

  • permdock rls: rls.seeds: 'function' writes the seeds as <schema>.seed(); rls explain shows what a generate run binds to; rls.customRoles.from.sync: 'trigger' keeps copied custom roles current; a role column takes { column, map }; rls verify --kind pgtap writes supabase/tests/permdock_rls.test.sql (or --out) and seeds fixture memberships; rls migrate and rls import require pgsql-parser 18. supabase.hook.teams adds a team_ids claim, and parseCustomRoleEntry checks one stored custom-role entry.

  • permdock scim generate writes the tenant-keyed Postgres tables for a SCIM directory (scim_users, scim_groups, scim_group_members), revoked from the data API's client roles, and permdock/scim exports postgresDirectoryStore(query, { schema }), the DirectoryStore over them, so one scimHandler behind the Cloud relay serves every tenant. SqlQuery moves to core and is exported from permdock/scim as well as permdock/supabase.

  • permdock skills finds the project's installed permdock with ESM resolution, so a hoisted or workspace-linked install supplies the skills, and NODE_PATH no longer does.

  • permdock supabase inspect --out writes the manifest in rls.authorize: 'database' mode without supabase.hook, leaving out hook, budget, claims, authzVersion and memberships; parseSupabaseManifest returns SupabaseManifest, and authorizationProvider leaves tokenHook unset for it.

  • permdock.canAll(checks) and permdock.decideAll(checks) check several permissions on one instance, where a check is a permission or a [permission, row] pair; canAll([]) is false. isRoleName(policy, value) narrows a role string to the policy's declared roles (RoleNameOf<typeof policy>). allow and deny also take a resource, a list of resources or the whole tree without a condition, so role("owner", [allow(permissions)]) grants every action.

  • permdock.decideIds(permission, ids, { data }) decides ids the server loads through data(ids), each row in the tenant its own scope field names, and returns a Decision[] in id order. An id with no row denies with validation; a snapshot instance denies with unsupported.

  • permdock/ai-sdk takes stepUp: { at? }. With it, toolApproval answers an insufficient-user-authentication denial, or a denial that an eligible role activation would lift, with { type: 'user-approval', reason, stepUp }, and its re-check runs the tool only when decide grants it. Type change: ToolApprovalStatus gains this user-approval member, which carries stepUp instead of token, so narrow with 'token' in status before reading token.

  • permdock/approvals exports approvalEntityTag(request) and approvalView(request), the ETag approvalsHandler serves and the view it hashes (the request without token). permdock exports canonicalJson (RFC 8785) and sha256Digest, the two steps behind every sha-256: digest.

  • permdock/approvals exports the IdempotencyRecord and IdempotentCall types with idempotencyRecord, idempotencyRecordKey and matchesIdempotencyRecord, which build and compare Idempotency-Key records exactly as approvalsHandler stores them.

  • permdock/authzen exports the rules its handler applies, so a hosted PDP answers the same: parseAuthzenRequest(kind, body) and readAuthzenRequest(kind, request) return the handler's 400 and 413 Problem Details in its order and wording; readAuthzenPage and authzenPage page search results; searchActions(policy, user, resource) decides every catalog permission of a resource type; and searchSubjects(policy, lister, request) filters the candidates an AuthzenSubjectLister answers. The subjects option is now typed AuthzenSubjectLister, and list receives { type, action, resource, context? }; a list() that takes no argument still fits.

  • permdock/better-supabase exports roleOrderFromCatalog(catalog, { scope?, owner? }), which orders the catalog's roles highest first by assigns for better-supabase's SSO roleOrder.

  • permdock/catalog exports checkHostedGrant(policy, grant), which answers { ok: true } or the HostedGrantDropReason mergeHostedGrants would report for one candidate hosted grant, without a PolicyDocument.

  • permdock/catalog exports hostedGrantOptions(policy): per hostable permission, the roles (by scope), plans and relations a hosted grant may name, the approval forms it must meet and the portable condition fields, for grant authoring forms.

  • permdock/cloud adds cloudOAuth({ clientId, redirectUri }), an OAuth client of the PermDock Cloud platform issuer with authorizeUrl, exchangeCode, refresh and a typed listProjects. It throws CloudAuthError, whose code tells invalid-token from insufficient-scope by the RFC 6750 WWW-Authenticate challenge. CLOUD_BASE_URL exports https://permdock.com/api. cloud() and cloudEndpoints() now default url to it instead of throwing without one, so a missing key is the only setup error (cloud() requires a key).

    cloud-api-v1.json documents the invalid_token and insufficient_scope challenges on the projects read API, the cursor query of GET /v1/projects and GET /openapi.json; testCloudApi checks all three, and the insufficient_scope check runs when platform.projectsOnly names a token with projects:read only.

  • permdock/delivery exports parseConnector(input), which checks a PermDock Cloud connector body against connector-v1.json and answers a frozen Connector or a list of issues, each with a JSON pointer path. CONNECTOR_KINDS and CONNECTOR_SCHEMA are exported too.

  • permdock/jwt adds verifySubjectToken(token, { verifiers, audience, replay, maxLifetime }), which accepts an at+jwt from the first matching verifier, at most 300 seconds long by default and with a jti used once (causes lifetime-exceeded and replayed), and verifyIdToken(token, { issuer, clientId, nonce, verifier }), the relying party's ID token check with nonce-mismatch.

  • permdock/mcp adds mcpResourceGuard, which verifies the bearer token for an MCP resource and answers McpAuthInfo or a 401 / 403 response with an RFC 9728 challenge, and protectedResourceMetadata, which serves the RFC 9728 document.

  • permdock/package.json resolves through the exports map, so a tool can read the installed version without ERR_PACKAGE_PATH_NOT_EXPORTED.

  • permdock/ssf serves the transmitter side of SSF 1.0: ssfTransmitter({ issuer, streams, queue, signer, authorize }) answers the /.well-known/ssf-configuration, stream, status, verification and per-stream poll endpoints over an SsfStreamStore (memorySsfStreamStore(), testSsfStreamStore in permdock/testing), and fanOutSet(event, { streams, queue, signer }) delivers one event to every stream that requested it. pollSets(options) is one RFC 8936 poll request that answers SETs unverified; receiver.poll now uses it and reports a failed poll request as a poll-failed event instead of rejecting.

  • permdock/testing/fixtures exports betterSupabaseCatalog and betterSupabaseManifest, the parsed catalog and Supabase manifest of the next-better-supabase example, for testing code that consumes PermDock's files.

  • permdock/testing/fixtures follows the next-better-supabase example: betterSupabaseCatalog has the link-only guest role on quotes, and betterSupabaseManifest lists the four-argument permdock_is_approver that approval covers need.

  • permdock declares three dependencies instead of eight: @standard-schema/spec, oxc-parser and jiti. The CLI's @clack/prompts, diff, smol-toml, package-manager-detector and fastest-levenshtein are inlined into the CLI build, so an app that imports permdock no longer installs them.

  • permdock exports PermissionsOf<Spec>, the type definePermissions returns, so a package built with isolatedDeclarations can annotate its exported tree.

  • permdock exports checkRoleChange(role, { change, holders, roles, actorRoles }), the assigns, for, exclusiveWith, min, max and transferOnly rules of a role change from a CatalogRole and holder counts alone. decideRoleChange now runs the same function.

  • permdock exports normalizeMembership, normalizeMemberships and resolveScope, the membership normaliser and scope-alias lookup evaluation uses. Each takes catalog.scopes or a policy's scope list; absent means the implicit tenant and team pair.

  • principalFromMemberships(userId, rows, { scope?, tenant? }) in permdock/better-supabase builds a Principal from rows of the memberships block's table (its own block since better-supabase 0.15), one membership per organization_id, and drops other users' rows and disabled rows.

  • protectServer from permdock/mcp accepts an MCP Apps ui:// view registered without a permission: the view takes the permission of the tool whose _meta.ui.resourceUri names it, for resources/list and resources/read, and a view no tool links is hidden and refused. McpUiResourceConfig types it.

  • rls generate --split and supabase hook generate under pg-delta write no drop trigger or drop policy statement in a declarative file: triggers are create or replace trigger, policies a plain create policy.

  • rls generate keeps create constraint trigger in pg-delta declarative files, because pg-delta has no create or replace constraint trigger.

  • rls verify --introspect --helpers-only accepts a <permission>@<level> key the resource declares instead of reporting it as undeclared. A conditioned level such as job.create@own passed to permitted_<scope>_ids is an info line naming permitted_job_row(job, 'job.create'), the row helper that applies the level. The docs give the insert policy form with the table's row reference, not new.

  • rls.customRoleWrites.roles.primaryKey makes permdock rls generate write permdock_replace_custom_role_grants_by_id(role_id, permissions), its trusted variant and permdock_trusted_role_permissions_by_id(role_ids): the role row supplies the tenant, scope and name, the existing caller and definition checks apply, and rls.customRoleWrites.audit names the function that records each save. rls.trustedReaders roles now also get usage on the helper schema, without which their execute grants could not be used.

  • rls.seeds: 'view' writes <schema>.role_permissions as a security_invoker view over the compiled rows, so a declarative schema carries the rows and needs no seeds migration or seed() call.

  • rls.tables.<resource>: false marks a resource with no table: permdock rls generate writes no policies or SELECT coverage for it and still seeds its role grants, and rls verify skips its fixtures. Without --db-url-stdin, rls generate also warns for each bound table that no create table in the project's migration or schema folders creates.

  • rls.tables entries accept { table?, via: { table, column, key?, id?, type?, scope? } }: rls generate writes the permitted_<parent>_ids(p_grant) security definer helper and policies that filter the child's parent id through it, and rls explain lists the binding.

  • rls.tokenScopes: true makes rls generate write permdock_token_scope_allows(p_grant) and narrow permdock_has, every permitted_<scope>_ids and the helper-free allows for a delegated token (a client_id, or an act that is not a support or impersonation session) to the permissions its scope claim reaches. The Supabase manifest lists the helper and rls.tokenScopes. authorizationProvider's delegation.scopes from permdock/better-supabase now also maps a renamed permission's former scope to its current key, as the in-process check does.

  • securityFor(permission, { security: false }) from permdock/openapi returns only x-permdock-permissions, for an API whose security is declared elsewhere.

  • snapshotClaims(snapshot) from permdock answers the claims signSnapshot signs (snapshot, sub, iat, exp), for a signer that takes a claim set.

  • subject_for now returns a claims object with team_ids and each supabase.hook.claims entry, and postgrestSources().subject() and .refresh() put them on principal.claims, so a stale-token reread keeps team-scoped levels. Re-run permdock supabase hook generate.

  • subject_for, members_of and the hook's memberships no longer emit roles: [null] for a membership row whose role column is null (a member who holds only custom roles). A null key is no role, and a row left with no roles is not a membership. Re-run permdock supabase hook generate.

  • supabase.hook.api now writes the permdock_subject_for, permdock_members_of and permdock_authz_version_for wrappers as security invoker functions, so the Data API schema holds no security definer function. service_role gets usage on the hook schema and execute on the three readers there. Re-run permdock supabase hook generate and apply the migration.

  • testApprovalStore takes capabilities: { expire } and then checks that a new ask replaces an expired request. The docs now say that reopen opens a second client over the same backend, and that a store replaces only an expired or past-deadline record.

0.6.0 (2026-10-20)

  • Add shared custom roles: a CustomRole with shared: true and no tenant, returned by CustomRoleSource.sharedRoles(), is held on a membership of its scope in every tenant, and its name wins over a tenant role's (validateCustomRole(policy, role, { shared }) reports name-taken). Generated RLS resolves them from rows with a null tenant_id below the global scope, and permdock_replace_custom_role_grants writes them only for a caller holding meta.manageRoles through a global role.
  • The better-supabase peer range is >=0.9.0 instead of >=0.9.0 <0.10.0, so permdock/better-supabase installs next to better-supabase 0.10 and later without a peer warning.

0.5.0 (2026-10-19)

  • A deny now applies to an update pair { current, next } when either row matches it. deny(permissions.invoice.update, { where: { locked: true } }) used to apply only when both rows were locked, so unlocking an invoice, or locking one, was granted in process and by fromSnapshot while the generated RLS refused it. A scoped deny likewise applies when the update moves the row into or out of its scope instance. Allows still need both rows to match, and fromSnapshot now also checks an update allow's where against the next row when the grant has no check, as can does.

  • A condition date compiles the same everywhere. The ORM compilers and generated RLS read { date } with the evaluator's ISO 8601 parser: a date-time without a zone is UTC, and a string that is not ISO 8601 matches no row. Generated SQL writes an explicit UTC literal ('2026-01-01T00:00:00.000Z'), so the session TimeZone no longer shifts it.

  • A decision made under a support session carries subject.supportSession: { id }, the id its access events carry as session.id, and permdock/otel maps it to permdock.support_session.id. decision-event-v1.json accepts the new optional field.

  • A deny whose wire validity window is malformed now stays in force in fromSnapshot and in client where(). Before, the malformed window read as "never active" for every grant, which skipped the deny and let an allow through.

  • A feed key (pdfeed_) is bound to one resource and rotated instead of expiring. Credential v1 gains the feed kind and on. An older parser that rejects a feed record fails closed.

  • A membership whose expiresAt is not Unix seconds no longer lives forever. An RFC 3339 string (how a timestamptz arrives as JSON), a Date or an Instant is now converted to seconds, null still never expires, and any other value, NaN and Infinity included, fails closed: a membership from a subject or a MembershipSource is dropped, and one from a token's memberships claim is treated as expired.

  • A verb missing from rls.actions compiles to 'none' without a warning, so rls.actions lists only the verbs that map to a SQL command; the generated SQL is unchanged. New permdock doctor check PD071 reports an unmapped verb whose name reads as a write (create…, update…, approve…, markPaid, writeOff), so you map it on purpose.

  • An approval for a tool call now covers only the arguments the approver saw. A tool without a data loader decided with no data, so its approval token held key, subject and actor only, and approving send_email({ to: 'boss@corp' }) also approved send_email({ to: 'attacker@evil' }). The agent kernel (AI SDK, OpenAI Agents, Claude Agent SDK, Eve, A2A) and permdock/mcp now pass the tool arguments as the new args decide option, and the token binds their digest for row and collection tools alike. A pending approval asked before the upgrade no longer matches its retry and is asked again.

  • An approver can cover another approver for a closed window. approvalsHandler takes delegations and subjectFor. The signature records the delegate as by and the delegator as onBehalfOf and delegation. Those fields are optional on approval request v1.

  • Breaking: authorizationProvider from permdock/better-supabase never sets canApprove; approver becomes the 'ai-tool' entry of isApprover, which better-supabase 0.9 reads. holdersOf and actorMayWrite are set whenever the manifest lists their helpers. The provider adds functions.permitted, operations and delegation.scopes, and the new authorizationHooks fills better-supabase's AuthorizationHooks. subjectFromShareLink refuses a share link pinned to a version.

    Before (0.4)After
    authorizationProvider({ manifest, catalog, approver }) fills canApproveThe same call fills isApprover for the 'ai-tool' kind. Set rls.approvals, run permdock rls generate and permdock supabase inspect --out, so the manifest lists permdock_is_approver; without it isApprover is unset and problems names the helper
    better-supabase 0.8 read canApprove for AI tool approvalsbetter-supabase 0.9 calls isApprover for every request kind; pass approvers: { "ai-tool": holder(p), … } to name approvers for other kinds
  • Breaking: subjectFrom* resolvers take the input first and return Subject<<Source>Principal>. In-process defaults are memory<Interface>, conformance runners test<Interface>, adapted sources <origin><Interface>, options take their interface's name, and failure results carry a cause. Run permdock codemod 0.5 for the renames below; the call-shape changes in the second table need a manual edit.

    OldNew
    subjectFromSessionsubjectFromEve
    actorFromSessionactorFromEve
    CredentialPrincipalApiKeyPrincipal
    LinkPrincipalCapabilityPrincipal
    SsfSubjectMapperSsfSubjectResolver
    memorySettingsmemorySettingsSource
    memoryRelationsmemoryRelationSource
    MemoryRelationsDataMemoryRelationSourceData
    memorySinkmemoryDecisionSink
    MemorySinkMemoryDecisionSink
    MemorySinkOptionsMemoryDecisionSinkOptions
    memoryApprovalPoliciesmemoryApprovalPolicySource
    memoryApprovalDelegationsmemoryApprovalDelegationSource
    memoryAccessReviewsmemoryAccessReviewStore
    MemoryAccessReviewsMemoryAccessReviewStore
    memoryCredentialsmemoryCredentialStore
    MemoryCredentialsMemoryCredentialStore
    memoryStoragememorySnapshotStorage
    RoleSourceCustomRoleSource
    RoleSourceFactoryCustomRoleSourceFactory
    memoryRoleSourcememoryCustomRoleSource
    testRoleSourcetestCustomRoleSource
    betterAuthRoleSourcebetterAuthCustomRoleSource
    BetterAuthRoleSourceOptionsBetterAuthCustomRoleSourceOptions
    PermDockStorageSnapshotStorage
    rlsParitytestRlsParity
    ormParitytestOrmParity
    fromStripeEntitlementsstripeEntitlementSource
    fromTabletableMembershipSource
    fromJunctionjunctionMembershipSource
    fromSupabasePostgressupabasePostgresQuery
    verifyWebBotAuthwebBotAuthVerifier
    scimHandler option storedirectory
    startAccessReview option storereviews
    approvalsHandler and matchDelegation option delegationsapprovalDelegations
    decide, can and explain option sourcecall
    LimitDetail field windowper
    testAuthZentestAuthzen
    TestAuthZenOptionsTestAuthzenOptions
    AuthZenVectorsAuthzenVectors
    AuthZenEvaluationVectorAuthzenEvaluationVector
    AuthZenEvaluationsVectorAuthzenEvaluationsVector
    AuthZenSearchVectorAuthzenSearchVector
    powersyncSourcepowerSyncSource
    summariseSubjectsummarizeSubject
    WebhookFailureReasonWebhookFailureCause
    ApprovalResumeFailureApprovalResumeFailureCause
    BeforeAfter
    subjectFromApiKey(options)(key, { tenant })subjectFromApiKey(key, { ...options, tenant })
    subjectFromBetterAuth(auth, session, options)subjectFromBetterAuth(session, { auth, ...options })
    capabilitySubject(capability) from permdocksubjectFromCapability(token, options) from permdock/jwt
    credentialSubject(credential, options) from permdocksubjectFromApiKey(key, options) from permdock/server
    MappedSubject from permdock/jwtSubject<JwtPrincipal>; subjectFromIntrospection returns Subject<IntrospectionPrincipal>
    verifyWebBotAuth(request, options)webBotAuthVerifier(options)(request), or webBotAuth: webBotAuthVerifier(options)
    verifyWebhook failure { ok: false, reason, cause? }{ ok: false, cause }, where cause is a WebhookFailureCause
    inspectApproval and consumeApproval failure { ok: false, detail }{ ok: false, cause }
  • Breaking: subjectFromApiKey loads a user key's owner through a PrincipalSource passed as principals, asked with the key's tenant, instead of an owner(id) callback.

    BeforeAfter
    subjectFromApiKey({ owner })subjectFromApiKey({ principals })
  • Breaking: adapters use one name per meaning. permdock/server exports createPermDock; server adapters take deniedResponse; agent adapters take deniedText and operations; adapter type names start with the adapter. Run permdock codemod 0.5 for the renames below. The call-shape changes in the second table need a manual edit, except permittedIds and mayUse, which the codemod rewrites.

    OldNewEntries
    createServerKernelcreatePermDockpermdock/server
    ServerKernelServerPermDockpermdock/server
    ServerKernelOptionsServerPermDockOptionspermdock/server
    createEvaluationsHandlerevaluationsHandlerpermdock/server
    createNativeStorenativeStorepermdock/react-native
    permdockgetPermDockpermdock/server, node, terminal, openai, claude-agent, eve
    permdockmiddlewarepermdock/hono, express, elysia, trpc, orpc
    loaddatapermdock/authzen
    loadDatadatapermdock/nest
    onDenieddeniedResponsepermdock/server, hono, express, fastify, elysia, nest, node, trpc, orpc, supabase/middleware
    onDenieddeniedTextpermdock/ai-sdk, mcp
    toolsoperationspermdock/ai-sdk, openai, claude-agent, eve
    OnDeniedDeniedResponsepermdock/server
    OnDeniedEventDeniedResponseEventpermdock/server
    OnDeniedTextDeniedTextpermdock/ai-sdk, mcp
    PermDockRequestExpressPermDockRequestpermdock/express
    PermDockRequestFastifyPermDockRequestpermdock/fastify
    PermDockEnvHonoPermDockEnvpermdock/hono
    ElysiaContextElysiaPermDockContextpermdock/elysia
    ElysiaCtxElysiaRequestContextpermdock/elysia
    ConvexPermDockCtxConvexPermDockContextpermdock/convex
    ServerPermDockProviderPropsNextPermDockProviderPropspermdock/next
    NativePermDockProviderPropsReactNativePermDockProviderPropspermdock/react-native
    PermDockSvelteOptionsSveltePermDockOptionspermdock/svelte
    BeforeAfter
    app.register(permdock) on permdock/fastifyapp.register(middleware())
    app.register(permdockHandler, opts) on permdock/fastifyapp.register(permdockHandler(), opts)
    permdockHandler(request) on permdock/trpc, orpc, authzenpermdockHandler()(request)
    permittedIds(permdock, permission, scope) from permdockpermdock.permittedIds(permission, scope)
    mayUse(permdock, permission) from permdockpermdock.mayUse(permission)
  • Breaking: core and permdock/pdp build an instance with getPermDock (async) or getPermDockSync, so create* means a module-scope factory, get* a per-request server read and use* a client read. permdock/next renames requireAccess to requirePermission, which takes getPermission's arguments. Run permdock codemod 0.5 for the renames below; the call-shape change in the second table needs a manual edit.

    OldNewEntry
    createPermDockgetPermDockSyncpermdock
    createPermDockgetPermDockpermdock/pdp
    loadRelationsprefetchRelationsthe PermDock method, from permdock and permdock/pdp
    BeforeAfter
    requireAccess({ permission, data, tenant, onDenied })requirePermission(permission, data, { tenant, onDenied })
    RequireAccessInputPermissionRequirementOptions

    await createPermDock(…) from permdock becomes await getPermDock(…).

  • Breaking: every event, webhook, problem, route and protocol field now follows its standard: CloudEvents types are com.permdock.<family>.<operation>, webhooks are Standard Webhooks over a CloudEvents batch, and the approvals API addresses a request by id. Every format keeps v: 1 because nothing outside the PermDock repositories reads these formats yet.

    CloudEvents types:

    BeforeAfter
    dev.permdock.decisioncom.permdock.decision
    dev.permdock.approval with data.phasecom.permdock.approval.requested, .resolved, .expired, .cancelled
    dev.permdock.directorycom.permdock.directory.created, .replaced, .patched, .deleted
    dev.permdock.membershipcom.permdock.membership.added, .removed, .changed
    dev.permdock.credentialcom.permdock.credential.created, .used, .rotated, .revoked
    dev.permdock.catalogcom.permdock.catalog.published, .drifted
    dev.permdock.access.started, .ended, .revokedcom.permdock.support-session.started, .ended (revoked is ended with data.operation: 'revoked')
    nonecom.permdock.automation.* and com.permdock.delivery.*, in RESERVED_CLOUD_EVENT_TYPES; parsers refuse them

    Events and the envelope:

    BeforeAfter
    toCloudEvent(event, { source? }), any sourcesource required and an absolute URI; dataschema, traceparent and tracestate added
    Decision event source; DecideOptions.sourcecall; DecideOptions.call
    Event expiresAt in Unix secondsRFC 3339 date-times
    Event delegation: { scopes, authorizationDetails }delegation: { scope, authorization_details }
    Event membership in the internal shapeThe canonical membership { scope, id, roles, … }

    parseSinkEvent, parseSinkEvents, parseCloudEventBatch, cloudEventType, CLOUDEVENTS_CONTENT_TYPE, CLOUDEVENTS_BATCH_CONTENT_TYPE, EVENT_SCHEMA_IDS, SINK_EVENT_SCHEMAS and the <FAMILY>_EVENT_SCHEMA constants are new on permdock, with the schemas published at https://permdock.com/schemas/<family>-event-v1.json.

    Webhooks:

    BeforeAfter
    A vnd.permdock.evidence+jwt JWS with an events claim, posted as application/jwtwebhook-id, webhook-timestamp and webhook-signature (v1a Ed25519, v1 HMAC) over an application/cloudevents-batch+json body
    verifyWebhook(request, { jwks, audience, replay })verifyWebhook(request, { verifier }) or { jwks, secret, replay }
    verifyWebhook reasons unsigned, invalid-token, invalid-events, replayedunsigned, invalid-signature (with cause), invalid-events, replayed

    webhookSigner and webhookVerifier on permdock/server sign and verify any body. signDecisionBatch keeps the JWS for offline evidence exports.

    Approvals HTTP API and the Cloud store:

    BeforeAfter
    GET /:tokenGET /:id with a strong ETag and If-None-Match; no response carries token
    POST /:token/approve, POST /:token/rejectPOST /:id/approve, POST /:id/reject with If-Match (412) and Idempotency-Key (422 on reuse)
    signed in the approve responseGET /:id/signature as application/jwt, linked with Link: rel="alternate"
    Lists with next onlynext and Link: rel="next"
    Cloud GET /approvals/{token}GET /approvals/by-token with the PermDock-Approval header; GET /approvals/{id} is new
    Cloud POST /approvals/{token}/resolve, /consumePOST /approvals/by-token/resolve, /by-token/consume with the PermDock-Approval header
    PermDock-Approval: <any string>One RFC 9651 sf-token; anything else reads as no token, and approvalHeaders throws on it

    memoryIdempotencyStore, IdempotencyStore and ApprovalView are new on permdock/approvals. testIdempotencyStore in permdock/testing is the store's conformance runner.

    Problem Details, AuthZEN, SCIM, SSF, OpenTelemetry, OCSF and Web Bot Auth:

    BeforeAfter
    type …/unauthenticated, …/not-found, …/method-not-allowed, …/conflict, …/payload-too-large, …/internalabout:blank with the HTTP status title; PROBLEM_EXAMPLES on permdock/testing holds one body per remaining type
    …/step-up-required without a titletitle: "Step-up required"
    AuthZEN context.delegation: { scopes, authorizationDetails }{ scope, authorization_details }
    AuthZEN resource.id always a row"*" names the collection
    AuthZEN results without reasons; evaluations_semantic and X-Request-ID on permdock/authzen onlycontext.reason_admin and context.reason_user; evaluations_semantic and the X-Request-ID echo on permdockHandler too
    SCIM extension urn:permdock:scim:schemas:extension:roles:1.0urn:ietf:params:scim:schemas:extension:permdock:2.0:Group
    SCIM without versioning; scimType on any errormeta.version and ETag, If-Match (412), If-None-Match (304); scimType on 400 and 409 only
    SSF handler failure 400 with an err body500 with an empty body; CAEP 1.0's eight events, RISC account-disabled, account-purged, credential-compromise and stream verification
    OTel permdock.* attributes only; lists comma-joineduser.id, user.roles, gen_ai.agent.id, gen_ai.request.model, error.type; lists as arrays
    OCSF 1.3.0; time: 0 for a bad at; status Other for approval-requiredOCSF 1.9.0; the event projects to undefined; status Approval Required
    accessToOcsf Account Change (3001), OcsfAccountChangeUser Management (3007), OcsfUserManagement
    Web Bot Auth accepted any RFC 9421 signaturetag="web-bot-auth", a covered @authority, and a covered signature-agent when the header is sent
  • Breaking: every signed output is now a vnd.permdock.<format>+jwt with required iss, aud, iat, exp and jti, and the payload no longer repeats them. joseTokenSigner requires issuer, digests are sha-256: over RFC 8785 JSON, and every format keeps v: 1 because nothing outside the PermDock repositories reads these formats yet.

    BeforeAfter
    typ: permdock-snapshot+jwt, permdock-approval+jwt, permdock-policy+jwt, permdock-capability+jwt, permdock-decisions+jwtvnd.permdock.snapshot+jwt, vnd.permdock.approval+jwt, vnd.permdock.policy+jwt, vnd.permdock.capability+jwt, vnd.permdock.evidence+jwt; vnd.permdock.run+jwt and vnd.permdock.support-session+jwt are new
    joseTokenSigner({ key, alg, kid })joseTokenSigner({ key, alg, kid, issuer, audience? }); sign takes audience, expiresAt, issuedAt and jti
    Snapshot issuedAt, expiresAt in Unix secondsRFC 3339 date-times
    Snapshot and approval delegation.scopes: ["a", "b"]delegation.scope: "a b", plus authorization_details
    Policy document id, issuedAt inside the policy claimjti and iat
    Capability id, expiresAt inside the capability claimsub and exp; optional cnf.jkt binds the link to a DPoP key
    Approval JWS { token, permission, resource, status }jti (the request id), act, token, resolved_by, approvals and one authorization_details entry
    Approval token, catalog fingerprint, payloadDigest: pd1.<hex> or bare base64urlsha-256:<base64url> over RFC 8785 JSON
    Supabase membership claims expiresAt, grantedBy, managedBy; break-glass expiresAtexpires_at, granted_by, managed_by; expires_at

    JSON Schemas for the snapshot, approval signature, capability, policy, evidence export and credential are at schemas/<name>-v1.json.

  • Breaking: options types drop their verb prefix, Ctx is spelled Context, the JWT and Clerk resolver factories lose create because they return a function, and permdock/node drops the fromResponse alias of sendResponse. Run permdock codemod 0.5 to apply them.

    OldNew
    DefinePermissionsOptionsPermissionsOptions
    SignCapabilityOptionsCapabilityOptions
    SignRunTicketOptionsRunTicketOptions
    StartAccessReviewOptionsAccessReviewOptions
    StartAutomationOptionsAutomationOptions
    VerifyWebhookOptionsWebhookOptions
    UseRolesOptionsRolesOptions
    ConvexCtxLikeConvexContextLike
    createJwtSubjectResolverjwtSubjectResolver
    createClerkSubjectResolverclerkSubjectResolver
    fromResponsesendResponse
    fromResponsesend
  • Breaking: the better-supabase peer range is >=0.9.0 <0.10.0, because authorizationHooks and the provider's permitted, operations and delegation fields exist only from 0.9. Upgrade better-supabase with permdock.

  • Breaking: the permdock/cloud client follows the settled Cloud contract (schemas/cloud-api-v1.json). For the PermDock-Cloud repository: the new PermDock-Subject header on GET /v1/environments/:env/snapshot, the pushed-policy-v1, connector-v1, run-v1 and support-session-v1 formats, and the approver token claims below.

    BeforeAfter
    cloud().snapshotscloud().snapshotsFor(token): a SnapshotSource for the subject an at+jwt proves, sent as PermDock-Subject
    cloud().catalog.push(catalog) resolves to { fingerprint }CloudCatalogPush: { version, fingerprint, findings }, or { version, fingerprint, unchanged: true } when the fingerprint is already published
    The policy permdock cloud push sends: { fingerprint, scopes?, grants }PushedPolicy with v: 1, from permdock/catalog, validated by schemas/pushed-policy-v1.json
    Approver token: sub and a permdock_approval detail with id, status, etag?Also roles, memberships and tenant; the detail adds permissions, relations and vouched. cloud({ approver: { permissions?, relations? } }) reads them, typically from approverPermissions and approverRelations
  • Breaking: the permdock CLI now shares better-supabase's CLI contract. Groups have real subcommands (permdock openapi emit, permdock skills install, permdock arazzo check), and flags follow one vocabulary. permdock codemod 0.5 rewrites the old spellings in package.json scripts and CI workflows. Until 1.0, an old spelling exits 2 with flag_renamed or command_moved and names the new one.

    CLI beforeCLI afterCommands
    permdock openapipermdock openapi emit
    permdock skillspermdock skills install
    permdock arazzopermdock arazzo check
    --db, --db-url--db-url-stdin or DATABASE_URLrls generate, rls import, rls verify, supabase hook generate, powersync verify
    --force--force-rlsrls generate
    --format, --emit--kindrls verify, catalog (json is catalog, schema is json-schema), openapi emit
    --from--policyrls generate, rls verify, rls migrate, powersync generate, powersync verify, openapi emit
    --from--permissionscatalog, arazzo check
    --schema--validatorrls import, openapi import
    --strict--fail-on warningusage, config, doctor
    --write--scope catalog:writelogin
    --agent, --client--forskills install, skills update
    --src--out-dirinit
    --rbac-scaffold--rbac supabaserls generate, rls verify, rls migrate
    --write, --retire-out onlywrites by default; --dry-run previewsrls migrate
    --environment--project <id>cloud push
    --legacyremovedscan

    --json, and agent mode by default, now print one cli-result-v1 envelope for every command: the report moves into data, and a failure is in error as Problem Details with a snake_case code. Exit 3 means the run needs input, a login or the person's consent, and next lists the commands that continue it. --help --json prints the command tree as cli-commands-v1.

    New: --agent auto|yes|no and PERMDOCK_AGENT; --confirm <token> for commands that rewrite project files, publish to the Cloud or overwrite with --force in agent mode; --format github|sarif for findings; --debug; --dry-run and --check on every command that writes files; --db-url-stdin, --key-stdin and --token-stdin; permdock whoami; and permdock completion bash|zsh|fish. The CLI no longer depends on citty.

  • Breaking: the permdock CLI now uses better-supabase's problem codes, exit codes and help document. An internal error exits 1, a missing positional exits 3 with missing_input, and every problem type links to its row on the new CLI errors page. --help --json returns cli-commands-v1 in the shared shape (name, version, options, commands with path, effects and arguments), and an agent-mode consent token is 16 hex characters bound to the reasons, the working directory and the argv.

    No flag takes a secret as its value any more. --db-url is gone: pipe the connection string to --db-url-stdin, or set DATABASE_URL or SUPABASE_DB_URL, the order better-supabase reads them. skills install --client is --for. permdock codemod 0.5 rewrites --client and lists each --db-url call site for you to change.

  • Breaking: times follow one rule: NumericDate in JWT and SQL-read claims, RFC 3339 in JSON records and HTTP bodies, whole seconds for durations, and an Instant ({ epochMilliseconds }, such as a Temporal.Instant) for every runtime now. A duration that is not a positive integer throws at definition time, and a now that is not an Instant denies with validation.

    BeforeAfter
    Credential createdAt, expiresAt: Unix secondsRFC 3339
    apiKeyVerifier touch(id, at): at in Unix secondsat: Instant; lastUsedAt(id) is RFC 3339
    approval.ttl, escalation.after: "30m"1800 (seconds)
    memoryApprovalStore({ ttl }), requestApproval ttl: millisecondsseconds
    DEFAULT_APPROVAL_TTL_MS (3 600 000)DEFAULT_APPROVAL_TTL (3600)
    limit: { per: "1h" }limit: { per: 3600 }
    breakGlass / supportAccess maxDuration, consent.durations, activate({ duration }): "4h"14_400 (seconds)
    remotePdp / Clerk resolver cache.ttl: "5s" or milliseconds5 (seconds, at most 30)
    Connection revalidate: millisecondsseconds
    validFrom, validUntil: RFC 3339 or Unix secondsRFC 3339 or an Instant
    Snapshot and catalog grant validity, inactive-grant detail: Unix secondsRFC 3339 (WireValidity)
    LimitDetail: { count, window, resetsAt: number }{ count, per, resetsAt: string }
    quota.resetsAt: Unix secondsRFC 3339
    now on decide, can, simulate, compileWhere, ORM toWhere, rateLimitHeaders, limit stores: Unix secondsInstant
    now on approval helpers, stores, approverRelations, access reviews: DateInstant
    Terminal runtime now and WebBotAuthOptions.now: () => number() => Instant
    buildLocalSnapshot(manifest, data, now), signSaasToken({ now }), verifySaasToken(token, now): Unix secondsInstant
    parseDurationRemoved
  • Core getPermDock(policy, user) always runs the policy's subject mapper on user. Before, a user object with an id and a roles or memberships array was taken as an already-mapped principal and skipped the mapper, so a mapper that narrows roles (for example, no roles until an email is verified) did not apply. A resolved Subject ({ principal, context }, as subjectFrom* helpers return) is still taken as is.

    To migrate, pass an already-mapped principal as a Subject: getPermDock(policy, { principal, context: {} }) instead of getPermDock(policy, principal). Otherwise make the subject mapper accept the principal shape it now receives.

  • Core and permdock/pdp replace createPermDock with getPermDock, which takes the same arguments and returns Promise<PermDock>, and getPermDockSync, which returns a PermDock and never a Promise. Passing a Promise-returning mapper or source to getPermDockSync throws and names getPermDock, instead of handing back a value that might be a Promise. Adapters keep createPermDock.

    BeforeAfter
    const permdock = await createPermDock(policy, user) from permdockconst permdock = await getPermDock(policy, user)
    createPermDock(policy, user) with synchronous inputs, where a Promise hurtsgetPermDockSync(policy, user)
    createPermDock from permdock/pdp (always async)getPermDock (async) or getPermDockSync (sync) from permdock/pdp
    Adapter option pdp: createPermDock from permdock/pdppdp: getPermDock from permdock/pdp
    permdock.derive(options) returned PermDock | Promise<PermDock>permdock.derive(options) always returns Promise<PermDock>

    Server and agent adapters build each request's instance with getPermDock, so their sources may stay async.

  • Decision events carry an optional model: the agent model gate (decideModel, permittedModels) sets it to the model id, and any call can pass it through the new DecideOptions.model. permdock/otel sets gen_ai.request.model from it. The permdock entry now also exports parseCloudEvent and parseCatalogEventData next to parseSinkEvents and the event schemas, so a receiver validates events without its own schema.

  • Every subject provider takes one claims option, a ClaimsMap, for where values live in the verified claims. Each field is a dot path or a function over the claims; a function that throws reads as absent.

    BeforeAfter
    JwtClaimPaths (permdock/jwt)ClaimsMap (permdock)
    subjectFromSupabase(claims, { roles: "user_role", tenant: "org_id" })subjectFromSupabase(claims, { claims: { roles: "user_role", tenant: "org_id" } })
    subjectFromSupabase(claims, { memberships: "m", plans: "p" })subjectFromSupabase(claims, { claims: { memberships: "m", plans: "p" } })
    subjectFromClerk(auth, { globalRoles: "publicMetadata.staff" })subjectFromClerk(auth, { claims: { roles: "publicMetadata.staff" } })
    ClerkGlobalRolesClaimPath

    subjectFromBetterSupabase takes claims for roles, tenant and memberships and keeps its plans option, which decodes better-supabase's feature codes. scimHandler takes claims: { tenant } for a JWT that names its tenant elsewhere; the default is still tenant, then tid. The SQL side keeps one name per setting (rls.tenantClaim, rls.roleClaim), because the database reads a top-level claim by name.

  • Extension interfaces share one shape. Every interface takes an optional name, which on('auth') reports when that source throws ({ reason: 'source-threw', source: 'memberships', name }). Every DirectoryStore method may now answer with a value or a Promise, like the other interfaces.

    webBotAuthVerifier(options) returns an object, like every other verifier:

    BeforeAfter
    webBotAuthVerifier(options)(request)webBotAuthVerifier(options).verify(request)
    a hand-written webBotAuth: async (request) => actorwebBotAuth: { verify: async (request) => actor }
    DirectoryStore methods returned Promise<T>T | Promise<T>; a caller that chains .then awaits instead
  • Feature requests are free functions that take the instance first, so getPermDock no longer references their modules and an app that does not call them does not ship them. A plain definePolicy + getPermDock bundle drops from 54.3 KB to 46.7 KB gzip, and permdock/react from 21.8 KB to 19.4 KB (measured with esbuild, minified, tree-shaken).

    BeforeAfter
    permdock.decideRoleChange(change, options)decideRoleChange(permdock, change, options)
    permdock.decideCredential(request, options)decideCredential(permdock, request, options)
    permdock.decideAutomation(request, options)decideAutomation(permdock, request, options)
    permdock.decideSupportSession(request, options)decideSupportSession(permdock, request, options)
    permdock.activate(input)activate(permdock, input)
    permdock.whoCan(permission, row)whoCan(permdock, permission, row)
    permdock.simulate({ arazzo, openapi })simulateArazzo(permdock, { arazzo, openapi })

    All seven are exported from permdock. On an instance built from a snapshot they deny with unsupported (whoCan lists nothing), as the methods did; on a PdpPermDock they use its local instance. simulateArazzo emits one simulate event per plan on a server instance.

    Hosted grants are an opt-in feature too: policies takes hostedPolicies(source) instead of a bare PolicySource, so the merge code ships only with apps that import it.

    BeforeAfter
    createPermDock(policy, user, { policies: source })getPermDock(policy, user, { policies: hostedPolicies(source) })

    Approval policies follow the same pattern: approvalPolicies takes approvalPolicies(source). memoryApprovalPolicySource([...]) already is that feature, so it needs no wrapper.

    BeforeAfter
    { approvalPolicies: mySource }{ approvalPolicies: approvalPolicies(mySource) }
  • Generated RLS quotes a role name that holds a comma, brace, quote, backslash or whitespace inside its array literal, so one role can never split into two, and compiles an empty in list to false and an empty notIn to is not null, the same answers as can(). Before, an empty list produced invalid SQL.

  • Grant limits are an opt-in feature: limits takes limits(store) instead of a bare LimitStore. The counting code ships only with apps that import limits, so a plain definePolicy + getPermDock bundle drops from 40.1 KB to 39.6 KB gzip, and permdock/server from 42.1 KB to 41.7 KB.

    BeforeAfter
    createPermDock(policy, user, { limits: store })createPermDock(policy, user, { limits: limits(store) })
    defineApp(policy, { limits: memoryLimitStore() })defineApp(policy, { limits: limits(memoryLimitStore()) })

    A grant with a limit and no limits still denies with limit-unavailable, dev still fills in limits(memoryLimitStore()), and prod still throws at startup.

  • Ids that an integrator supplies and core only compares for equality are open unions: the values PermDock sets still autocomplete, and an application's own id type-checks.

    TypeWhereKnown values
    ActorKindActor.kind, a policy delegation's to.kindmcp-client, oauth-client, support, ai-sdk, …
    AdapterIdDecideOptions.adapter, DecisionEvent.adapter, ApprovalRequest.adapterevery adapter entry
    MembershipViaMembership.via, viaOnly, membership and access eventsdirect, contact, credential, support, scim, …
    OpenUnion<"scim">DirectoryEvent.sourcescim

    directory-event-v1.json now accepts any string source, so a directory sync other than SCIM can emit the same event. Unions that core interprets member by member stay closed: denial reasons, approval modes, condition operators, credential kinds, delivery channels and problem types.

  • New permdock/chat-sdk entry, with chat 4 as an optional peer. chatSdkAuthor turns a Chat SDK Author into a ChatAuthor, and is null for bots. chatSdkTransport is the chat channel of permdock/delivery and posts direct messages. approvalCard renders an approval prompt with a link to the approval page. approvalActions applies its approve and reject buttons as the clicking user through ChatPermDock.resolveAction.

  • New permdock/chat entry. subjectFromChat resolves a verified ChatAuthor through principalByIdentity, and an unlinked author is anonymous. createPermDock returns ChatPermDock: protect(operation, handler) decides each command as that principal and opens one approval request per command, and resolveAction applies an approve or reject verdict by request id. The requester never approves their own request.

  • New permdock/delivery entry. Its createPermDock returns a DeliveryPermDock whose deliver checks every recipient with decideFor, routes it to the email, chat or webhook transport, and writes one com.permdock.delivery.* event per recipient. It also adds audience, subscribersFor, approvalPrompt (ApprovalPrompt v1, with no token), webhookTransport (Standard Webhooks, CloudEvents) and memoryDeliveryTransport; permdock/testing adds testDeliveryTransport.

  • New permdock/h3, permdock/sveltekit, permdock/astro, permdock/solid-start and permdock/tanstack-start entries. Each createPermDock returns middleware(), protect(permission | operation, data), getPermDock, getSnapshot, connection and permdockHandler(); the h3, SvelteKit, Astro and SolidStart adapters add withPermDock(handler). A refusal or a thrown PermDock error is RFC 9457 Problem Details. h3, @sveltejs/kit, astro, @solidjs/start and @tanstack/react-start are optional peers.

  • New permdock/resend entry, with resend 6 as an optional peer. resendTransport is the email transport of permdock/delivery: it maps Resend errors to retryable or final failures and fans out through batch.send. approvalEmail renders an approval prompt that only links to the approval page. resendWebhook turns delivered, bounced, complained, failed and suppressed events into delivery events.

  • New policyFromCatalog(catalog, pushed) on permdock/catalog rebuilds an evaluable policy from permissions.catalog.json and the pushed policy, for a service with no application code; what only code can answer denies. catalogDrift and hostedGrantFindings compute the findings of com.permdock.catalog.drifted. The catalog now carries each resource's parent, its links and the vocabulary roles.

  • Option names match across adapters.

    BeforeAfter
    permdock/workflow createPermDock(policy, { approvals: store })createPermDock(policy, { store })
    permdock/chat createPermDock(policy, { approvals: store })createPermDock(policy, { store })
    customRoleSource({ rolesOf: (tenant) => … })customRoleSource({ rolesFor: (tenant) => … })

    store is the approval store option on every adapter, and the reader's method has the same name as CustomRoleSource.rolesFor.

  • Presets. permdock/preset resolves an archetype (b2b, agent, marketplace, api, internal, consumer) plus features, auth, backend, framework, integrations and Cloud services into a preset, encodes it as a versioned code (p1…) and generates the application's own files: permissions.ts, policy.ts, a defineApp in permdock.ts, auth, backend, framework and agent wiring, and permdock.config.ts. permdock init --preset <code> (or --archetype, --framework, --auth, --backend, --feature, --integration, --service, the same ids /create offers) writes them without overwriting existing files and prints the install and shadcn commands; permdock preset decode|url <code> reads a code.

  • Request bodies are read up to a byte cap and answered with 413 past it, whatever Content-Length says: 1 MiB for the AuthZEN endpoints, evaluationsHandler, scimHandler, the SSF receiver from createReceiver and webhookVerifier, 16 KiB for approval and access-review notes, 1,000,000 bytes for resendWebhook. Before, these handlers read the whole body first, and the Resend and approval caps counted characters.

  • Resuming an approval checks that the stored request belongs to the caller's principal, and a remote PDP answer of approval-required without a token now denies with pdp-invalid-response. Before, a remote PDP that omitted the token gave every caller the same empty token, so one approval could resume another subject's call.

  • Support sessions let a staff member view the app as one person: permdock.decideSupportSession requires a reason and, by default, an approval by someone else, and signSupportSession and subjectFromSupportSession from permdock/server carry the session with the staff member as a support actor. A support actor can never approve a request, and the tenant setting supportSessions only tightens.

  • The CLI signs in to PermDock Cloud and reads what was published. permdock login runs the RFC 8628 device flow against https://permdock.com/api (--loopback for the RFC 8252 browser redirect with PKCE, --write to add catalog:write, --url for another issuer) and stores the credential outside the repository through permdock/terminal; permdock logout revokes and deletes it. permdock cloud pull --project <id> writes permdock.manifest.json and permissions.catalog.json as supabase inspect --out and collect write them, checks the fingerprint, and restores the previous files on a mismatch. permdock rls generate --project <id> builds its policy from the project with policyFromCatalog. PERMDOCK_CLOUD_TOKEN, a read-only key pinned to one environment, authenticates pull and rls generate --project in CI. permdock cloud push also sends manifest (--manifest) and permdockVersion, and accepts a login with catalog:write when PERMDOCK_CLOUD_KEY is unset. @napi-rs/keyring is an optional peer for the OS keychain.

    The docs MCP server moved from https://permdock.com/mcp to https://permdock.com/docs/mcp; the permdock skill names the new URL. https://permdock.com/mcp is now the PermDock Cloud MCP server.

  • The Resend and PermDock Cloud webhook receivers answer 400 for missing or malformed signature headers and 403 for a signature that does not verify. They answered 401 without the WWW-Authenticate header RFC 9110 section 15.5.2 requires; a webhook has no authentication scheme to name there.

  • The SSF push receiver answers a request that is not a POST with 405 Method Not Allowed and Allow: POST, instead of 400 invalid_request.

  • The SSF receiver refuses a SET without exp once its iat is older than maxTokenAge (default 86400 seconds), and keeps each replay key until the SET would no longer verify. Before, with a clockTolerance above zero, a captured SET without exp could be delivered again after its replay key expired.

  • The @permdock shadcn registry at https://permdock.com/r: gated-button, approval-request-dialog, tenant-switcher, role-picker, custom-role-editor, upgrade-prompt, and gated-button-native and upgrade-prompt-native for React Native Reusables. Each is markup over useGate and the other hooks, installed as your own code with npx shadcn add. /r/preset-<code>.json installs a preset's files and recipes in one command.

  • The PermDock-Approver token cloud().approvals.resolve sends is now bound to one verdict: it carries a permdock_approval authorization_details entry with the request id, the verdict status and, when the Cloud sends one, the request etag, plus a fresh jti. resolve reads the request through GET /approvals/by-token before it signs, and throws the Cloud's code (approval-not-found by default) when that read fails.

  • The permdock-wire skill now starts a new app from a preset with permdock init, adopts an existing app beside its own checks with shadowMode and permdock scan, and points to the @permdock recipes for gated UI. Its new references/presets-and-recipes.md sets out what the package owns and what the app owns.

  • The subject option of createPermDock in permdock/next, the HTTP adapters and the agent adapters now types a full Subject as a valid return, as it already worked at runtime, so subject: () => subjectFromClerk(await auth()) compiles against an app whose policy has a typed User.

  • The application's own data, x, now rides on approval requests, sink events and SCIM resources. It is plain JSON and is never read by a decision.

    • requestApproval(store, decision, { x }) stores it as ApprovalRequest.x, and approval-request-v1.json lists it.
    • decide(permission, row, { x }) puts it on the decision event. The other event builders (membershipEvent, credentialEvent, accessEvent, automationEvent, supportSessionEvent, deliveryEvent) take x too and throw when it is not plain JSON. A decision drops an invalid x instead of throwing.
    • SCIM Users and Groups carry it in the urn:ietf:params:scim:schemas:extension:permdock:2.0:AppData extension (DirectoryUser.x, DirectoryGroup.x, APP_DATA_EXTENSION).

    The formats stay v1: x is optional. The event schemas set additionalProperties: false, so each now lists x. A consumer that validates events against a copy of an older schema must refresh that copy before events with x arrive.

  • The approval store reaches an adapter only through the app or the adapter's own store option. Adapters no longer import a memory store for the dev profile, so every server, agent and UI adapter bundle is about 2.2 KB gzip smaller (permdock/server 41.7 KB to 39.5 KB, permdock/ai-sdk 38.6 KB to 36.4 KB, permdock/next 45.9 KB to 43.5 KB).

    Under profile: "dev", defineApp now fills in one memory ApprovalStore that every adapter of the app shares, instead of one store per adapter. A request opened through one adapter can be resolved and resumed through another. prod is unchanged.

  • The catalog lists a policy's oauthScopes as oauthScopes: [{ scope, permissions }], and authorizationProvider from permdock/better-supabase merges them into delegation.scopes, so better-supabase's SQL checks accept a token whose scope is mcp:read. New doctor check PD070 warns when the catalog on disk lacks them; run permdock collect.

  • Tools to adopt PermDock in an existing app. shadowMode({ legacy, enforce, onMismatch }) is a wrap that asks the application's legacy check and PermDock on every check, returns the legacy answer unless the permission is in enforce, and reports each disagreement. testLegacyParity(policy, legacy, cases) in permdock/testing pins the intended answers. permdock scan lists the role comparisons, hasRole/hasPermission helpers, CASL abilities, Clerk has() calls and role claims left in the code.

    wrapPermDock now keeps the instance's internals, so feature functions (whoCan, decideCredential) work on an instance wrapped by an adapter's wrap or withOtel.

  • With rls.readOnlyActors, rls generate now writes permdock_actor_may_write(), which is false for a read-only support or impersonation token, so hand-written write policies in --helpers-only mode can call it. rls verify --introspect --helpers-only reports each insert, update or delete that authenticated reaches without calling it. The Supabase manifest lists the function in rls.helpers.

  • With a verifier configured, the client store refuses an unsigned snapshot from refresh and turns stale. Before, a plain JSON body from snapshotUrl was applied without verification, which let a network attacker downgrade a signed endpoint.

  • <Protected>'s denied slot is denied in every UI kit, matching <PermissionBoundary>. In React, Vue and Solid, fallback means a loading or error state, so it read as the wrong thing.

    BeforeAfter
    <Protected permission={…} fallback={<Locked />}> (React, React Native, Next.js, Solid)<Protected permission={…} denied={<Locked />}>
    Vue #fallback slot, or { fallback: () => … }#denied slot, or { denied: () => … }
    Svelte {#snippet fallback(decision)}{#snippet denied(decision)}
    PermDockProvider defaults={{ fallback }} and the Vue, Svelte and Solid equivalentsdefaults={{ denied }}
    view.slot === "fallback" (viewFor)view.slot === "denied"

    approval still falls back to denied. pending, deniedResponse, deniedText and onDenied keep their names.

  • ApprovalPolicySource entries can match an operation's risk and effects from its meta as well as a permission key. permdock rls generate with rls.approvals emits permdock_is_approver(p_approvers jsonb, p_tenant text) for row-level policies on approval views.

  • CatalogFindingCode adds operation-risk-raised and operation-approval-removed, and CatalogFinding gains operation, previous and risk. operationFindings(previous, next) in permdock/catalog computes them, permdock diff lists them under operations without marking them breaking, and catalog-event-v1.json accepts them.

  • accessReviewApplier counts a permission the member still reaches behind an approval as held. Before, an approval-required re-check marked the revoked item applied while the member could still use the permission after an approval.

  • assignableRoles, oauthScopes permission lists and permdock import output sort keys by code point instead of localeCompare, so the order no longer depends on the ICU locale; mixed-case keys now list upper case first.

  • authorizationProvider from permdock/better-supabase reads varchar and character varying scope ids as text, the same aliases better-supabase accepts.

  • authorizationProvider from permdock/better-supabase takes approvers, keyed by request kind, and fills better-supabase's isApprover through permdock_is_approver. New accessReviewApplier applies an access review's revoked items through the organizations and invitations blocks, then marks each item applied.

  • cloud({ approver: { signer, audience? } }) signs a PermDock-Approver header for each approvals.resolve: an RFC 9068 at+jwt with sub set to the approver's principal id, aud set to <environment URL>/approvals and a 60-second lifetime. resolve now throws approver-unauthenticated without a signer and approver-not-eligible for a verdict with an actor; a system rejection needs no signer. TokenSigner accepts typ: "at+jwt", which cloudSigner refuses.

  • com.permdock.automation.published, .changed, .revoked and .run are no longer reserved: automationEvent builds the new automation sink event, published as automation-event-v1.json, and WorkflowPermDock.start writes a run event to sink. supportSessionEvent builds the access event of a support session, which gains optional session and permissions fields.

  • defineApp(policy, options) binds an app's sources, features and services (memberships, customRoles, relations, entitlements, principals, settings, policies, approvalPolicies, limits, sink, store) to a policy. Core getPermDock and every adapter read them, and an adapter's own options win key by key. profile: "dev" fills in a memory limit store and a memory approval store; profile: "prod" (the default) throws at startup when a grant needs a store or limits the app does not configure.

    permdock/eve and permdock/openai no longer fall back to a memory approval store on their own: pass store, or use defineApp with profile: "dev".

  • defineOperations binds named actions to permissions with typed data, a results filter and meta, and permdock collect writes them to the catalog as operations (doctor PD067). PrincipalSource with memoryPrincipalSource and testPrincipalSource loads principals by id or identity link. permdock.decideEach decides a list of rows in order, and permdock.decideFor decides for another principal from the new principals option without widening the caller or consuming a limit. A kind: 'contact' principal keeps only its on memberships, reads by default and writes only through a role with for: ['contact']; it never approves or creates keys. permdock/server adds signRunTicket, parseRunTicket and subjectFromRunTicket for vnd.permdock.run+jwt run tickets, which re-read the principal and the automation on every use. getPermDock and every adapter createPermDock take a settings option (SettingsSource) that permdock.decideCredential reads when a call passes none.

  • definePolicy takes one mapper name, subject, as AuthZEN, JWT (sub) and the subjectFrom* helpers do. The principal alias is removed, and subject is required by the type.

    BeforeAfter
    definePolicy(permissions, { principal: (user) => … })definePolicy(permissions, { subject: (user) => … })
  • memoryApprovalStore({ now }) takes a clock returning an Instant; create, cancel, and consume or expire without an at read it instead of the system clock.

  • permdock casl import and permdock casbin import turn rules kept in another library into a generated module with permissions and a policy of roles.

    • casl import --rules <file> --out <file> reads each role's ability.rules or packRules output. Inverted rules become denies, manage and all expand, fields carry over, and the Mongo-query condition subset becomes where.
    • casbin import --model <file> --policy <file> --out <file> reads an RBAC model, with or without domains, under the standard matcher. Role inheritance is flattened, deny rows become denies, and user-to-role lines become an assignments export.

    Both report every rule they cannot translate. A deny is never dropped silently: a CASL deny keeps its effect without the condition, and casbin import exits 1 when a deny line did not import. scan --legacy points at casl import when it finds CASL abilities.

  • permdock catalog --out - prints the catalog instead of writing a file named -, and rls generate --out - keeps stdout to the SQL. Commands that only write a file refuse --out - with invalid_value. A bare group or root under --json lists its subcommands as choices["<command>"], the shape the shared result schema defines.

  • permdock codemod 0.5 renames fallback to denied on <Protected>, in a Vue h(Protected, props, slots) call and in PermDockProvider defaults, and lists Vue #fallback slots and Svelte fallback snippets as manual follow-ups.

  • permdock codemod 0.5 renames the rolesOf key of a reader passed straight to customRoleSource to rolesFor.

  • permdock codemod 0.5 reports subjectFromApiKey only in the old curried shape, subjectFromApiKey(options)(key), and leaves subjectFromApiKey(key, options) alone. It reports a source option key only on an object passed to a PermDock call, not on every object literal in a file that imports permdock.

  • permdock codemod 0.5 rewrites await createPermDock(…) from permdock to await getPermDock(…), any other core createPermDock to getPermDockSync, and createPermDock from permdock/pdp to getPermDock. A core createPermDock(…) that is returned or chained with .then is also listed as a manual follow-up.

  • permdock codemod 0.5 rewrites permdock.decideRoleChange(…), decideCredential, decideAutomation, decideSupportSession, whoCan, activate and the Arazzo form of simulate into the free functions that take the instance first, and imports them from permdock.

  • permdock codemod 0.5 rewrites permittedIds(permdock, …) and mayUse(permdock, …) to the instance methods permdock.permittedIds(…) and permdock.mayUse(…) and drops the import once nothing reads it. It no longer lists decideCredential(permdock, request) as a call to change: it stays a function that takes the instance first.

  • permdock codemod 0.5 turns duration strings such as ttl: "30m", escalation.after, limit.per, maxDuration, duration and consent.durations into whole seconds inside a call to a PermDock import, and lists the same keys elsewhere as manual follow-ups.

  • permdock codemod 0.5 wraps an approvalPolicies source in approvalPolicies(…) and a policies source in hostedPolicies(…) where the options object goes straight to createPermDock, getPermDock or getPermDockSync, and lists other approvalPolicies keys as manual follow-ups.

  • permdock doctor PD014 no longer reports the jwks option of cloudApprovalWaiter, verifyWebhook and webhookVerifier: it holds Standard Webhooks keys, not a token issuer's.

  • permdock rls generate in database mode writes permitted_<scope>_users(p_permission, p_id) for each scope whose memberships are in a table: the users who hold a permission key on one instance, through a membership there or a global role, with denies, custom roles, expiry and suspension applied as permitted_<scope>_ids_by_permission_for applies them. No client role may execute it; grant execute to the backend role that calls it. The Supabase manifest lists it in rls.helpers, and supabase-manifest-v1.json accepts the name, so a reader validating against the previous schema rejects a manifest that lists it.

  • permdock rls generate with --seeds-out and --backfill-out naming the same migrations directory gives each new file its own version: the seeds migration one second after the newest migration and the backfill one second after that. Both used to get the same version, which Supabase refuses.

  • permdock rls import reads the where of a membership subquery instead of dropping it. A subquery over a mapped membership table imports as memberOf only when it binds the user and the policy row, and its role literals become roles, so exists (select 1 from org_members m where … and m.role = 'owner') imports as owners, not as every member. A subquery with any other predicate stays opaque.

  • permdock/a2a answers a token that lacks a skill's scope with 403 and WWW-Authenticate: Bearer error="insufficient_scope", as RFC 6750 section 3.1 requires. It answered 401, which tells a client its token is missing or invalid.

  • permdock/agent adds createPermDock, which returns the agent contract the AI SDK, OpenAI Agents, Claude Agent SDK and Eve adapters now share: decideOperation, allowedOperations, decideModel and permittedModels over a new models option, filterResults by an operation's results permission, and gatewayOptions for AI Gateway attribution. testAgentRuntime from permdock/testing runs that contract against any implementation.

  • permdock/authzen answers 400 for a request without Content-Type: application/json and for a missing required entity or field, as AuthZEN 1.0 sections 10.1 and 10.1.1 require. Before, an evaluation without subject, action or resource answered 200 with decision: false, and an action search without a resource listed actions across every resource type. A numeric resource.id is now refused: the specification types it as a string.

  • permdock/authzen exports its batch helpers, EVALUATIONS_SEMANTICS, evaluationsSemantic, evaluateBatch and mergeEvaluationItem, with the EvaluationsSemantic, AuthzenItem and AuthzenEntity types. permdock exports OPERATION_RISKS, the risk levels lowest first, and isOperationRisk.

  • permdock/better-supabase adds hookCan and handlerCan for better-supabase/workflow-sdk, supportPolicy for supportSessions, subscriberPolicy for per-subscriber fan-out and principalSource for principals and identity links. authorizationProvider fills holdersOf with permitted_<scope>_users and actorMayWrite with permdock_actor_may_write() when the manifest lists those helpers.

  • permdock/cloud adds cloudApprovalWaiter, an ApprovalWaiter whose webhook(request) wakes parked runs on verified com.permdock.approval.resolved, .expired and .cancelled events. It also adds cloudDeliveryTransport(channel) for the Cloud's hosted sender, cloudSigner(), a TokenSigner over the environment key for run tickets and other app-issued tokens, and cloud().catalog.push(catalog); PermDockCloudEvent now includes the automation and delivery families.

  • permdock/hono, express, fastify, elysia and nest return getPermDock(request), and permdock/trpc and orpc return getPermDock(opts): the PermDock for one request outside the middleware, as on permdock/server and permdock/node.

  • permdock/openai, permdock/claude-agent and permdock/eve take unmapped, context, otel, wrap and deniedText as permdock/ai-sdk does, and permdock/ai-sdk takes otel; operations accepts the map defineOperations returns. permdock/mcp takes actor and delegation, which replace the actor and delegation built from the verified authInfo.

  • permdock/scim exports isDirectoryUniquenessError and isDirectoryNotFoundError. Both match by name and code, so a custom DirectoryStore that throws the error from another copy of the module still maps to 409 or 404.

  • permdock/ssf transmits as well as receives: signSet signs a Security Event Token, pushSet delivers it over RFC 8935 push, and setPollHandler serves RFC 8936 poll from a SetQueue (memorySetQueue in process). caepEvents and riscEvents build the CAEP and RISC events, and the stream configuration types are exported. testSetQueue in permdock/testing is the queue's conformance runner.

  • permdock/supabase reads an agent act level as better-supabase does: act.read_only becomes readOnly (default false). A level with session_id, tools that are not non-empty strings or a non-boolean read_only is invalid-chain. An actor with readOnly: true is denied every permission without readOnlyHint (not-delegated), with or without a policy delegation. permdock_actor_may_write() and the rls.readOnlyActors policies refuse a write by an agent with read_only: true.

    Breaking: an agent actor's tools list is enforced. permdock/agent, the agent adapters and permdock/mcp deny any tool it does not name with the new denial reason agent-tool-not-delegated and hide it from tool lists. better-supabase's agentClaims writes tools: [] unless given a list, so mint agent tokens with tools set to the tools the run may call.

  • permdock/terminal finds the RFC 8414 metadata of an issuer with a path at the path-inserted URL (https://permdock.com/.well-known/oauth-authorization-server/api for https://permdock.com/api), then at the appended one, and refuses metadata whose issuer differs from device.issuer. A token response's scope is stored with the credential.

  • permdock/terminal reads device authorization, token and GitHub Actions OIDC responses through the 1 MiB body cap; a larger response yields no token instead of being buffered whole.

  • permdock/testing adds testApprovalWaiter, testAutomationSource and testSupportSessionSource, the conformance runners for an ApprovalWaiter, an AutomationSource and a SupportSessionSource.

  • permdock/testing adds testDecisionProvider and testSnapshotStorage, so every interface on the extension interfaces page has a test<Interface> runner. testDecisionProvider also checks that a provider denies when its transport fails.

  • permdock/workflow-sdk runs automations on the Workflow SDK: workflowSdkWaiter parks a run on a hook while an approval is pending, startAutomation starts a Workflow SDK run only after PermDock grants the start, and authorizeHook resumes a hook only for a caller with the permission.

  • permdock/workflow adds automations. permdock.decideAutomation checks a publisher may hand out an automation's operations and returns an Automation record; createPermDock from permdock/workflow starts runs as run tickets, rebuilds each step with the publisher's live rights narrowed to the automation, and waits on approvals through an ApprovalWaiter such as pollingApprovalWaiter. openApproval and resumeApproval split that wait into two steps for runners that park a run themselves.

  • presetMatrix(preset) in permdock/preset lists, per role and action, whether a preset's policy allows it (allow, own, pro or none) and whether it needs approval or carries a limit, from the same model the generated policy is written from. permdock.com/create shows it next to the generated files.

  • rls generate --split and supabase hook generate now write for Declarative Schemas 2.0 (pg-delta, supabase db schema declarative sync) unless supabase/config.toml sets [experimental.pgdelta] enabled = false or the project sets supabase.schemas: 'migra' | 'migrations' or --schemas. --grants-out is refused outside migra, and helpers without seeds and --seeds-out is refused under migra. Doctor PD068 fails when config.toml does not turn pg-delta on. PD069 warns about migra leftovers. The manifest's new hook.schemas field picks the better-supabase grantsCommand.

  • rls generate no longer lets a member of one organization read another organization's rows. A memberOf check over a membership table compared m.<column> = "<row field>" inside its subquery, and when the membership table had a column of the same name (org_id, project_id, id), Postgres compared the membership column with itself. The check is now "<row field>" in (select m.<column> from <table> m where …), and the suspension check is coalesce(<id> in (select s.<id> from <table> s where …), false). Regenerate and apply your RLS.

  • rls migrate and rls import read role checks, not only permission checks.

    • rls.roleValues maps a role value the existing SQL compares against (a string literal or an enum label) to the PermDock role it is: roleValues: { org_admin: 'owner' }.
    • rls.migrate.helpers takes a role form: has_org_role(org_id, 'org_admin') becomes (org_id in (select permdock.member_organization_ids(array['owner']))). rls generate writes the overload member_<scope>_ids(p_roles text[]) for each scope a role helper names, and a shim keeps unrewritten callers working. A role argument that is not a literal is skipped with dynamic-role; an unmapped, undeclared role with unknown-role.
    • rls import reads role = any(array[…]) and enum casts in membership subqueries, and writes the PermDock name for each mapped role value in memberOf conditions and the imported role_permissions rows.
  • schemas/cloud-api-v1.json adds the platform issuer and the projects read API at https://permdock.com/api, and testCloudApi(url, keys, { platform }) checks them. For the PermDock-Cloud repository:

    Route or fieldContract
    GET /.well-known/oauth-authorization-server, also at https://permdock.com/.well-known/oauth-authorization-server/apiRFC 8414 metadata with issuer: "https://permdock.com/api", S256 only
    GET /oauth/authorize, POST /oauth/device_authorization, POST /oauth/tokenAuthorization code with PKCE (loopback redirects for permdock-cli), RFC 8628 device flow, refresh rotation; scopes projects:read, policy:read, catalog:write
    POST /oauth/revoke, POST /oauth/registerRFC 7009 (200 for an unknown token); RFC 7591 for MCP clients, 400 invalid_redirect_uri for a plain http redirect
    GET /v1/projects, GET /v1/projects/:id, GET /v1/projects/:id/policyA login with the scope or PERMDOCK_CLOUD_TOKEN; RateLimit and RateLimit-Policy on every 200, Retry-After on 429; 404 policy-not-published before the first push
    POST /v1/environments/:env/catalogBody adds manifest (supabase-manifest-v1) and permdockVersion; a login with catalog:write may push; PERMDOCK_CLOUD_TOKEN answers 403

    policyFromCatalog keeps the pushed grants' role order, so rls generate --project writes the same SQL as rls generate from the code policy.

  • schemas/cloud-api-v1.json is the OpenAPI document of the PermDock Cloud API, including the client_credentials grant for callers of the hosted decision service, and schemas/connector-v1.json describes a connector. testCloudApi(baseUrl, keys, options) in permdock/testing runs the conformance runners and the HTTP contract checks against one Cloud environment and validates every response body against cloud-api-v1.json.

  • signSnapshot(snapshot, signer, { audience? }), snapshotFromClaims and signPolicyDocument(document, signer, { audience, expiresAt? }) are exported from permdock, and signApproval(request, signer, { audience? }), approvalSignatureClaims, parseApprovalRequest and APPROVAL_REQUEST_SCHEMA from permdock/approvals. schemas/run-v1.json and schemas/support-session-v1.json describe the run ticket and support-session tokens.

  • startAccessReview lists who holds a set of permissions, and a reviewer can keep or revoke each holding. PermDock records the decision. The application changes the role or membership, then marks the item applied.

  • subjectFromJwt and jwtSubjectResolver require audience when no verifier is passed. Without it, a token minted for another resource server at the same issuer was accepted. Pass audience: false to accept any audience on purpose.

    BeforeAfter
    subjectFromJwt(token, { discovery })subjectFromJwt(token, { discovery, audience: "https://api.example.com" })
    no audience checkaudience: false
  • subjectFromJwt no longer accepts a sender-constrained token as a bearer token. Without sender, a token whose cnf carries jkt needs a valid DPoP proof, and one whose cnf carries x5t#S256 needs a matching certificateThumbprint. An explicit sender: "none" keeps the old behaviour for a gateway that verified the binding upstream.

  • subjectFromSupabase, actorOf and supabaseClaims() from permdock/supabase read the act.kind: "agent" claim better-supabase's agentClaims mints: the actor is { id, kind: "agent", tools } and the token's scope becomes its delegation. Before, such a token was an invalid chain and mapped to the anonymous subject.

  • useGate(permission, data?, { mode }) in permdock/react and permdock/react-native returns what a permission-gated control renders: allowed, pending, hidden, disabled, needsApproval, upgrade (the plans that would grant it) and a localised reason. gateView in permdock/client is the same computation without React.

  • better-supabase share links and approval covers, both needing better-supabase 0.9.0. The better-supabase peer range is now >=0.6.0 <0.10.0.

    • subjectFromShareLink(token, { shareLinks, links }) in permdock/better-supabase resolves a better-supabase share-link token into a link subject for exchangeCapability, so guest pages read under RLS. The link's expiresAt caps the capability, and a maxLifetime in the link policy fails closed for a share link without one.
    • rls.approvals: { delegations: true } generates the approval_delegations table with owner-only policies, and a four-argument permdock_is_approver(approvers, tenant, requester, resource) that also passes for an active, one-hop cover. rls.approvals.table is now optional: without it, only the delegations are generated.
    • authorizationProvider passes better-supabase's {requester} to the four-argument helper when the manifest lists it.
    • tableApprovalDelegationSource({ query }) in permdock/supabase reads the same table for approvalsHandler.

    When both are installed, PermDock owns approval delegation: don't also configure better-supabase's delegate_approval.

0.4.0 (2026-10-12)

  • HTTP adapters take onDenied to replace a refusal's Problem Details or Response, context to merge server-derived values into subject.context, and wrap with the new wrapPermDock helper; MCP and the AI SDK take the same context and wrap, and an onDenied that replaces the refusal text only. Behaviour changes: a protect loader that throws now answers 403 with reason validation instead of throwing, and Next.js requireAccess now runs the factory's onDenied unless the call passes its own.
  • Streamed subscription items wait for a pending revalidation, so an item after a revocation event is checked against the rebuilt instance instead of the revoked one. Connection gains settled(), which resolves once queued revalidations finish.
  • PermDockProvider (and the Vue plugin, Svelte setPermDock and Solid provider) takes defaults for the <Protected> slots, messages for the new useDescribe() (getDescribe() in Svelte), and onSnapshot, onClear and approvalInterval. <Protected approval> renders an approval-required decision and falls back to fallback.
  • allow(p, { obligations }) adds { kind: 'app', name, detail? } obligations to a granted decision, in process and through snapshots, and decision events, OCSF and OTel carry the grant name and the obligation names. A denied decision now carries permission, DenialDetails types each reason's detail, and describe(decision, { permission }) uses the leaf's meta.title.
  • approvalsHandler shows GET /:token for a request without a tenant only to its requester, who answered it and who may answer it; other principals get 404. A note over 2000 characters is a 400 and a body over 16 KiB a 413; the request stays pending.
  • createPermDock from permdock/next takes wrap, a PermDockWrap applied to each instance after otel and before the factory onDenied, as the HTTP adapters do.
  • definePermissions, defineRoles, definePlans and definePolicy take an x option with one Standard Schema per kind of app data, which checks and types meta.x on permissions, resources, roles, plans and grants and Membership.x on memberships. resource({ meta }), allow(p, { meta }), Membership.x and custom-role meta.x are carried to decisions, events, snapshots and catalog-v1 (optional meta on resources and grants), and PermDock never reads them; the Supabase sources read Membership.x from a jsonb column set with x.
  • joseTokenVerifier decrypts a nested JWE with any key in decryptionKeys, not only the first oct key. It accepts RSA, EC and OKP private JWKs, skips keys whose use, alg or kid do not fit the header, and tries the rest in order, so key rotation works.
  • permdock rls generate --db exits 1 (unavailable) when the database cannot be reached, instead of 2 (usage).
  • permdock/better-supabase adds authorizer({ policy }), better-supabase 0.8's Authorizer for PermDock: it decides each permission of a resource, action, route guard or MCP tool from the verified claims. The better-supabase peer range is now >=0.6.0 <0.9.0.
  • permdock/webmcp denial text names the resource id (Denied: post.update on p1.), as permdock/mcp does. permdock/a2a reads RFC 9396 entries from extra.authorization_details when extra.authorizationDetails is absent.
  • protect(null) in permdock/server now refuses a delegated token (one with an actor or a delegation) that carries no scopes, with the 403 insufficient_scope challenge. It passed before, while permdock/mcp refused the same token. First-party sessions are unchanged.
  • rls generate --backfill-out copies existing custom roles named in rls.customRoles.from into the custom-role tables, and rls.triggers and rls.audit declare app-owned and audit triggers on generated tables, which now carry an identity id primary key. rls migrate --retire-out drops each rls.migrate.tables table with its refresh triggers once nothing reads it, and doctor reports such a table as PD066 until then.
  • subjectFromClerk reads the globalRoles claim path through the shared path reader, so a __proto__, constructor or prototype segment yields no roles.
  • subjectFromJwt and createJwtSubjectResolver report a throwing memberships source through onAuth as { reason: 'source-threw', source: 'memberships' }. The subject still resolves without the extra memberships.
  • withOtel keeps instrumenting the instance derive() returns.

0.3.1 (2026-10-11)

  • permdock rls generate and permdock supabase hook generate read global roles only from the rows without a tenant when rls.roles references a roles table through through and rls.customRoleWrites.roles names that table with a tenant column. permdock_replace_global_roles resolved keys over every row, so replacing a user's roles with ['dispatcher'] inserted one row per tenant role named dispatcher and kept rows that referenced a tenant role. It now resolves, keeps and inserts only global rows, and a key only tenant roles have raises unknown-role. permdock_has and the token hook no longer read a global-roles row that references a tenant role as a global role.

0.3.0 (2026-10-10)

  • decideRoleChange checks a change to a global role. Pass scope: 'global' and no id for a role declared without on; RoleChange is now a union in which id is required for a named scope and absent for 'global', so a helper typed Partial<RoleChange> needs Extract<RoleChange, { id: string }>. The authority is the one assignableRoles({ scope: 'global' }) lists, which is new: the assignable global roles the subject may hand out through its own global roles. exclusiveWith, managedBy: 'idp' and the self-change rule apply as for a scoped role, a role held at a named scope is denied with scope, and an id on a global change is denied with validation. The snapshot-backed client answers assignableRoles({ scope: 'global' }) with an empty list.
  • permdock rls generate --seeds-out <directory> numbers a new seeds migration one second after the newest versioned migration in the directory instead of using the current time, so regenerating the same directory gives the same file name and --check names the same missing file on every run. The clock is read only when the directory holds no versioned migration. A seeds migration still sorts after the migrations that create role_permissions, and an unchanged policy still writes nothing.
  • permdock rls generate writes permdock_replace_global_roles(p_user, p_roles text[]) when rls.roles names the global-roles table. It deletes the user's rows whose role is not in the list and inserts the missing ones in one call, for a role editor that saves a whole set. It runs with the caller's rights, so the table's policies and the rls.assignments trigger judge each row, and execute goes to authenticated. A role column that references a roles table (through) refuses an unknown key with unknown-role. Regenerate the helpers.
  • permdock/better-supabase accepts better-supabase 0.7 as its optional peer, so an app can install better-supabase 0.7.0 next to PermDock with strict peer dependencies.
  • permdock/better-supabase: bucketPolicy and topicPolicy accept { policy, schema?, scope, segment? } besides { manifest, catalog, scope, segment? }. With the definePolicy result the app already imports, no manifest or catalog is read at runtime: the scopes, the permissions with row conditions and the scopes a permission is granted at come from the policy, and schema names the helper schema (default permdock). The same keys are refused as before.
  • supabase.hook.api: { schema?, prefix? } makes permdock supabase hook generate write public.permdock_subject_for, permdock_members_of and permdock_authz_version_for (schema public and prefix permdock_ by default), so a backend can call the hook's readers through the Data API without hand-written wrappers. Each is security definer, revoked from public, anon and authenticated, and granted to service_role: the only grant the hook makes to it, and only with api. postgrestSources(client, { api }) takes the same setting and derives schema, fn, membersFn and versionFn from it; the four options still override.

0.2.0 (2026-10-10)

  • A createPermDock instance asked for a tenant other than the one a user key is held to now answers for no tenant: it keeps none of the owner's memberships, reads no entitlements and denies every check, so protect(), can(), where(), snapshots and tenants() agree. Before, the key's tenant took precedence over the requested one, and a route of tenant T granted a permission the owner held in the key's tenant. This covers every adapter, the MCP and agent entries and the remote PDP, which all resolve the tenant through createPermDock.

  • A user credential may name a tenant, which holds a personal key to one tenant of its owner. parseCredential accepts it (it was rejected before), decideCredential takes tenant on a user request and refuses one the creator is not a member of with exceeds-creator, and the tenant's credentials settings govern the key. createPermDock makes the key's tenant the active tenant, keeps only the owner's memberships inside it and drops the owner's global roles, whether the memberships come from owner, the token or a memberships source, so can(), decide(), where(), snapshots and tenants() answer for that tenant only. rls.apiKeys already holds a key whose claim names a tenant to it in SQL; a verifier copies the credential's tenant into that claim. ids still holds resource ids only.

  • A credential may list any number of permissions. parseCredential and decideCredential no longer cap permissions at 64 entries, so a verified key that delegates a read-and-write set over a catalog of 100 or more permissions resolves through subjectFromApiKey instead of failing as invalid-claims and becoming anonymous. The cap guarded self-contained tokens; a credential always comes from the application's own store through a verifier. ids per entry keeps its limit of 64.

  • A membership role column that stores a role id is read as a key through a roles table: fromTable columns.role, fromJunction roles, an rls.memberships table's role and authorizeSql's tenant.role take { through, on, column }, the shape rls.roles already takes. The token hook, in-process membershipsFor and list, the database mode helpers, the custom-role match, the ownership triggers, permdock_can_assign and memberOf all join the roles table, supabase_auth_admin gets read access to it, permdock_bump_authz_version_role_keys bumps every global and membership holder of a renamed key, the manifest's membership role carries through, and doctor PD028 counts the roles table's id and key columns. permdock_can_assign now also answers from membership sources in database mode.

  • A membership row can hold roles in several columns: role in rls.memberships and fromTable columns.role accept an array of columns and { through, on, column } references, and fromJunction accepts roles: { sources }. The row holds every non-null key in the token hook, membershipsFor, the database-mode helpers and the holder-count triggers.

  • A membership source can read its user through another table: fromJunction user and fromTable columns.user take { through, on, column }, the shape a role column already takes, so portal contacts in customer_contacts (contact_profile_id) whose login is contact_profiles.user_id need no copied user_id. The token hook, in-process membershipsFor and list, the database mode helpers and permdock_can_assign join that table and filter on its user column, with suspension applied to the joined user and to the source's instances. A row whose referenced row is missing or has no user holds no membership. supabase_auth_admin gets read access to the table, rls generate --indexes indexes its user column, permdock_bump_authz_version_member_users bumps the users a membership row references, and permdock_bump_authz_version_linked_users bumps both the old and the new user when the referenced row is re-linked, skipping a login that was deleted. The manifest's membership user carries through, and doctor PD028 counts the referenced table's id and user columns. User and role through combine on one source.

  • A policy delegation can name an OAuth client by a stable name, to: { kind: 'oauth-client', client: 'cli' }, instead of its id. subjectFromSupabase, permdock/mcp (createPermDock and subjectFromMcp) and subjectFromJwt's actor option take clients (ClientNames: a record from name to id, or a function from a verified id to a name) and set actor.client. An id the mapping does not name, or names twice, leaves client unset and the delegation does not apply. The catalog's delegation to gains client.

  • A policy's Map and Set members (rolesByName, resources, index.grantsByKey) now throw a TypeError on set, add, delete and clear, as the rest of the frozen policy does on assignment. memoryRoleSource returns a copy of its role list on each call.

  • A resource whose rows are the scope's instances, such as an organizations table whose own id is the organization id, can take scoped roles: its one memberOf relation to the scope ({ self: { field: "id", memberOf: "organization" } }) names the field when it is not the scope's key. can, where(), whoCan, snapshots and rls generate read that field; a snapshot's scopes[] entry carries it in the new optional fields map. definePolicy throws when a resource has several memberOf relations to a scope and none on its key.

  • A route that checks no permission can now require OAuth scopes. protect(null, loadData?, { oauthScopes }) in permdock/server and the Hono, Express, Fastify, Elysia and Node adapters, withPermDock({ oauthScopes }) without protect in the Supabase middleware, and an operationPermissions entry with only oauthScopes (read through operations on permdock/server) gate a route such as a chat endpoint: an anonymous caller gets 401, a delegated token holding none of the scopes gets the same 403 insufficient_scope challenge as a permission route, and a first-party session passes. The guard is a ScopeGuard, with no decision. An app no longer needs its own rule that maps HTTP methods to scopes. Routes with a permission behave as before.

  • A single membership can be suspended while the user's other memberships and sign-in stay intact. disabledAt names a nullable timestamp column on an rls.memberships table, on fromTable (columns.disabledAt) and on fromJunction; a row with a value keeps its role, and only its permissions drop. rls.suspension.memberships.keep lists what a suspended membership still holds, as a scope's keep does. The database mode helpers, the inline memberOf checks, authorize(), the token hook, subject_for, members_of and the in-process sources honour the column, the jwt mode helpers and authorize() honour the keep of a claim membership, and the holder-count triggers and permdock_can_assign count no suspended membership. The manifest carries memberships[].disabledAt and rls.suspension.memberships.keep, and PD061 lists the kept keys.

  • A snapshot check reads the clock only when a grant needs it. A usePermission hook under a PermDockProvider that is still awaiting its snapshotPromise no longer calls Date.now(), so it renders in a Next.js Cache Components static shell without a Suspense boundary.

  • A snapshot instance's can(), filter() and pick() skip the decision token and the deep freeze, and the UI stores reuse a local decision for the rest of one render pass. useTenant, useMemberships, useRoles, useAssignableRoles, useAssignablePermissions and useSubject return the same object until the store changes.

  • A snapshot now carries ids, the row id field of each resource whose id option is not id. A client can on a membership held on one row then answers as the server does, where it used to deny. The client can() returns false instead of throwing when reading the row throws. The plan seats a client counts now use the policy's scopes.

  • A snapshot-backed instance (fromSnapshot) now answers an instance action checked without a row the way the server does: from the first-scope memberships of the active tenant, or from the instance team(id) selected. It used to deny every such check on a partitioned resource with tenant-mismatch or scope, so a page guard that passed on the server failed on the client.

  • A suspended scope can keep permissions. rls.suspension.scopes.<scope>.keep (and the same key on SupabaseSuspension for fromTable, fromJunction and authorizeSql) lists permission references or keys that members of a suspended instance, and of every instance nested in it, still hold through their roles: cancelling a scheduled deletion, restoring the instance, exporting before a purge. The generated permitted_<scope>_ids helpers and their _for forms compare the grant's permission with the kept keys in both modes, inline policy checks drop the suspension check for a kept permission, authorize() answers a kept permission for a suspended tenant, and the membership sources, the token hook, subject_for and members_of keep the rows of a suspended instance with a keep list. Membership.keep carries it in process: such a membership counts only for the kept permissions, never for role listings or assignment checks, and a malformed keep drops the membership. subjectFromSupabase, the JWT claim mapping, the claims schema and the hook manifest read the new field. permdock doctor PD061 lists each scope's kept keys and warns on a key the definitions do not declare. Without keep, the generated SQL is unchanged.

  • Add the { subject: { session: { live: true } } } condition, which holds only while the Auth server still holds the session: subjectFromSupabase(claims, { liveSession: true }) sets it in process, and rls generate compiles it to permdock.permdock_session_live(), which reads auth.sessions (Supabase dialect only).

  • An ApprovalPolicy entry with where on a collection permission no longer loads silently and never matches: it is refused like any other invalid entry, so the source denies with approval-policy-unavailable until the entry uses check. The new validateApprovalPolicy(policy, entry) returns { ok: false, problem } (unknown-permission, invalid, where-on-collection, stale-on-without-version) so an application can refuse a bad entry when it is saved.

  • An rls.memberships table mapping takes a constant membership kind: via: { value: 'staff' } gives every row that kind, the way fromJunction's via does, so a staff table needs no kind column (or a generated column) for roles with for: ['staff'] to grant anything. The helpers, the exists checks of memberOf, the ownership triggers and permdock_can_assign read the constant, and the hook manifest describes it as via: { value }. via: '<column>' keeps naming a column.

  • An instance check without a row (can(permission, undefined) in a page guard) now answers from memberships of the first scope only. A membership of a nested scope, such as a portal contact's customer membership inside an organization, applies only when the row carries that scope's key or when team(id) selected its instance; otherwise the check is denied with scope. This is a breaking change for an app that relied on a nested role passing an organization-level guard: pass the row, or select the instance with team(id). Snapshots already denied these checks and are unchanged.

  • Approvals gain holder(permission), an approver who holds the permission in the request's tenant through any role (custom roles included), checked through verdict.permissions that approvalsHandler reads with the new permdockFor option and approverPermissions. anyOf(...) lets any one of several approvers sign (a list, or allOf(...), stays all-of). A stage can carry its own escalation, and an ApprovalPolicy entry may now set escalation, which widens only that entry's stages.

  • Breaking: PermDockProvider from permdock/react-native requires subjectId, the signed-in user's id or null when signed out. A stored snapshot is used only when its principal matches subjectId; null clears the storage. With a verifier, the provider stores the signed JWS and verifies it again at launch instead of storing the decoded snapshot. A stored copy starts with status: 'stale' until the first refresh. Storage that throws or rejects no longer breaks the provider. New headers no longer rebuild the store; the next refresh sends them. The interval pauses in the background, a return to the foreground refreshes, and the new subscribeOnline prop skips refreshes while offline.

  • Breaking: PermDockProvider from permdock/react no longer suspends its readers on a snapshotPromise. Until the promise resolves, usePermission, usePermissions, usePermDock and the other hooks answer from the current snapshot with status: 'pending' (an empty snapshot denies), <Protected> renders its pending slot, and the store re-renders the readers when the promise settles. Permission UI therefore stays in the Next.js Cache Components static shell, as the guide describes. A promise React has already settled hydrates before paint, and a rejection fails closed with status: 'server-only' instead of reaching an error boundary. To keep the previous behavior, pass suspend to PermDockProvider from permdock/react or permdock/next.

  • Breaking: subjectFromBetterAuth from permdock/better-auth no longer copies the user's additional fields into principal.claims without options.schema, because a user can edit their own additional fields. Pass a Standard Schema that lists the server-set fields to keep: subjectFromBetterAuth(auth, session, { schema: z.object({ plan: z.string() }) }).

  • Breaking: a thrown assert now answers with the status protect sends for the same decision. toProblemDetails() and problemFromError() return 401 for no subject or a missing step-up, 404 for a row of a disclosure: 'hide' resource, 429 with the RateLimit fields for an exhausted limit and 503 for an unavailable limit store, where they returned 403. problemFromError(error, { credentials }) picks the 401 challenge. The AuthZEN and approvals 401s carry WWW-Authenticate, Nest's missing-row 404 and the Supabase middleware's 405 carry Problem Details, and Convex maps PermDockValidationError.

  • Breaking: every URL PermDock emits moves from permdock.dev to permdock.com: Problem Details type values (https://permdock.com/problems/<slug>), the $id and $schema of catalog-v1.json, supabase-claims-v1.json and supabase-manifest-v1.json, and the docs links in errors and CLI output. A client that matches on a type URI or a schema $id updates the host.

  • Breaking: two fixtures in permdock/testing drop the better-supabase name, with the same contents.

    BeforeAfter
    supabaseClaimFixtures.betterSupabasesupabaseClaimFixtures.tenantPlans
    better_supabase.feature_claims in supabaseHookManifestFixturepublic.feature_claims
  • Deleting an auth.users row no longer fails when its memberships cascade. The generated permdock_bump_authz_version_for and permdock_bump_authz_version_role_keys now skip a user that is no longer in auth.users, so the version trigger on a membership table cannot insert a permdock_authz_version row that violates its foreign key. Regenerate the hook SQL and apply the changed function body in a migration.

  • Doctor PD039 and supabase hook generate now find helpers written with rls generate --split. They read the helpers part of an rls.out path with a {part} placeholder, and the SQL files in the hook file's folder, besides rls.out and the migration folders. Before, a project that kept the split path in a script got a false warning that the helper schema had no helpers.

  • Edge groups accept a subject column per group: groups: { resources: { team: { relation: 'member', subject: 'team_id' } } }. Share tables that keep each subject kind in its own typed column (user_id uuid, team_id bigint) no longer need one subject column plus a kind column. Without column, a row names the principal when the edge's subject is not null and a group when that group's column is not null. memoryRelations, the where() compilers and permdock rls generate all read the new form, and the EdgeGroup type is exported. A plain relation name per group still works and still needs column.

  • Every customRoles option, on createPermDock and on each adapter (permdock/server, permdock/mcp, permdock/next, the agent adapters and the rest), also takes a RoleSourceFactory, (subject) => RoleSource | undefined, called once per instance with the resolved subject. A source that reads one principal's roles no longer has to remember the last principal an adapter served; a factory that throws reads no custom roles and reports source-threw. RoleSourceFactory is exported from permdock.

  • Every adapter's options type now extends the exported InstanceOptions, so approvalPolicies, relations, entitlements and policies reach the instance from every adapter; before, only the core factory read approvalPolicies, so approval rules kept as data never applied to adapter decisions and toolApproval could not return user-approval for them. The Hono, Express, Fastify, Elysia, Nest, Node, tRPC and oRPC adapters accept actor, and tRPC and oRPC accept otel.

    Breaking: the snapshots option is removed from every server and agent adapter factory, which never read it. Delete it from the options object; a SnapshotSource such as cloud().snapshots goes to the source option of permdock/react-native.

  • Generated RLS renders not and deny policies as (…) is not true, so a row whose deny condition is NULL stays visible, as can() allows it. Run permdock rls generate again to pick this up.

  • Grants take group, a stable name for their condition group in generated SQL: allow(permissions.quote.read, { where: { status: 'sent' }, group: 'sent' }) gives the grant key quote.read#sent instead of a positional quote.read#2, so hand-written SQL that repeats the condition keeps working when other grants are added, removed or reordered. Unnamed groups keep their positional keys. rls generate refuses one name on two conditions of a permission and two names on one condition, and definePolicy refuses a name that is not lower case letters, digits, _ and - starting with a letter, or is break-glass. The option is ignored in process. Without it nothing changes.

  • New permdock/better-supabase entry for better-supabase 0.6, which is an optional peer.

    • authorizationProvider({ manifest, catalog, scope?, approver? }) builds its authorization config from permdock.manifest.json and permissions.catalog.json. With rls.customRoles at a root tenant scope, canAssign and canAssignFor call permdock_can_assign_any and its _for form, so better-supabase's can_assign accepts custom roles. permissionsFor calls the new permitted_<scope>_permission_keys_for helper that rls.mode: 'database' writes. approver sets canApprove with approvals.distinctApprover. Scopes carry a normalised idType, and a missing catalog is reported in problems.
    • bucketPolicy and topicPolicy build its storage and realtime access policies from Permission references.
    • The SQL templates call permitted_<scope>_ids_by_permission, permdock_has_permission and their _for forms, so a deny of the permission is subtracted and a permission split into #n grant keys still matches.
    • apiKeyVerifier({ keys, manifest?, serviceRoles?, allPermissions? }) turns its API keys block into a CredentialVerifier; serviceRoles defaults to the manifest's rls.apiKeys.serviceRoles. Keys need createApiKeys({ prefix: "pdk" }). A rotated key's credential expires when its grace period ends. apiKeyClaimOptions reads its api_key claim settings from rls.apiKeys.
    • subjectFromBetterSupabase(session, options?) reads its sessions with the features claim as plans; plans: { claim, keys } decodes entitlements.claim.keys short codes, and apiKeys maps an apiKey session to the key's credential subject.
    • toolPolicy({ permdock, data? }) returns the authorize and visible hooks of createMcp for tools whose meta is a permission.
    • credentialGuard(provider, { permdock, use, revoke? }) wraps a CredentialProvider so PermDock decides each token use.

    The Supabase manifest's helper names may now end in _permission_keys and _permission_keys_for. Regenerate permdock.manifest.json with permdock supabase inspect --out.

  • New command permdock config warns on config keys PermDock does not read, and --print prints the effective config with every default. Every command now exits 2 when a module path or a config section has the wrong type. Under --json, a non-zero exit always prints JSON: a text failure such as collect --check drift becomes Problem Details with type https://permdock.com/problems/cli-failed. doctor loads the policy and scans the sources once per run. It reports a policy module that fails to load as PD059 and a source file that does not parse as PD060.

  • New entry permdock/compile exports compileWhere and the CompiledWhere tree that the Drizzle, Prisma and Kysely compilers render. testWhereCompiler takes an optional matches(compiled, row) and then checks that a compiler selects the rows the in-memory evaluator keeps.

  • On Supabase, permdock rls generate writes permdock_user_id() into the helper schema, and every generated helper, policy, field view and trigger reads the subject through it in every mode. It reads the sub of request.jwt.claims and returns null for a token whose sub is an empty string, such as a tenant service key, where auth.uid() fails the uuid cast. execute on the function follows the helpers' grants, and an anon policy that reads the subject now grants anon the helper schema as rls.anonExecute does. The Supabase manifest lists it in rls.helpers, and rls import reads it as principal.id. Regenerate and apply the migration.

    Breaking: withSubject in permdock/drizzle, permdock/kysely and permdock/prisma and permdock rls verify no longer set request.jwt.claim.sub. A test or job that sets only request.jwt.claim.sub sets request.jwt.claims with a sub instead. Doctor check PD062 reports migrations that still read or set a request.jwt.claim.<name> setting.

  • REST routes can now require the OAuth scopes an operation declares, as permdock/mcp tools can. protect(permission, loadData, { oauthScopes }) in every HTTP adapter, or operations on permdock/server (the result of operationPermissions), narrows which coarse scopes reach a route: when the subject carries a token delegation, a token holding none of them is refused before the loader runs with 403 and WWW-Authenticate: Bearer error="insufficient_scope" naming the first. A subject without a delegation, such as a first-party session, is not gated, and the decision still needs the delegation to cover the permission. operationPermissions entries take oauthScopes, read by oauthScopesForRequest(method, path) for REST and oauthScopesForOperation(id) for permdock/mcp's oauthScopesFor, so one declaration narrows both. Routes without the option behave as before.

  • Scope ids compare as text. A row whose key column is a number (a bigint id read through supabase-js) now matches a membership whose id is that number's text, in can, snapshots, heldRoles({ id }), custom-role matching, decideRoleChange, activate and capabilities; before, the check denied with scope. A membership whose id, within or on.id is a number or bigint is read as its text instead of being dropped.

  • Server decisions do less work per request. The decision endpoints look permissions up by key, build their handler once and reuse the request's subject; tRPC and oRPC subscriptions open with the row protect loaded; Nest rules sharing a loadData run it once; Fastify routes opt out with config: { permdock: false }.

    withSubject (Drizzle, Kysely, Prisma) sets the role and claims in one select set_config(…) statement. subjectFromBetterAuth reads every member row in one adapter query, and createClerkSubjectResolver({ cache: { ttl } }) caches each user's memberships: 'all' list for up to 30 seconds.

  • Snapshots carry the roles and plans in vocabulary and the permissions in assignable as plain objects, with kind as an ordinary field. They held the policy's own leaves, whose kind is a non-enumerable property, so React refused the snapshot as a Server Component prop in development ("Only plain objects can be passed to Client Components") and a JSON round trip dropped kind, so a client isRole or isPlan check failed on a parsed snapshot.

  • The React, Vue, Svelte and Solid providers take snapshotUrl, where refresh() fetches a fresh snapshot; it defaults to endpoint. They used to drop it.

  • The Supabase hook file now defines authz_version_for(p_user uuid) returns bigint, the authorization version subject_for reports without reading roles or memberships, under the same grants. postgrestSources takes versionFn (default authz_version_for) and memberships.version calls it, so claimsFirst(sources.memberships, { onStale: 'reread' }) costs one cheap call per request and reads subject_for only when the token is behind. Regenerate the hook file and, when permdock is not an exposed schema, add a wrapper for the new function; until then version falls back to subject_for as before.

  • The Supabase manifest gains requires, the supabase/sdk capability-matrix feature ids the setup depends on. permdock/testing exports supabaseClaimVectors, the claim fixtures as a conformance vector file for auth.session.get_claims.

  • The permdock-wire skill now wires @supabase/server into Hono, H3, Elysia and NestJS through a pipeline bridge (toHono([withClaims(), withPermDock()]), then c.var.permdock) instead of the deprecated @supabase/server/adapters/*, which are removed on 1 December 2026.

  • The agent adapters keep every field of the Actor they resolve, as the HTTP adapters do. Before, permdock/ai-sdk, permdock/claude-agent, permdock/eve, permdock/openai, permdock/mcp and permdock/a2a kept only id and kind. An actor option that returned readOnly: true therefore lost its read-only narrowing, and the client name permdock/mcp reads from clients never matched a to: { kind, client } delegation.

  • The hook file defines members_of(p_scope text, p_id text) returns jsonb next to subject_for: every live membership of one scope instance as [{ principal: { id }, membership }], read from the hook's membership sources with their expiry and suspension filters, executable by no client role. postgrestSources(client, { membersFn? }) calls it for memberships.list, once per instance, so countHolders and whoCan work over PostgREST. Regenerate the hook and grant the new function to your backend role the way you granted subject_for.

  • The hook file now defines subject_for(p_user uuid) returns jsonb: the global roles, memberships, authorization version and, in database mode with rls.customRoles, the held custom roles the hook would put in a token for p_user, or { id, active: false } for a suspended user. No client role may execute it. postgrestSources(client, { schema?, fn? }) in permdock/supabase reads it through supabase-js once per user and returns memberships (with version, for claimsFirst), customRoles(principal) and subject(userId), so a backend without a SqlQuery no longer re-implements the membership sources, the suspension filter and a custom-role reader with the admin client.

  • The optional @nestjs/common, @nestjs/core and @nestjs/platform-express peers now accept Nest 11 (>=11). permdock/nest uses no API that is new in Nest 12, and CI runs its unit and integration suites against Nest 11 as well. An app that carries Nest 11 through another dependency no longer gets ERR_PNPM_PEER_DEP_ISSUES.

  • UI stores key endpoint answers for a row without an id by its content and read the row id from the snapshot's ids field, so two such rows no longer share one answer. useApproval polling resumes when a component subscribes again after a StrictMode or remount unsubscribe. <Protected tenant> renders pending while the provider's snapshot is on its way. PermDockProvider keeps its store in state, so React never rebuilds it for unchanged props.

  • Under pg-delta, rls generate --split no longer writes the rls.realtime and rls.storage policies into the declarative policies part. The Realtime and Storage services create realtime.messages and storage.objects, so pg-delta's shadow database, and a local stack with either service off, has neither table and supabase db schema declarative sync failed with relation "realtime.messages" does not exist. The policies now go in the --seeds-out migration, each in a do block that creates it only where to_regclass finds its table. With those policies, the policies part under pg-delta needs the seeds part with --seeds-out. Other layouts are unchanged.

  • PermDockProvider from permdock/react and permdock/react-native keeps its store when a re-render passes an inline headers object, fetch function or verifier. Before, every parent render rebuilt the store, dropped the refreshed snapshot and cached answers, and on React Native refetched the snapshot. headers compare by value; fetch and verifier call the latest prop.

  • allow(permission, { requires }) makes a grant count only where the subject also holds other permissions through a role: allow(drive.read, { to: relation(drive, 'viewer'), requires: file.read }) keeps a share to the organizations where the user holds file.read, and requires: [file.read, file.download] asks for every listed permission. Each requirement is met by a role grant without a row condition, declared or custom, globally or on the row's scope instance, minus a deny of that permission at the same instance. It folds into the grant's row condition for can, where() and snapshots, and permdock rls generate ANDs one permdock_has_permission or permitted_<scope>_ids_by_permission check per key. Grant.requires on a normalised grant is a readonly string[]; the catalog lists one key as a string and several as an array. definePolicy rejects requires on a deny, on a collection action and for an undeclared permission.

    A delegated caller (an OAuth client or an API key) uses an allow with requires only when its scopes cover every required permission and, unless the granted permission is read-only (meta.readOnly, or the read and list actions) and the allow is not a role grant, the granted permission as well. can(), decide(), where(), snapshots and the rls.apiKeys checks in the generated SQL apply the same rule. A key stored with file:read keeps reading the drives a requires: file.read share reaches after an app moves drive.read to relation grants, and a read-only key cannot write through an editor share.

  • assignableRoles() no longer offers a custom role that allows nothing after the ceiling (empty, deny-only, or with every entry outside the ceiling or undeclared), and decideRoleChange denies assigning one with not-assignable-by. Revoking such a role stays granted for an actor who may assign at its scope.

  • assignableRoles() now lists the tenant's custom roles from the RoleSource that the subject may hand out, and decideRoleChange assigns and revokes them instead of denying with unknown-role. A custom role qualifies when the subject may assign a declared role at its scope (or holds meta.manageRoles) and may hand out every permission and level it allows; it has no holder count and inherits for and exclusiveWith from its included roles. Declared roles behave as before.

  • can, decide, assert and explain accept a permission typed as plain Permission, such as one from listPermissions or findPermission, when the call passes data (undefined for a check without a row). Apps no longer cast the instance's methods to call them with a permission chosen at run time; literal references keep their narrower overloads, so an instance action without a row still fails to compile.

  • claimsFirst(sources, { version, onStale: 'reread' }) re-reads the memberships from the sources when the token's authzVersion is behind the source's version, or absent, instead of keeping the token's memberships and denying fresh permissions. A token minted before a new membership or contact link then sees it on the next request without the application rebuilding the instance. A fresh token costs one version read and no membership read; a version that throws keeps the token's memberships and marks the subject stale. The default, onStale: 'deny', keeps today's behaviour.

  • cloud().approvals.resolve throws the ApprovalError code and message the Cloud sends, such as approver-not-eligible. It used to report every refusal other than 409 and 410 as approval-not-found.

  • countHolders(memberships, { scope, id, role }) counts the principals holding a role in one scope instance from the MembershipSource's list, live memberships only and each principal once, for the holders that decideRoleChange needs with min, max or transferOnly. It answers undefined when the source cannot list or the read fails, which the role change check denies.

  • createPermDock({ secretKeys }) in permdock/supabase/middleware turns a Supabase secret key that withSupabase matched by name into a tenant service principal capped at the declared permissions, and withSubject now writes the rls.apiKeys claim (sub: '' for a service key) for any principal that acts through a credential. fromSupabasePostgres(ctx.postgres) in permdock/supabase adapts withPostgresClient's client to the SqlQuery that fromTable, fromJunction and supabaseApprovalStore take.

  • createPermDock from permdock/server returns getSnapshot(request, { tenant, include, tenants }) for React Router, TanStack Start, SvelteKit and Nuxt loaders, reusing the request's cached subject. snapshotHeaders(snapshot, { tags }) returns a private Cache-Control capped at expiresAt, Vary, an ETag and Cache-Tag. cacheLifeFor and snapshotTag are now exported from permdock/server as well as permdock/next.

  • createPermDock now calls RoleSource.globalRoles with { held }, the global role names the subject holds, and customRoleSource(reader, { read: 'held', policy }) skips the platform read while every one of them is a declared role, as it already did for a tenant's roles. A request from a subject with only declared global roles no longer reads platform custom roles. Sources that ignore the argument are unaffected.

  • createPermDock now passes RoleSource.rolesFor(tenant, { held }) the role names the subject's live memberships hold in that tenant, nested scopes included. A source whose custom roles live in a database can return [] without reading when every held name is a declared role. The parameter is optional in the type, so existing sources and direct callers keep working.

  • customRoleSource({ rolesOf, assignable?, globalRoles? }, { read? }) builds a RoleSource from a read of every custom role of a tenant, so assignableRoles, assignablePermissions and decideRoleChange see roles the subject does not hold. It keeps only the requested tenant's roles; read: 'held' with a policy skips the read when the subject holds only declared roles. testRoleSource takes every, the custom role names a tenant has, and fails a source that returns fewer with nothing held.

  • database mode adds permdock_can_assign_for(p_user, p_role, p_scope_id), the assigns check of permdock_can_assign for a user the caller names, and, with rls.assignments and custom roles, permdock_can_assign_custom_role_for(p_user, p_tenant, p_scope, p_scope_id, p_role) over the new internal permdock_custom_role_guard_for and permdock_custom_role_beyond_for. Trusted SQL that acts later for a stored user, such as accepting an invitation, re-checks that the inviter may still assign the role. No client role may execute them. The custom-role form is written only where every scope has member_<scope>_ids_for (Supabase).

  • decide, can, assert and filter take a scope option naming a declared scope: only memberships of that scope answer the check, global roles still apply, and any other membership is skipped with scope. Use { scope: 'organization' } for a staff guard on a collection action (quote.list), which by default also passes through a nested membership such as a customer contact's. The default is unchanged. Snapshot instances apply the option too.

  • definePolicy({ oauthScopes }) maps coarse OAuth scopes an authorization server issues (mcp:read) to the permissions they cover. A token holding one is delegated those permissions in every decision, snapshot and listing, permdock/mcp and permdock/a2a accept it in their scope pre-checks, and insufficient_scope challenges (MCP, A2A and the server kernel) name the first coarse scope that covers the permission instead of a <resource>:<action> scope the server cannot issue.

  • describe(decision, { messages }) accepts messages.reasons as a function (reason, decision) => string | undefined as well as a record, so a translation layer can read the denied decision. undefined keeps the reason code.

  • doctor.srcPath sets the directories or globs permdock doctor reads for its source checks (PD001, PD002, PD007 to PD015, PD044 and the others over code), so client components outside collect.srcPath are checked without changing the catalog. It defaults to collect.srcPath; PD003 and PD004 still follow the catalog.

  • inherit(permission, { through }) is a grantee that holds on a row when the subject holds permission on the row a link list or the parent points to: allow(node.read, { to: inherit(drive.read, { through: ['drive'] }) }) makes a node readable wherever its drive is, by any grant of drive.read. In process the instance reads the target row through the new optional RelationSource.row (implemented by memoryRelations) and decides it with the full policy; a source without row denies with relation-unavailable. permdock rls generate compiles it to a check against the target's permitted_<resource>_rows, which it now writes for every targeted resource. definePolicy rejects it on a deny, on a collection action, for an unreachable or undeclared target and for a cycle. testRelationSource checks row when a source has it.

  • localSnapshot({ manifest, read, subscribe }) in permdock/react-native builds the snapshot from the device's own membership and custom-role rows, and the provider takes it as source. localSnapshotManifest(policy) from permdock writes the JSON manifest at build time, so the policy never ships to the app.

  • operationPermissions matches a HEAD request to the GET entry of its path when no HEAD entry matches, so protect(null) and a permission gate no longer fail on the HEAD requests a framework such as Next.js serves with the GET handler. A declared HEAD entry still wins.

  • permdock collect --watch collects again when a source folder, the config file or the configured permissions or policy module changes. The Next.js plugin and permdock/unplugin now pick up an edited permissions.ts instead of reusing its first import, ignore the catalog and barrel they wrote, and debounce reruns to one at a time.

  • permdock doctor PD001 now flags a client file importing any server-only entry, including permdock/express, permdock/drizzle and permdock/otel. PD007 now counts every HTTP, MCP and agent adapter entry, including permdock/trpc, permdock/a2a and permdock/webmcp.

  • permdock doctor PD001 now reports a client entry that imports the configured policy module, resolving each import from the importing file: relative paths, tsconfig paths, and package names through node_modules and the package's exports, so a workspace package that exports the policy (@acme/access/permdock/policy) is followed to the policy file. Type-only imports are not reported.

  • permdock doctor PD002, collect and usage now resolve a reference's root identifier to its binding. A parameter, local variable or module variable named permissions (an array of strings, for example) is no longer read as a permission tree, so permissions.length is not reported as an unknown permission; an import of permissions or of any definePermissions export, and a definePermissions declaration, still are, in any file order.

  • permdock doctor PD004 now compares the catalog on disk with the catalog permdock collect would write from collect.srcPath. Before, it built the comparison from doctor.srcPath, so a doctor.srcPath wider than collect.srcPath reported catalog drift that permdock collect could never clear. PD002 and PD003 still count the references under doctor.srcPath.

  • permdock doctor PD005 looks for the skills and their lock in the working directory and every directory above it up to the workspace root, and accepts the skills CLI's skills-lock.json when it lists the permdock skill, so a package in a monorepo whose skills are installed at the root no longer reports them missing.

  • permdock doctor PD014 now reads only the options of PermDock calls: object literals passed to a function imported from a permdock entry, the object literals nested in them, and a const object such a call names. An object with a jwks key that never reaches PermDock, such as another library's environment object, is no longer reported. Within PermDock options, discovery next to issuer is now reported as the docs describe, as discovery next to jwks already was.

  • permdock doctor adds PD065: it warns when a file that imports permdock/react-native reads a permission whose grant needs the server, because the device denies it offline.

  • permdock doctor reports PD063, an error, for a migration that alters or drops a reserved Supabase role or grants a reserved membership, which supautils rejects. permdock rls generate refuses to write such a statement.

  • permdock doctor, collect and usage no longer throw on a for loop with an empty initialiser (for (;;), for (; test; )) or on an array hole in a snapshot({ include }) list. The PD002 scanner reads every for, for...in, for...of and for await form.

  • permdock powersync generate writes PowerSync Sync Streams (sync-config.yaml, edition 3) from the policy and rls.memberships, and permdock powersync verify --db fails when a stream syncs a fixture row the policy denies. A resource with a deny grant gets no stream. The permdock_* streams sync the signed-in user's own membership and global-role rows, the roles tables they reference and, with rls.customRoles, the custom roles of the user's tenants: the rows localSnapshot needs. powersync verify passes a fixture's subject.claims to auth.parameter() and fails when an own-rows stream syncs another user's rows.

    With powersync.manifest set, generate writes localSnapshotManifest(policy) to that path. Doctor check PD058 flags a stale streams file or manifest and reports a config that does not compile. powersyncSource(db, { manifest, queries, read }) in permdock/react-native builds the local snapshot from PowerSync db.watch queries.

  • permdock rls generate --custom-roles in database mode emits permdock_replace_custom_role_grants, permdock_rename_custom_role_grants and permdock_delete_custom_role_grants. They save, rename and delete a custom role's rows with the rules of validateCustomRole and assignablePermissions, checked against the signed-in caller, so an application no longer hand-writes a security definer function for it. A null tenant with scope global writes a platform custom role, checked against the global ceiling and global grants, and a caller holding a meta.manageRoles permission through a global role passes the membership check for any tenant.

    The permdock_trusted_replace_custom_role_grants, permdock_trusted_rename_custom_role_grants and permdock_trusted_delete_custom_role_grants variants keep the definition checks without the caller checks, for migrations, jobs and backends; only the owner may execute them until a migration grants a role.

  • permdock rls generate adds permdock_permission_keys(p_scope) next to permdock_permission_keys(): the declared keys some declared role is allowed on that scope (global or a scope name), so a role editor at the organization lists only what an organization role can hold. The zero-argument form is unchanged.

  • permdock rls generate folds a constant membership kind (rls.memberships via: { value }, or a table with no via) at generation time instead of emitting a per-row case over every role with for: a role the kind allows gets no filter, and one it excludes is filtered out by name. Access is unchanged.

  • permdock rls generate names graph helpers after the resource's snake_case name, so a camelCase resource such as chatThread gets permitted_chat_thread_ids, permdock_link_chat_thread_<link> and permdock_closure_chat_thread instead of failing with "unsafe scope name". Link names are converted the same way. Doctor PD032 now also reports two resources that share one snake_case name. Lowercase resource names generate the same SQL as before.

  • permdock rls generate now emits permdock_role_permissions(p_role, p_scope, p_tenant, p_scope_id) and permdock_permission_keys(), so role editors and admin screens no longer hand-write the join over role_permissions and the custom-role tables. The first returns the permission keys a role holds on a scope with allow or deny: a declared role from role_permissions, and with rls.customRoles in database mode a custom role of the caller's tenant, resolved through the ceiling as resolveCustomRole does. Only a member of the tenant (or a meta.manageRoles holder for a platform role) may read a custom role. The second lists every declared permission key. Both are executable by authenticated and not by anon. The change adds two functions to the helpers file and breaks nothing.

  • permdock rls generate puts the min, max and transferOnly triggers on the tables of fromTable and fromJunction membership sources when a scope has no rls.memberships table, so a policy with ownership rules can keep its memberships in sources. One permdock_holders_<scope> and one permdock_transfer_only_<scope> function count holders over every source of the scope, and MembershipSql.holders (typed MembershipHolders) describes the rows they count. A source without holders still leaves the counts to decideRoleChange.

  • permdock rls generate suggests indexes only for the columns its policies and helpers look rows up by: scope keys, condition fields compared with the subject, a claim or a membership, and membership user columns. It no longer suggests indexes for comparisons with constants such as status: 'sent', so the indexes part and rls verify --introspect warnings lose those entries. With the new --db $DATABASE_URL flag, generate also leaves out an index an existing index already leads with, and one whose table or column the database lacks, with a warning.

  • permdock rls generate writes permdock_can_assign_any(p_role, p_tenant, p_scope, p_scope_id) and, in database mode, permdock_can_assign_any_for(p_user, ...) whenever a role declares assigns: one check for a declared or a custom role. permdock_can_assign_custom_role is now written with custom roles in database mode whether or not rls.assignments is set. The permdock.manifest.json written by permdock supabase inspect lists the _for helpers and the assignment checks in rls.helpers, and adds rls.customRoles, rls.roles, rls.suspension and rls.assignments, so a package writing SQL next to the helpers can call them without reading PermDock's config. Regenerate the manifest with permdock supabase inspect --out.

  • permdock rls generate writes permdock_trusted_role_permissions(p_role, p_scope, p_tenant, p_scope_id) next to the member-facing permdock_role_permissions: the same rows and argument checks without the caller check, for server code such as an admin backend, a support console or a job. No client role may execute it, and the new rls.trustedReaders lists the Postgres roles it is granted to, such as ['service_role', 'support_reader'].

  • permdock rls generate writes permitted_<scope>_permission_keys(p_id) for each scope: every permission key the caller holds on one instance, as permdock_has_permission or permitted_<scope>_ids_by_permission would answer each key, in one set-based query. A screen or RPC that checks fifteen permissions on an organization makes one call instead of fifteen. The overload permitted_<scope>_permission_keys(p_id, p_keys) answers for the listed keys only. In database mode the _for(p_user, p_id) and _for(p_user, p_id, p_keys) forms answer for a named user and no client role may execute them.

  • permdock rls verify --advisors runs supabase db advisors --type security on --db or the local stack, names the doctor check for each lint and exits 1 on a WARN or ERROR row. With --revoke-columns, the <table>_visible_fields companion now lives in the helper schema (rls.schema) instead of public, so Supabase's security_definer_view lint no longer flags it; regenerate to move it.

  • permdock rls verify --tree no longer seeds placeholders that break a column's constraints. A required column it fills gets the first label of its enum type, or a value its single-column check constraint admits (the first literal of an = 'x' or in (...) check, the bound of a > n or >= n check), before falling back to a placeholder of its type. The new rls.treeValues sets column values for every row seeded into a table, keyed by table name, for constraints the generator cannot read.

  • permdock skills install follows a symlinked agent or skill folder (.claude/skills/permdock linked to .agents/skills/permdock) and writes the files once at the target, where it failed with "Cannot overwrite non-directory" before. permdock skills install --check compares the installed skills with the package version, writes nothing, and exits 1 listing every missing or changed file.

  • permdock.derive({ customRoles?, approvalPolicies?, relations? }) returns an instance for the same subject, active tenant, team, actor, delegation, sink and limits with the sources it names read again, so an app no longer rebuilds the instance from createPermDock to add a tenant's approval policies or every custom role of a tenant. It returns a promise only when a named source is asynchronous; a fromSnapshot instance returns itself, and permdock/pdp keeps its providers.

  • permdock.filter() no longer builds a decision token, freezes a decision or computes alternatives for each row it drops or keeps. Filtering 1,000 rows takes about a quarter of the time it did (pnpm bench).

  • permdock.snapshot() is typed by overload: without a signer it returns Snapshot, with one Promise<string>, and only an options value whose signer the compiler cannot see returns either. Callers drop the instanceof Promise check or the parseSnapshot round trip they needed before. The options type is exported as SnapshotOptions. An instance from fromSnapshot now signs when given a signer, as the overloads say, instead of returning the plain snapshot.

  • permdock/a2a and permdock/mcp now decide through the shared agent kernel. An A2A task failure's status follows the Problem Details matrix: 401 with a wwwAuthenticate challenge for an anonymous caller, 429 and 503 for limits, 403 otherwise. permdock/terminal protect exits with EX_NOPERM when load throws or returns nothing for an instance permission. permdock/convex accepts the instance options (memberships, sink, limits and the rest). permdock/testing adds testAgentAdapter.

  • permdock/ai-sdk takes unmapped: 'deny' | 'allow' and returns composeToolApproval(app). With 'allow', tools the tools map does not bind to a permission stay in capabilityMiddleware's list and pass toolApproval; the default 'deny' keeps hiding and denying them. composeToolApproval(app) runs PermDock's verdict first and asks the application's own approval function only for a call PermDock grants, so apps no longer wrap the adapter to compose a registry's confirmation. It returns the application's answer as is: undefined leaves the decision to the tool's own needsApproval or the SDK default, and an answer that is not a tool approval result denies.

  • permdock/approvals exports storedApprovalToken(store, decision, { denyPending?, now? }), the helper the adapters use to resume a call by its recomputed token, so an application that decides approvals in its own gate passes it to resumeDecision instead of reimplementing it.

  • permdock/approvals exports the list-paging helpers the built-in stores use, so a custom ApprovalStore no longer copies them: pageApprovals(matching, query) pages requests filtered in memory, approvalPageSize, encodeApprovalCursor and decodeApprovalCursor (with the ApprovalCursorPosition type) serve a store that pages in its own query, and listAllApprovals(store, filter) follows next to the last page.

  • permdock/fastify: the permdockHandler decision endpoint reuses the subject the permdock plugin resolved for the request, so subject runs once per request, as it does in Express, Node and Nest.

  • permdock/mcp adds cacheScope: 'private' to a filtered tools/list, prompts/list, resources/list or resources/templates/list result only when the request was sent under protocol revision 2026-07-28 or later. A 2025-era result no longer carries the field, which that revision does not define.

  • permdock/mcp takes actorKind on createPermDock and subjectFromMcp, the kind of the actor built from authInfo.clientId (default 'mcp-client'). Set it to 'oauth-client' so an OAuth token is the same actor kind in permdock/mcp as in permdock/supabase, permdock/jwt and permdock/a2a, and one policy delegation covers it on both surfaces.

  • permdock/mcp tools take oauthScopes, the OAuth scopes that reach the tool in place of those derived from its permission (the permission's own scope and the coarse scopes of oauthScopes in the policy). Any one of them reaches the tool and the first is the one an insufficient_scope challenge names. They only narrow: the token's delegation must still cover the permission, so the policy lists the permission under each coarse scope that may reach it and each tool names the one it needs. Two tools that share one permission can now need different coarse scopes, such as reading an export with mcp:read and creating one with mcp:write. Under enforce: 'procedure', oauthScopesFor(name) supplies them for the listing. An empty list throws at registration. Tools without the option behave as before.

  • permdock/nest adds PermDockModule.forRoot({ guard: 'global' }), which registers PermDockGuard as APP_GUARD, and decorateMethod(cls, key, ...decorators) for code without decorator syntax. Gateway messages run the same OAuth scope check, loader, decision and approval resume as HTTP routes, and PermDockExceptionFilter handles PermDockRevokedError. Protect(null) in Nest, and protect(null) in permdock/trpc and permdock/orpc, need a principal and the declared OAuth scopes but no permission.

    permdock/express answers a PermDock error from permdock(), protect or the decision endpoint with Problem Details instead of passing it to next(err). permdock() in permdock/orpc reuses context.permdock only when it built that instance for the same tenant. permdock/convex takes tenant and actor options, and its ConvexError carries the marker Convex needs to send data to the client. joseTokenVerifier keys cached JWKS by jwks_uri, so keys from an old URI never answer after discovery moves it.

  • permdock/next and permdock/next/client now load in plain Node ESM, such as Vitest with permdock external or a Node script, instead of failing with ERR_MODULE_NOT_FOUND for next/cache. The entries import Next.js modules by file and route next/navigation through the package import #next/navigation, so Next.js still resolves its server build under react-server.

  • permdock/next: getPermission lets Next.js interrupts (redirect(), notFound(), request-time bailouts) from subject or tenant pass through instead of turning them into a denial, and takes { tenant } as a third argument. The server PermDockProvider no longer replaces a failed snapshot with an empty one: hooks answer server-only, and with suspend the error reaches the nearest error boundary. Instances with a factory onDenied are frozen, and their tenant(), team() and derive() keep the handler.

  • permdock/next: the factory returns getSnapshot({ tenant?, include?, tenants?, tags? }). Call it inside your own 'use cache: private' function: it builds the session's snapshot and calls cacheLife(cacheLifeFor(snapshot)) and cacheTag(snapshotTag(sub), ...tags) in that scope. PermissionBoundary denied and approval also accept a function of the boundary state.

  • permdock/openapi exports operationPermissions(operations, { base? }), one declaration of each API operation's permission as "METHOD /path/{param}" to a permission (or { permission, operationId }), with forRequest(method, path) for an HTTP gate and forOperation(id) for permdock/mcp's permissionFor, and operationPermissionsFromOpenApi(document, permissions), which builds it from the x-permdock-permissions a description carries. REST routes and the MCP tools over them no longer need separate route tables that can drift apart.

  • permdock/react-native adds secureStoreStorage(SecureStore), which splits values into 2048-byte chunks, and the synchronous mmkvStorage(mmkv). It also adds appStateForeground(AppState) and netInfoOnline(NetInfo) for the provider's subscribeForeground and subscribeOnline. useSnapshotReady() is for the splash screen, usePermissionGuard(permission | permission[], data?) is for Stack.Protected and Tabs.Protected, and the type guard parseLocalSnapshotManifest(value) is also exported from permdock. A source is read again on each return to the foreground.

  • permdock/server exports createServerKernel with the ServerKernel and ServerKernelOptions types, the kernel every bundled HTTP adapter is built on. memoryMembershipSource and memorySnapshotSource join memoryRoleSource as in-process defaults, and testMembershipSource takes a tenant to pass to every membershipsFor.

  • permdock/supabase adds parseSupabaseManifest, which reads a permdock.manifest.json document (parsed, or the JSON text), validates it against schemas/supabase-manifest-v1.json and returns a frozen SupabaseHookManifest. It throws PermDockValidationError with every issue, so a manifest of another major is refused. SupabaseManifestActiveRow is now exported.

  • permdock/vue, permdock/svelte and permdock/solid export PermissionBoundary, which renders denied or approval for a thrown PermDockDeniedError or PermDockApprovalRequiredError (Svelte 5.3 or later). Their providers accept endpoint: false, read a headers getter on every request, and call refresh({ tenant }) when a tenant ref, getter or prop changes. useAssignablePermissions and assignablePermissions take a getter, Vue exports ProtectedProps, and permdock/svelte exports requiredPlans under the svelte condition.

    Breaking: Vue composables and Solid hooks throw when called outside setup(), an effectScope or a reactive owner, because their store subscription could never be removed there.

  • permdock/vue, permdock/svelte and permdock/solid re-run a check when a reactive row changes in place again; only permdock/react reuses decisions within a render pass. In every UI adapter, a throwing subscriber no longer stops the others from seeing a logout. Approval polls also back off on errors and stop after a 4xx or five failures, and a snapshot for another user drops the previous user's approval state.

  • permdockExtension from permdock/prisma now scopes findFirstOrThrow and groupBy. verifyDpopProof from permdock/jwt compares htu without the request's query and fragment, per RFC 9449 section 4.3. A new replay option on createJwtSubjectResolver with sender: "dpop" rejects a reused proof jti, and memoryReplayStore is exported from permdock/jwt.

  • permdock_can_assign now answers for global roles. A global role whose assigns lists another global role may assign it, and the check takes a null p_scope_id for that assignment. A scoped role is never assignable with a null instance, by a global assigner or anyone else. The rls.assignments triggers treat a row whose instance column is null as a global assignment: a declared role goes through permdock_can_assign(role, null) and a custom role through permdock_can_assign_custom_role(null, 'global', null, role), the platform custom-role checks. One invitations table can now hold tenant and platform invitations. Regenerate the RLS output; a row with a null instance that names a scoped role is now refused.

  • permittedIds(permdock, permission, scope, { within?, conditioned? }) lists the instances of scope in which the subject holds permission with no row condition, minus the instances a deny reaches, within its delegation: the in-process mirror of permitted_<scope>_ids_by_permission. Apps no longer loop over memberships calling can with a made-up row to list, for example, the customers a portal contact may open. Both sides treat a validity window as a row condition and a fields list as none. With conditioned: true, and the SQL overload permitted_<scope>_ids_by_permission(p_permission, p_conditioned boolean) and its _for form, the list includes the instances a conditioned allow reaches and subtracts only unconditional denies, leaving the row condition to the caller. grant_keys takes p_effect 'conditioned-allow' and 'conditioned-deny' for the keys that carry a row condition.

  • postgrestSources and supabaseApprovalStore now take their client as SupabaseRpcCaller, which a supabase-js client typed with a generated Database (SupabaseClient<Database>) satisfies. Before, its rpc typed the arguments as never for a function name the Database did not declare, so the call needed a cast to an untyped client. SupabaseRpcClient stays the type to implement a fake against; it satisfies SupabaseRpcCaller too.

  • postgrestSources takes policy. With it, customRoles reads nothing while every role the subject holds is declared, and memberships.version calls subject_for instead of authz_version_for when the token claims a custom role, so a custom-role token costs one call instead of two and a current token with declared roles keeps the version-only call. MembershipSource.version now receives the roles and memberships the token claims next to id.

  • problemDetails in permdock/openapi is a Standard Schema, with a JSON Schema, for the Problem Details body of a denial. When an oRPC contract declares oc.errors({ FORBIDDEN: { data: problemDetails } }), protect from permdock/orpc throws through that constructor, so clients receive a defined, typed error.

  • protectServer(server, { enforce: 'procedure', permissionFor }) in permdock/mcp lists and annotates tools by permission but leaves the call to the procedure the tool runs, so each call decides once. permissionOf(procedure) in permdock/orpc returns the permission of a procedure's protect.

  • resource({ restricted }) takes { field, stops } besides a column name. stops lists the inherited paths a restricted row closes: 'parent' for the parent walk and link names for grants that cross those links. restricted: { field: 'restricted', stops: ['parent'] } hides a node from shares on the folders above it while everyone who reads its drive through inherit(drive.read, { through: ['drive'] }) still reads it and its subtree; stops: ['drive'] closes only the drive link, and the parent walk then passes restricted rows. A closed link now also stays closed below a restricted row: a grant across it does not reach a row of a self-parented resource when a row above it within 32 parent hops is restricted, and denies with relation-depth when the chain goes on past that. can, where() (Drizzle, Kysely and resolveRelated, with a closure mapping or a recursive walk) and permdock rls generate agree; RLS reads the new permdock_restricted_<resource>() helper, and the closure keeps 32 levels for such a resource. definePermissions rejects an empty stops, an undeclared link and 'parent' without a parent. The catalog carries restrictedStops, and RelatedCondition gains restrictedAncestors and passRestricted.

    Breaking: the string form still closes the parent walk and every link, and now applies the check below a restricted row too, so children of a restricted row are no longer reachable through a link such as the drive. Use stops: ['parent'] to keep a link open. memoryRelations keeps walking past a restricted row when its restricted does not close 'parent', flags the start row in restricted either way, and sets truncated only when the next row exists. Regenerate the RLS SQL.

  • resource(…, { levels }) declares named conditions such as own, team and all, and a custom-role grant picks one with { permission, level }. The level is ANDed into the ceiling grant in resolveCustomRole, snapshots, customRoleClaim (key@level) and rls generate in both modes; an undeclared level is dropped as unknown-level and denies. assignableLevels(permission) lists the levels a subject may hand out, the catalog lists levels per permission, permdock diff reports level-removed as breaking, and a snapshot binds every principal attribute it does not carry, such as teamIds, so fromSnapshot agrees with decide.

  • resumeDecision takes a ttl in milliseconds for the request it opens, and a request opened by requestApproval or any adapter without one now stays open for the store's ttl (memoryApprovalStore({ ttl }), or the new optional ApprovalStore.ttl) instead of always one hour. A grant's approval.ttl still caps the window, and a ttl that is not a positive whole number of milliseconds throws a RangeError.

  • rls generate --custom-roles in database mode now works with membership sources (fromTable, fromJunction, rls.membershipSources or supabase.hook.memberships) instead of failing with --custom-roles in database mode needs rls.memberships.scopes.<scope>. Each permitted_<scope>_ids unions a custom-role branch over the source rows, matching custom_role_permissions and custom_role_includes on the row's first-scope instance as tenant_id and its id as scope_id, through the same permdock_ceiling view as a membership table.

  • rls generate --grants-out and supabase hook generate --grants-out move only what supabase db diff drops into the grants file: schema privileges, function privileges (including the revokes on the hook's version and protection trigger functions, which no file carried before), the revoke on the permdock_ceiling view and its security_invoker option. rls generate --grants-out works with the helpers part, and with the hook part as well the file holds the helpers' statements first and the hook's after them. Table grants, such as the select grants to supabase_auth_admin, and the permdock_auth_admin_read_* policies stay in the hook and helpers parts, because db diff dropped them on the next diff when they lived only in a migration. Regenerate the parts and the grants file; a project that applied an earlier grants file keeps its privileges, and the next db diff finds nothing to change.

  • rls generate --helpers-only combines with --fields views (rls.helpersOnly with rls.fields: 'views'): it writes the field views next to the helpers, so a role at one scope whose grants list fields (a portal contact) reads masked columns through <table>_visible while the row policies stay hand-written. --revoke-columns is still refused with --helpers-only, because the table grants are the application's. Before, --helpers-only refused --fields, and an application with hand-written policies needed security definer functions to return field-safe rows per scope.

  • rls generate --seeds-out takes a migrations directory (a path ending in /, or an existing directory). It compares the rows with the newest migration there that starts with -- permdock:seeds v1 and writes a new <version>_permdock_seeds.sql only when they changed, so declarative-schema projects no longer rewrite an applied seeds migration in place. --check fails while that newest seeds migration is missing or out of date.

  • rls generate --shims wrappers answer permissions whose grants are split by condition. A wrapper used to pass the permission key to the helpers, which take grant keys, so a permission seeded as quote.read#1 and quote.read#2 answered nothing. Each wrapper now carries, per helper scope, the grant keys of every permission: it answers from the keys of the unconditional allows, minus the instances where the caller holds a deny key. A conditional allow answers nothing through a wrapper, since a wrapper cannot apply a row condition; before, a permission whose grants all shared one condition answered as if they had none. The wrappers are now security definer (still search_path = '', reading no table), so a caller needs execute on the wrapper only, not usage on the helper schema.

  • rls generate adds helpers that take a permission key instead of a grant key: permdock_has_permission(p_permission), one permitted_<scope>_ids_by_permission(p_permission) per scope, and grant_keys(p_permission, p_scope, p_effect), plus _for(p_user, p_permission) forms in database mode. They answer with the permission's unconditional allows minus any deny and map a former key to the current one, so hand-written SQL no longer spells positional #n grant keys, which change when a role's grants change. A permission whose allows on a scope all carry a condition answers nothing there. rls generate --shims no longer answers from a break-glass grant key, which only the break-glass read may use.

  • rls generate in database mode adds permdock_has_for(p_user, p_grant) and one permitted_<scope>_ids_for(p_user, p_grant) per scope: the answers of permdock_has and permitted_<scope>_ids for a user the caller names, from the same tables with the same expiry and suspension filters and no active-tenant narrowing. They are for trusted SQL that acts for a stored user, such as a job, a trigger or an approval decided later, which otherwise had to rewrite request.jwt.claims to ask the helpers. execute is revoked from public, anon and authenticated; grant it to a backend role yourself when it calls them directly.

  • rls generate no longer invents a table for a resource that rls.tables does not name. With rls.tables set and --helpers-only, such a resource gets no index in the indexes part or the index suggestion warnings, and rls verify --introspect no longer warns about a missing index on it; generate names the skipped resources once. Without --helpers-only, its policies still target public.<resource>, and generate now warns that they do. A config without rls.tables keeps mapping every resource to the table of the same name.

  • rls verify --format pgtap now asserts each fixture against the database instead of writing select ok(true, ...). The script creates pg_temp.permdock_decision(statement text), seeds the fixture custom roles, and for each fixture binds the subject with the same settings as --db, runs the statement --db runs and checks is(..., 'granted' | 'denied', ...) against the outcome can() gave; an opaque grant becomes skip(). A fixture that disagrees with its expected or names an unknown permission now exits 1 without a script. rls verify --db keeps custom-role rows that already exist (on conflict do nothing) instead of failing on them, and its success line reads in-process and against the database when it checked the database.

  • rls verify --tree also seeds distinct values in a column that a unique expression index reads, such as name in (drive_id, coalesce(parent_id, ''), lower(name)). The unique columns came only from the index's plain key columns, so every sibling row got the same placeholder and the seed failed on such an index.

  • rls verify --tree seeds a different value in each row for a required column that a unique index covers. Sibling rows got the same placeholder before, so a table with a unique index such as (drive_id, parent_id, name), or a unique uuid column, refused the seed and the command could not run. Text gets a numbered placeholder, a uuid a new value, a number counts up from its check's bound and a date moves a day per row; a column whose enum or equality check allows one value keeps it.

  • rls.anonExecute: true grants anon usage on the helper schema and execute on every generated helper, for hand-written policies that apply to public or anon and call them. Without it only field views that anon reads get that grant, and a statement anon runs that reaches a helper fails, or as an InitPlan has crashed the backend on some Postgres builds. The docs now say that a policy calling a helper should say to authenticated.

  • rls.apiKeys holds a user key whose claim names a tenant to that tenant. The generated permitted_<scope>_ids and member_<scope>_ids keep only the key's tenant and the instances inside it, whatever rls.tenants says, so with rls.tenants: 'all' a user in two tenants whose key names one reads only that one. A scope memberOf check compares its tenant column with the key's tenant, a scope outside the first scope's chain admits nothing for such a key, and permdock_has returns false for it, since a global role reaches every tenant. A key without a tenant, a tenant service key and the _for helpers are unchanged.

  • rls.apiKeys lets the database narrow an API key request the way subjectFromApiKey does in process. A backend that verified a key passes it in a claim (api_key by default, with scopes, tenant and roles), and permdock rls generate writes permdock_api_key_allows(p_grant): permdock_has and every permitted_<scope>_ids return nothing for a permission the key's scopes do not list, and allows that call no helper get the same check in their policy. Denies always apply, and a request without the claim is unchanged. A key with a tenant and an empty or missing sub is a service principal of that tenant: permitted_<first scope>_ids and member_<first scope>_ids answer for it with the claim's roles, or rls.apiKeys.serviceRoles when the claim lists none. claim, scopes, tenant and roles rename the claim and its fields. The Supabase manifest lists the settings as rls.apiKeys and the helper in rls.helpers. Off by default; nothing changes without it.

  • rls.approvals: true makes rls generate add an approval store to the helpers: an approval_requests table and one security definer function per ApprovalStore method (permdock_approval_open, _get, _resolve, _consume, _list, _expire, _cancel), each one atomic statement and closed to client roles. supabaseApprovalStore(client, { schema?, ttl?, onOpen? }) in permdock/supabase implements ApprovalStore over them through supabase-js and passes testApprovalStore; onOpen runs after a request is stored, for notifications and superseding older requests. APPROVAL_POLICY_UNAVAILABLE is exported for the detail of a denial caused by a failing ApprovalPolicySource.

  • rls.approvals accepts { table, token?, body?, mirror? } to put the generated approval store on a table the app already has. rls generate adds the token and body columns when missing, indexes them and writes the same permdock_approval_* functions, so supabaseApprovalStore works unchanged. The functions read every field from the body, skip the app's rows that have none, and copy the fields mirror names into the app's columns on each write, converted to their types. The table's grants and policies stay the app's.

  • rls.approvals on an adopted table takes open: 'attach' and schema. With open: 'attach', permdock_approval_open attaches the request to the row the app inserted with the decision's token, so tables with required columns only the app can fill work with supabaseApprovalStore; with no such row it raises P0002 and the open fails. schema writes the store functions into another schema, such as public when the helper schema is not exposed, so supabaseApprovalStore(client, { schema }) reaches them without wrapper functions.

  • rls.assignments adds assignment triggers in database mode: each scope's rls.memberships table, and each table in rls.assignments.tables such as invitations, gets a before insert or update or delete trigger that refuses a client role's write of a role the caller may not assign at that instance (SQLSTATE 42501, hint not-assignable-by). Declared roles follow the assigns graph through permdock_can_assign; custom roles go through the new permdock_can_assign_custom_role, which runs the custom-role write checks on the stored definition. Writes that do not run as a client role (the owner, a security definer function, a backend role) are trusted, which covers bootstrap paths without a bypass setting.

  • rls.assignments now guards the global-roles table. When rls.roles (else supabase.hook.roles) names the application's table, rls generate puts a permdock_assignment trigger on it too: a client role may insert, change or delete only the global roles it may assign, checked like a tenant assignment at no instance through permdock_can_assign(role, null) and, for a platform custom role, permdock_can_assign_custom_role(null, 'global', null, role). A client that holds no global role whose assigns lists the role can no longer give itself or anyone else a global role through the Data API. The generated user_roles table is unchanged, since no client role may write it. The hook manifest lists the table in rls.assignments.tables.

    rls.assignments.ownRole: 'refuse' refuses a client write to a row whose user is the caller, on every guarded table with a user column, whatever the role; a map such as { 'public.user_roles': 'refuse' } limits it to the tables it names. A listed table names its user column with the new user field. The refusal raises SQLSTATE 42501 with hint self-demotion for the old row and not-assignable-by for the new one. permdock doctor PD064 warns on a table rls.assignments guards that no migration or rls.out file creates the permdock_assignment trigger on.

    An application that sets both rls.assignments and rls.roles and lets clients write its global-roles table directly gets those writes checked after regenerating; move such writes into a security definer function or a backend role, which stay trusted.

  • rls.customRoleWrites.requires makes the generated custom-role write functions check that the caller may manage roles before any hand-out check: it names permission keys, or 'manageRoles' for every permission with meta.manageRoles. A caller holding none of them in the tenant, or through a global role, gets 42501 with hint manage-roles from permdock_replace_custom_role_grants, permdock_rename_custom_role_grants and permdock_delete_custom_role_grants.

  • rls.customRoleWrites.roles names the application's own table of custom roles (table, key, tenant, and optionally scope, id and a skip column for declared or system rows). rls generate then adds permdock_cascade_custom_role() and an after update or delete trigger on that table: a rename or a move to another tenant, scope or instance carries the role's grants and includes, and a delete removes them. A signed-in caller passes the same checks as the write functions where the role was and where it lands; migrations, jobs and nested triggers move the rows directly.

  • rls.jsonSchema: true | 'auto' adds a pg_jsonschema check constraint that each approval store body matches the new schemas/approval-request-v1.json. supabase.hook.validate: true makes the token hook check its claims against supabase-claims-v1.json and drop them all on a mismatch instead of failing sign-in.

  • rls.ownershipTriggers: false leaves out the holder-count and transfer-only triggers that min, max and transferOnly put on the membership tables, and rls.ownershipTriggers: { <scope>: false } leaves them out for the named scopes, for an application that enforces those counts its own way. decideRoleChange keeps checking the rules and permdock_can_assign is still written.

  • rls.readOnlyActors adds a restrictive policy per table and write command that refuses writes from support and impersonation sessions (the token's act claim) unless act.read_only is false, replacing the hand-written policy the support access guide showed.

  • rls.realtime and rls.storage (and supabaseRls({ realtime, storage })) make permdock rls generate write policies on realtime.messages for private channels and on storage.objects for buckets. A topic segment or a folder of the object name selects the scope instance, and the policies call permitted_<scope>_ids_by_permission('<key>'), so they count only the allows without a row condition, minus any deny, and a permission split into #n grant keys still matches. For a permission that also has a relationship grant or a where, rls generate warns that its topic or folder admits only the instances its role allows reach. Doctor check PD037, rls verify --db and rls verify --introspect no longer flag a policy that calls the permission-key forms, which never grant more than the application does, and the PD037 fix names them.

  • rls.rowHelpers: true (or a list of resources) makes permdock rls generate write permitted_<resource>_rows(p_permission): the ids of the resource's rows the caller may act on with one permission, from the same allows and denies the generated policies use, so closure walks, link hops, the restricted stop, includes, groups and requires apply without being restated in hand-written policies and functions. Actions with no SQL command get an arm too. permitted_<resource>_rows_for(p_user, p_permission, p_claims) answers for a stored user and is executable by no client role; the neon dialect gets no _for form. It works with rls.helpersOnly.

    permitted_<resource>_row(p_row, p_permission) decides one row value from its columns instead of looking it up by id. A table's own select policy written as using (permdock.permitted_doc_row(doc, 'doc.read')) admits a row the same statement inserts, so insert ... returning passes row-level security.

  • rls.tables accepts schema-qualified names such as integrations.webhook_endpoints end to end. permdock rls verify (with --db and in the pgTAP output), its field view reads and rlsParity from permdock/testing now quote schema.table as a schema and a table instead of refusing it as an unsafe identifier, so a table a package installs in its own schema can be verified like one in public. With --target drizzle or --target prisma, the default export or model name of a schema-qualified table is the table name without its schema; rls.drizzle.exports and rls.prisma.models still override it. Nothing changes for unqualified names.

  • rls.tenants: 'all' stops the generated RLS helpers from narrowing to the tenant claim: permitted_<scope>_ids, the root memberOf (now in (select member_<scope>_ids())) and the nested membership exists admit every tenant the subject is a member of, for apps whose tenant comes from the URL. The default, 'active', keeps the current behaviour: narrow to the tenant claim when the token carries one.

  • rls.trustedReaders accepts service_role. rls generate threw "generated RLS must never emit service_role" when the list named it, although service_role is the trusted server role in a Supabase app. The execute grant on permdock_trusted_role_permissions may now name it, and the generator still refuses service_role on every other line.

  • securityFor(permission) and permissionsExtension(permissions) in permdock/openapi return an operation's security and x-permdock-permissions from permission references alone, so a contract package can write them without importing the policy. protect from permdock/orpc now attaches to contract procedures that declare an output.

  • subjectFromSupabase and actorOf in permdock/supabase read a support act level without read_only as read-only (Actor.readOnly: true), as better-supabase does. Before, such a token could reach every delegated write.

  • subjectFromSupabase and delegationOf leave the OpenID Connect identity scopes (openid, profile, email, address, phone, offline_access) out of delegation.scopes. A Supabase OAuth server token that carries only those scopes is now an oauth-client actor with no delegation: it is still denied every check with no-delegation by default, and a policy delegations entry that names the client now lets it act within that ceiling. Before, the identity scopes counted as a token delegation that covered nothing, so the client was denied with not-delegated even when the policy delegated to it.

  • supabase.hook.before names schema-qualified functions (event jsonb) returns jsonb that the generated custom_access_token_hook calls first, in order. A result with an error key is returned as the hook's answer, so Supabase Auth refuses the token, and a null or non-object result is refused with status 500; otherwise the hook continues with the event the function returned and writes its own claims as before. The migration grants supabase_auth_admin usage on each function's schema and execute on the function, and the Supabase manifest lists them as hook.before. Use it for checks such as single sign-on enforcement that must run inside the one hook Supabase allows. Nothing changes without it.

  • supabaseApprovalStore's onOpen now runs once per stored request. A repeated ask whose token finds the request still open keeps the stored request, as before, but no longer runs onOpen again, so an app that notifies approvers or opens its own record there does not need to make it idempotent. An open whose stored request cannot be read back runs no onOpen either.

  • usePermission, usePermissions and useApproval from permdock/react and permdock/react-native now update after a snapshot change when the React Compiler compiles them. Before, a compiled hook kept its first answer, such as pending.

  • vouchApproval(store, token, { status, by, rule, note? }) in permdock/approvals records a verdict that the application's own approval rules decided, such as a manager chain, delegates or a quorum it counts itself. The store resolves the request at once and records vouched: rule on the request and on the approval, so the audit trail says which rule decided. The eligibility checks of approvers, the tenant membership and the quorum are skipped; the actor, the principal (unless distinct: false), a repeated approver, an unauthenticated subject and a closed or expired request are still refused. ApprovalVerdict.vouched is server-side input that approvalsHandler never reads from a body. applyApprovalVerdict handles it, so the memory store, the generated Supabase store and custom stores built on it support it, and testApprovalStore checks it. The approval request wire format (v: 1) gains the optional vouched field.

0.1.0 (2026-10-04)

  • A 401 to a request without an Authorization header now carries a bare Bearer challenge instead of error="invalid_token" (RFC 6750 section 3.1), and a rejected token gets a fixed error_description. The /unauthenticated body no longer carries denials or alternatives, so nothing explains the failure to an unauthenticated caller. problemFromDecision takes a credentials option for the challenge.

  • A deny that cannot be evaluated now denies the decision, as a relation deny already did: a deny closure that throws or returns a thenable (closure-error) and a deny with an opaque condition (opaque-condition). An opaque node nested under not, or or and now fails its grant with opaque-condition on the server and in fromSnapshot, so not(opaque) no longer matches. coveredByDelegation treats an RFC 9396 or GNAP entry whose identifier is not a string or whose actions is not an array as covering nothing, instead of ignoring the field.

  • A dotted condition field, relation or identifier with a __proto__, constructor or prototype segment (a.__proto__) is now rejected at definition time like the bare key, as the threat model states. permdock/testing renames the ClientStoreDock type to ClientStorePermDock.

  • A grant whose roles the subject holds but whose plan grantee it lacks now denies with the new reason not-entitled instead of no-grant, with the grantee in to; a plan grant whose roles are not held adds no denial. When every denial is not-entitled, HTTP adapters answer 403 /not-entitled with plans (the plan keys that would grant), describe(decision) returns kind: 'upgrade' with plans, and the new requiredPlans(decision) returns the list. Snapshots carry these grants as notEntitled entries, which grant nothing, so usePermission in every UI adapter gets the same reason and plans as decide on the server.

  • API keys end in a 6-character base62 CRC-32 checksum: pdk_<id>_<secret><checksum>. generateApiKey appends it and parseApiKey rejects a key whose checksum does not match, so secret scanners can match pdk_[A-Za-z0-9_-]{1,128}_[A-Za-z0-9]{49} and discard lookalikes offline; keys generated before this change no longer parse. CredentialVerifier gains an optional touch(id, at) that subjectFromApiKey calls, without awaiting, after a key resolves, for a lastUsedAt column; apiKeyVerifier({ find, touch }) passes it through, memoryCredentials() records it (lastUsedAt(id)), and testCredentialVerifier checks that a touch never changes what a key verifies to.

  • Add toCsvRow(event) and CSV_COLUMNS: the pinned CSV export row for decision and approval events, shared by the Cloud export and self-hosted sinks.

  • Approval grants take quorum, ttl and escalation. quorum (default 1) is the number of distinct approvers a request needs: ApprovalStore.resolve appends each approval to the request's new approvals: { by, at }[], keeps the request pending until the quorum is met, and refuses a repeat approver with the new approver-repeated code (409 from approvalsHandler); one rejection ends the request. ttl (a duration such as '30m') caps the store's window when requestApproval sets expiresAt. escalation: { after, to } lets to approve once after has passed since createdAt. The request's approvers carries quorum and escalation; applyApprovalVerdict, approvalQuorum and escalationOpenAt are exported from permdock/approvals for custom stores, and the Drizzle recipe uses them. definePolicy rejects a quorum below 1, a malformed duration or a relation in escalation.to; hosted grants with a smaller quorum or a longer ttl than a code allow are dropped as weaker-approval. The catalog approval carries the three fields, so permdock diff reports a change to any of them.

  • Approval tokens bind the call's data when there is no row id: for a collection action, or a row without its id field, Decision.token includes a SHA-256 of the canonical JSON of the validated data, so an approved call no longer covers a retry with different arguments. approval.by refuses relation() at definePolicy, and an approval store refuses every approver for a stored request whose approvers include a relation. permdock/terminal prompts y/N only for a grant with approval: { distinct: false } and no actor; any other approval is recorded in the store and the command exits 75 until someone else approves it, or exits 77 when no store is configured. storedApprovalToken moved from the agent kernel to the approvals helpers.

  • Approvals can go stale when the row changes. resource(schema, { version: 'updatedAt' }) names the row field that changes with the row, and approval: { staleOn: 'resource-change' } hashes its value into the decision token (the prefix stays pd1.; tokens of grants without staleOn are unchanged). Resuming with a token that approved an earlier version of the same row denies with the new reason stale-approval and leaves the old record unconsumed; the next call without it is a new approval-required. definePolicy throws for staleOn on a collection action or on a resource without version. Approval requests carry approvers.staleOn, the catalog carries resource version and staleOn in approvals, and a hosted approval without staleOn is weaker-approval against a code allow that sets it.

  • Approvals refuse the requester by default. approval: 'human' and approval: { by } now refuse the request's principal as approver as well as its actor (approver-is-principal), in assertApprover, ApprovalStore.resolve, resolveApproval and approvalsHandler. A grant that wants the user to confirm their own agent's call opts out with approval: { distinct: false }, and permdock doctor PD024 (--only self-approval) warns on each opt-out. requireDistinctApprover stays as a handler-wide floor that refuses the principal even on an opted-out grant. A hosted grant that sets distinct: false on a permission a code allow guards with an approval is dropped as weaker-approval. testApprovalStore checks that a custom store refuses the principal on every approval shape and accepts it only with distinct: false.

    Behaviour change: an approval request without approvers.distinct now refuses its principal. Set distinct: false on the grant to keep the old behaviour.

  • Approvals take mode: 'all' | 'sequential' with stages: [{ by, quorum? }], user(id) approvers, and relation() approvers checked at verdict time through approvalsHandler's new relations option (approverRelations in permdock/approvals). The approval request carries mode and stages, each signature its stage, and the verdict relations. createPermDock takes approvalPolicies, an ApprovalPolicySource (memoryApprovalPolicies) whose entries add approval stages to matching allows and deny with approval-policy-unavailable when they fail to load; testApprovalPolicySource checks a source.

  • Arazzo simulate and permdock arazzo check follow the 1.0 and 1.1 specs more closely:

    • Documents are validated against the required fields.
    • Patch versions are accepted.
    • $sourceDescriptions forms of operationId and operationPath select their source.
    • $inputs.* and $components.parameters references resolve.
    • Nested workflows take their calling step's parameters as inputs.
    • Results are kept per step position, so equal stepIds in nested workflows no longer collide.

    simulate now emits the one simulate audit event its docs describe, with the batch's worst decision and counts.

  • Assign authority now comes from live, held memberships. Expired memberships no longer count toward tenants(), the active tenant, assignableRoles() or a credential's ceiling. decideRoleChange reads a nested change's tenant from the subject's membership and denies a disagreeing within with no-membership; pass { trusted: true } when the application loaded within from its own store. activate copies within from the eligible membership, and the approval token covers it.

  • Bound the work one request can cause. can and whoCan walk each nested group once per depth budget, so a lattice of shared teams costs time in its group count rather than its path count. createEvaluationsHandler (and permdockHandler) answers a batch over maxEvaluations (256 by default, the AuthZEN limit) with a 413 Problem Details before resolving the subject. A denial's alternatives peek a quota grant's remaining without spending it, and can skips alternatives entirely.

  • CLI fixes found by the coverage suite:

    • The generated barrel imports the permissions module relative to its own folder; before, the default src/permissions.generated.ts imported ./src/permissions.js, which does not resolve.
    • collect, usage and doctor skip a broken symlink in a source folder instead of crashing.
    • permdock usage exits 2 with "policy export is not a Policy" when the policy module exports something else, instead of throwing (which crashed doctor at PD003).
    • A computed identifier key such as defineRoles({ [name]: … }) no longer counts as a role named name, which made usage report a false "granted by no role".
    • PD009 names the duplicate permdock package folders, not their parent node_modules.
  • Catalog permissions carry rowConditions when permdock.config.ts names a policy: true when a code grant for the key has a where, check, closure, field list, purpose, break-glass override, or a relation, plan, actor or assurance grantee, which the SQL helpers (permdock_has, permitted_<scope>_ids) do not check. permdock doctor PD037 errors on a migration's storage.objects or realtime.messages policy that calls a helper for such a key, and permdock rls verify --db reports the same from pg_policies, so a Storage or Realtime policy written outside PermDock (better-supabase permdock mode) cannot grant more than the application does.

  • Catalog v1 carries a top-level fingerprint and per-permission approvals. catalogFingerprint(catalog) is exported from permdock: base64url SHA-256 over canonical JSON without generatedAt, generator, fingerprint and usages, so the CLI version and call sites no longer change it. permdock collect --check ignores generator.

  • Composed membership sources and permdock supabase hook generate. memberships on every createPermDock accepts an array of sources, merged and de-duplicated by composeMemberships, and MembershipSource gains optional list({ scope, id }) (a scope's members), version(principal) and claimsFirst. claimsFirst(sources, { version }) keeps the verified token's memberships and reads the sources only when the token was truncated. Permissions listed in definePolicy({ fresh }) deny with the new reason stale-credentials when token memberships are behind the source version; a stale subject's snapshot drops those allows.

    permdock/supabase adds the SQL sources fromTable and fromJunction (fixed roles, via, within, expiry, managedBy, seats, suspension), authzVersion, supabaseMembershipsBudget, and subjectFromSupabase reads memberships_truncated and authz_ver into principal.membershipsTruncated and principal.authzVersion. permdock supabase hook generate compiles the same sources into custom_access_token_hook: user_role and roles, a union over every source with the active scope first (--active-from), an attrs claim from allow-listed server-owned columns and app_metadata.<key> entries for attribute conditions (user_metadata is refused, and the migration refuses to install while clients can write a listed column), a byte budget over attrs and memberships (--budget, default 1024) with memberships_truncated, authz_ver with its version table and triggers, a trigger that refuses client writes to IdP-owned rows, the supabase_auth_admin grants and revokes, and the printed config.toml block with jwt_expiry = 900.

    Memberships carry managedBy: 'idp' (set by directoryMembershipSource; decideRoleChange refuses with the new reason externally-managed, isExternallyManaged tells a UI) and entitlements (seats that plan() grantees match inside the active tenant). EntitlementSource (entitlements option, memoryEntitlementSource, testEntitlementSource) adds plan names for the active tenant, and fromStripeEntitlements reads Stripe Entitlements through a structural client. permdock doctor PD028 (--only attrs) flags attrs entries a user could set.

  • Custom roles in generated RLS. permdock rls generate --custom-roles (or rls.customRoles: true) makes permitted_tenant_ids and permitted_team_ids resolve tenant-defined custom roles as well: from the new custom_role_permissions and custom_role_includes tables in database mode, or from a compact memberships[].grants claim in jwt mode (off unless the flag is set). Both go through permdock_custom_keys and a generated permdock_ceiling view of the assignable declared roles, so a row or claim entry outside the ceiling never widens access, and the database agrees with resolveCustomRole. authorizeSql({ customRoles: { declared } }) answers tenant requests from custom roles, and --rbac supabase --custom-roles passes it through.

    customRoleClaim(roles) builds the claim map for a token hook. rls verify fixture files accept customRoles (resolved in-process, sent in the claim, and seeded into the tables in database mode), and rlsParity accepts customRoles. An included role's denies now apply to a custom role only in the custom role's own scope, matching what RLS can evaluate. Output without --custom-roles is unchanged.

  • Custom roles with scope: 'global' are platform roles held through principal.roles, capped by the allows of assignable global roles and returned by the new RoleSource.globalRoles(). With rls generate --custom-roles they are rows with a null tenant_id, or the top-level role_grants claim in jwt mode, and permdock_has answers from them. The --rbac supabase scaffold types user_roles.role as text when --custom-roles is on.

  • Decision data is untrusted unless the caller marks it. With validate: 'boundary', decide, can, filter, protect, conn.check and the Nest guard validate a row against the resource schema unless the call passes trusted: true; pass it for rows your server loaded itself. The agent kernel labels tool data boundary: 'tool-args'. The AuthZEN handler forwards the loader's trusted flag and answers decision: false (no-grant, detail: 'resource-unavailable') when the resource loader throws, instead of evaluating the request's { id } stub.

  • Denials that leave the process are now WireDenial ({ role, reason, to?, detail? }), and DecisionEvent.denials and ProblemDetails.denials are typed that way. This covers decision events, Problem Details bodies, MCP and WebMCP refusals and the decision endpoint. detail is kept only as a JSON value: what a closure threw (closure-error), a validation error and any Error or non-JSON detail are dropped, so they no longer reach a sink or a response body. WireDenial and WireDecision are exported from permdock.

  • Doctor PD028 now also warns when the migrations let anon or authenticated insert or update a column that decides a membership: the user, scope, id, within, role, via and expiry columns of every fromTable / fromJunction source. A contact who can edit their own row could otherwise set user_id or customer_id and give themselves a membership. The grant model matches Postgres, where a column-level revoke leaves a table-level grant in place. MembershipSql gains columns, the list the check reads.

  • Document that scope and tenant ids compare as exact text in decide and the SQL helpers, never lower-cased, and that producers emit uuid::text; the policy matrix and an RLS parity suite over a uuid column cover it.

  • Document the PermDock Cloud contract v1: client, admin and export key kinds, the authoring routes (/hosted-grants, /directory/*, /connectors, /export), the environment's JWKS and OIDC Discovery, RFC 8693 token exchange at <env URL>/oauth/token minting RFC 9068 access tokens, the raw sink body the Cloud envelopes as CloudEvents, and membership events with source: 'cloud'.

  • Drizzle toWhere returns SQL, and columns accepts only columns of the given table. permdock/prisma adds prismaModelFields, which reads required and list fields from schema.prisma or a DMMF datamodel for the new model option, and toPredicate, which compiles a condition to a Prisma 8 field-proxy predicate.

  • Edge fixes found by the coverage suite:

    • SCIM list paging starts at the first item for a negative or non-finite cursor; before, it sliced from the end and returned a negative startIndex.
    • An SSF back-channel logout token with an empty sub and a sid maps to an opaque session subject, not an iss_sub subject with an empty sub.
    • PermDockCloudEvent includes dev.permdock.credential, which verifyWebhook already accepted.
  • Elevated access: just-in-time role activation, break-glass and support access with tenant consent. Memberships gain grantedBy (the principal id that wrote the row) and reason (free text); both round-trip through the Supabase custom access token hook claim, the snapshot and every event. Membership also gains eligible (roles a holder may activate but does not hold) and member: { group } (a subgroup inside the instance).

    Role activation (E1). role('admin', ADMIN, { on: 'organization', activation: { maxDuration: '4h', justification: 'required', approval: { by: roles.owner }, assurance: { maxAge: 300 } } }) makes a role eligible-only: it is never held directly, a membership lists it under eligible, and permdock.activate({ role, scope, id, duration, reason }) returns a Decision. It is approval-required when activation.approval is set; once granted it carries the membership to write under elevation (via: 'elevated', with expiresAt, grantedBy and reason). PermDock never writes the membership; the app does. Expiry uses the existing expiresAt check plus C3's revocation counter, and the Supabase hook already includes elevated rows. permdock doctor PD033 warns on an activation without maxDuration and on an activation role held standing in the memberships fixture.

    Break-glass (E2). breakGlass(permissions.patient.read, { overrides: ['restricted-record'], requires: { purpose: ['BTG','ETREAT'], reason: true, assurance: { maxAge: 60 } }, maxDuration: '1h', obligations: ['notify','review'] }) is the only deny override: it overrides deny grants whose name it lists and nothing else, so deny-overrides-allow holds everywhere else. A satisfied break-glass grant is granted with matched.breakGlass: true and obligations: [{ kind: 'notify' }, { kind: 'review' }, { kind: 'justify', reason }]; a break-glass grant is engaged by context.purpose, and a missing purpose, reason or assurance denies with the new reasons purpose, reason-required or insufficient-user-authentication. DecisionEvent records purpose and reason, and toOcsf raises break-glass to high severity. RLS never compiles a break-glass grant (it stays non-portable); instead permdock rls generate emits a permdock_break_glass_audit table and one security definer permdock_break_glass_<resource>(permission) per targeted resource that checks a signed break-glass session, writes an audit row and returns the rows (bypassing RLS as the definer), so a plain RLS read keeps denying the restricted rows. permdock doctor PD034 flags a break-glass grant under an rls config.

    Support access (E3). supportAccess({ role: 'support', actorRequired: true, consent: { by: roles.owner, durations: ['1d','7d','30d'] }, forbid: [permissions.billing, permissions.security] }) is a role a vendor holds only through a consented, time-bound via: 'support' membership. A tenant owner consents through an ApprovalRequest whose membership is { scope, id, via: 'support', roles: ['support'], member: { group: 'vendor-support' }, expiresAt, grantedBy }; group members ride C3's fromJunction group option. With actorRequired: true, every decision under a support membership denies with the new reason actor-required unless the subject carries an act. forbid compiles to deny grants scoped to via: 'support'. The lifecycle emits the new access.started, access.ended and access.revoked events (accessEvent), each a CloudEvents type (dev.permdock.access.started / .ended / .revoked) with an OCSF Account Change mapping (accessToOcsf); revoking consent bumps C3's revocation counter. permdock doctor PD035 warns on a support role without actorRequired.

    Purpose of use. context.purpose is a decision input: allow(p, { purpose: ['treatment'] }) applies only when the caller asserts a matching purpose. It is not portable; RLS honours it only through the break-glass session function.

    The catalog gains role activation and supportAccess entries and break-glass entries per permission.

  • Every DecideOptions field has JSDoc, so editors describe trusted, boundary, now, source, adapter, onDenied and field on hover. The same text is the options table on the decisions page.

  • Export coveredByDelegation(permission, delegation, resourceId?, hasActor?) from permdock: the delegation coverage check decide uses for OAuth scopes, RFC 9396 authorizationDetails and GNAP access. It returns undefined when covered, otherwise no-delegation or not-delegated, and permission needs only scope, resource and action, so an external PDP such as the PermDock Cloud AuthZEN endpoint can reuse it.

  • Fail-closed fixes for a grantee kind this build does not know, as a forged snapshot or a newer policy document could carry:

    • An allow naming one matched every caller, anonymous included; it now matches nobody, on the server, in fromSnapshot and for approvers.
    • A deny naming one now applies to everyone.
    • A hosted grant naming one is dropped as unknown-grantee, and an approver by naming one is invalid.
    • whoCan reports complete: false when it meets one.
    • toOcsf maps an outcome this build does not know to status_id 0 Unknown instead of leaving status_id and status undefined.
  • Fail-closed fixes found by the coverage suite:

    • subjectFromJwt with actor: { kind } and no from now reads the RFC 8693 act claim. Before, a delegated token under that config resolved as the user acting directly, with no actor and so no delegation check.
    • A custom verifier.verify that throws in subjectFromJwt, subjectFromCapability or subjectFromCiOidc resolves the anonymous subject with cause malformed instead of rejecting.
    • permdock/pdp: a provider.decide that throws or rejects is denied with pdp-unavailable, and a permitted callback that throws makes filter and where keep no rows.
  • Field views. permdock rls generate --fields views (rls.fields: 'views') emits, after the policies, one security_invoker view <table>_visible per table whose read grants set fields: a column some read allow leaves out or some read deny lists is case when <permitted> then col end, where <permitted> is can(permission, row, { field }) built from the row policy's own per-statement helper calls (permitted_<scope>_ids, permdock_has) and row conditions; every other column and the row key pass through. In this mode grant keys also split by field set, and field-only read grants (a deny with fields, an allow with an empty list) leave the row policy and live in the masks, as they never decide the row in can. When anon reads a view, the helpers are executable by anon too; they return nothing without a subject. The resource schema must expose Standard JSON Schema so the view can list its columns.

    --revoke-columns (rls.revokeColumns: true) closes the table: anon and authenticated get select on only the unrestricted columns and the key, and the restricted columns are read through <table>_visible_fields, a security_barrier companion that runs as its owner, masks every column with the full field decision and keeps only rows with a readable column, left-joined on permdock_key. It breaks select * and returning * on the table. Drizzle and Prisma targets put the views and column statements in the migration comment.

    permdock rls verify with rls.fields: 'views' and rlsParity({ fieldViews: true }) compare each read fixture's row in <table>_visible with the columns pick keeps (reported as fields: { app, database }, type RlsFieldsOutcome), and read back only the key so a closed table does not reject them; rls verify statements now always returning "id". permdock rls import reads the generated views back as a fieldViews export of per-column grants, from a dump or with --db. permdock doctor PD030 (--only fields) warns on field-limited columns a table still returns, and PD022 exempts the marked companion.

  • First release of PermDock: typed, portable permissions for apps, APIs and agents, with the permdock core and adapters, the permdock CLI and the permdock/testing runners.

  • Generated RLS keeps parity with decide. contains escapes \, % and _ before LIKE. rls.suspension now also applies to the inline membership exists, the root-scope tenant-claim check and the graph helpers. rls migrate counts only allow seeds when it checks that a key is granted on a scope.

  • Global roles can be read by key through a roles table: supabase.hook.roles.role and the new rls.roles accept { through: 'roles', on: { role_id: 'id' }, column: 'key' }. It ships because CentraKit, like most apps that manage roles in a UI, keeps user_roles (user_id, role_id references roles(id)), and copying keys into user_roles would turn every rename into a data migration. permdock_has, permdock_can_assign and the token hook join through the table, the hook grants supabase_auth_admin a read on it, and permdock_bump_authz_version_role_keys bumps every holder's authz_ver when a key changes. rls.roles defaults to supabase.hook.roles and the hook's roles to rls.roles; with it set, rls generate no longer creates user_roles, and --rbac supabase refuses it.

  • Grants take validFrom and validUntil (RFC 3339 or Unix seconds), normalised to Grant.validity { from?, until? }. Outside the window an allow denies with the new inactive-grant reason and detail: { from, until }; a deny does not apply and explain records it as skipped with why: 'validity'. where() and filter drop inactive grants, snapshot grants carry validity for the client evaluator, permdock rls generate ANDs now() >= to_timestamp(from) and now() < to_timestamp(until) into the access check, and simulate(checks, { now }) previews a batch as of one instant. The window is part of the policy fingerprint, and the catalog marks such a permission rowConditions: true.

  • Graph grants reach the ORMs. toWhere in permdock/drizzle and permdock/kysely compiles a related node to one subquery when given relations: { tables?, closure? }, and resolveRelated in permdock/prisma replaces each node with the ids it reads through a raw query. All three adapters export checkRow, which tells a missing row from a denied one in one query, and withSubject, which runs a transaction with the role and claims the generated RLS policies read.

  • HTTP adapters answer an exhausted limit with 429, Retry-After and the RateLimit / RateLimit-Policy fields of draft-ietf-httpapi-ratelimit-headers-11, and limit-unavailable with 503; tRPC and oRPC map them to TOO_MANY_REQUESTS and SERVICE_UNAVAILABLE. A limit denial now carries detail: { count, window, resetsAt } (LimitDetail). resource() takes disclosure: 'hide', which makes a denied row answer the same 404 /not-found problem a missing row gets; a missing row is now that problem instead of an empty 404. A step-up challenge names acr_values and max_age in WWW-Authenticate and acrValues / maxAge in the body, including the requirements of break-glass grants and role activations, whose denials now carry the assurance grantee in to. permdock doctor PD036 warns on a protect(permission) with no row loader on a route whose path names an id.

  • Link capabilities. A share link is a signed permdock-capability+jwt whose capability claim (v1) holds roles on one resource instance (on), optionally narrowed to permissions, with a required expiresAt, an optional redeemer ('anyone', 'signed-in', { user }, { scope, id }) and optional one-time use. signCapability(input, signer, { audience }) issues one from permission and resource references, and capabilitySubject and parseCapability build the subject and validate the claim. subjectFromCapability(token, { issuer, audience, revoked?, replay?, viewer? }) in permdock/jwt verifies it and returns a kind: 'link' principal whose only membership is { on, roles, via: 'link' }, with delegation.scopes from permissions; a revoked link id, a replayed one-time jti, a redeemer the viewer does not satisfy or a throwing store resolves to the anonymous subject, reported on on('auth') with the new causes capability-revoked, capability-replayed and redeemer-mismatch. A tenant can tighten links on its resources with a LinkPolicy (maxLifetime, allowed redeemers, required once): subjectFromCapability({ linkPolicy }) refuses a violating link with cause link-policy, signCapability({ linkPolicy }) refuses to sign one, and linkPolicyViolation names the broken rule. subjectFromJwt never accepts the capability typ.

    For RLS, exchangeCapability(subject, { key, alg, kid?, ttl? }) in permdock/supabase exchanges a verified link for a short-lived Supabase access token with role: 'anon' and the capability in a capability claim, and permdock rls generate --capabilities (rls.capabilities) emits permdock_capability_ids(p_resource, p_role, p_permission) and one anon policy per resource-scoped grant; a resource role without a memberships table is then reached by links only instead of failing generation. permdock/testing ships the permdock-capability+jwt fixture.

  • Named scopes (breaking). definePolicy({ scopes }) now declares scopes by name and in order, each { key, within? }: { organization: { key: 'organization_id' }, customer: { key: 'customer_id', within: 'organization' } }. Every scope after the first names an earlier parent, so the scopes form one tree; tenant and team are aliases of the first and second scope, and a policy with { tenant, team } must now declare team: { key, within: 'tenant' }. role(name, grants, { on }) is typed against the declared names, and the activation and restricted role options are reserved.

    Memberships are { scope, id, within?, roles, via?, expiresAt? } (or { on }); the { tenant, team } form is still accepted as input and normalised when the subject is resolved, and snapshots, claims and events always carry the canonical form. There is no implicit cascade between scopes: a role applies only through a membership of its own scope, so a team membership no longer satisfies a tenant role, and subjectFromJwt groups and directoryMembershipSource now yield tenant memberships with via: 'group:<id>' instead of team memberships. definePolicy throws when a scoped instance grant touches a resource without a memberOf relation on the scope's key.

    where(), filter, snapshots (scopes is now an ordered { name, key, within, resources } list), fromSnapshot, mayAccess, memberOf conditions, custom roles (CustomRole.scope and id) and the catalog (scopes[], roles[].on as a scope name) understand named scopes. permdock rls generate emits one permitted_<scope>_ids(p_grant) per declared scope, reads rls.memberships.scopes.<scope> tables with columns in database mode and canonical memberships claim entries in jwt mode, types scope columns through rls.scopeTypes, and keys the custom-role tables by scope and scope_id instead of team_id. authorizeSql({ scope }) names the first scope. permdock doctor PD025 (--only scopes) warns on fixture memberships the scopes would drop. rlsParity({ snapshot: true }) also checks the serialized snapshot, and testMembershipSource({ policy }) checks memberships against the policy's scopes.

  • New runtime entry permdock/catalog: parseCatalog(json) validates a permissions.catalog.json (text or parsed) against schemas/catalog-v1.json and returns a deep-frozen, prototype-safe copy, throwing PermDockValidationError with every issue; rowConditionKeys(catalog) lists the permissions marked rowConditions: true; the Catalog* types move here and stay exported from permdock/cli, with CatalogDocument['version'] now 1. permdock/cli exports catalogPath(config, cwd, out?), the path collect writes to. catalog-v1.json now requires what collect always writes (generatedAt, generator, a permission's meta and usages, a resource's id and schema), types every field the catalog carries, and adds the missing staleOn on approvals; permdock catalog --format schema emits the same document.

  • One name per concept, and the policy vocabulary reaches every handler.

    Adapters that hand out an instance now type it with the policy's roles, plans and permissions (PermDock<V>), as core and permdock/next already did: Hono's c.get('permdock'), Express and Fastify withPermDock handlers, Elysia's derived permdock, the Node, Claude Agent SDK, Eve, OpenAI Agents and terminal permdock() results, the terminal protect context, the Supabase middleware contribution, oRPC middleware context, Convex ctx.permdock and PdpPermDock. permdock/fastify gains withPermDock(handler), which types request.permdock without augmenting FastifyRequest.

    OldNew
    CreatePermDockOptionsPermDockOptions
    CreatePermDockPluginOptionsPermDockPluginOptions
    ServerPermDock.handler, AuthzenPermDock.handlerpermdockHandler
    ExpressPermDock.handler(fn)withPermDock(fn)
    SsfAdapter, SsfOptionsSsfPermDock, SsfPermDockOptions
    SupabaseMiddlewareOptionsSupabaseMiddlewarePermDockOptions
    A2AAgentCard, A2APermDock and the other A2A* typesA2aAgentCard, A2aPermDock, …
    dock, pd, server, factory for the instance in docs and skillspermdock; a cloud() result is permdockCloud
  • One package: the CLI moves into permdock. The permdock binary is the package's bin, @permdock/cli becomes permdock/cli (defineConfig, run), @permdock/cli/unplugin becomes permdock/unplugin, and permdock/next/plugin runs collect itself instead of resolving @permdock/cli. permdock, owned by the scaledockhq npm organisation, is the only package name.

    Runtime entry points (permdock, permdock/next, permdock/jwt, ...) still depend on @standard-schema/spec only: every command is loaded on demand, and tests/bundle fails if a runtime entry reaches a CLI or test-runner package. Dependency cost, measured as npm unpacked size:

    • oxc-parser is the package's one other dependency, because collect, usage, doctor, catalog, cloud push and the build hooks parse source: 1.43 MB, plus @oxc-project/types (0.04 MB), plus one platform binding (1.59 to 2.12 MB; darwin-arm64 1.76 MB, linux-x64-gnu 2.12 MB). That is about 3.1 to 3.6 MB per install.
    • ajv (1.03 MB unpacked) and yaml (0.69 MB) are bundled into the lazily loaded OpenAPI command chunks instead of being installed.
    • pgsql-parser (2.83 MB with libpg-query WASM and pgsql-deparser), pg (0.10 MB) and unplugin (0.08 MB plus its dependencies) are optional peers. permdock rls import, the --db modes and permdock/unplugin print the install line when the peer is missing.

    Generated catalogs record generator: permdock@<version>, and generated barrels say @generated by permdock.

  • OpenAPI output now matches the documented shapes:

    • scheme.deprecated emits deprecated on 3.2 and 3.3 and x-oai-deprecated on 3.1.
    • On 3.1 the device flow sits inside flows as x-oai-deviceAuthorization, with the flow's own URL as x-oai-deviceAuthorizationUrl.
    • A permission granted unconditionally to anyone() gets security: [].
    • Top-level grants now reach x-permdock-conditions and x-permdock-approval.
    • The 3.3 profile scheme carries supportedParametersSchema as a URL and named servers. securityProfileRequirements(scopeSets?) writes one requirement per distinct scope set, each with securityScheme, token_endpoint_auth_methods, grant_types and scopes.
    • permdock openapi emit --target 3.3 writes openapi: 3.3.0 and validates the result against a patch of the 3.2 schema keyed by the draft pin. permdock openapi import accepts 3.3 documents.
  • Overlay actions now target operations with $.paths.*[?@.operationId == '<id>']. The old target had an extra .* and selected nothing. permdock openapi emit --format overlay covers the source document's operations by their own operationId, fails on a covered operation without one, and under --check reports operations whose source already sets security. overlay({ operations }) takes the same list. Actions are sorted, and info.version is a catalog fingerprint. x-permdock-conditions and x-permdock-approval are objects keyed by permission key, as the extension table defines.

  • Permission-level custom roles bounded by a ceiling. CustomRole gains grants ({ permission, effect? }, no conditions) and an optional team; includes is now optional. Every custom role resolves through resolveCustomRole(policy, role): its included roles' grants plus its own allows, minus its own denies, intersected with the code allows of the declared assignable roles in its scope. Grants inherit the declared grant's condition, approval and limit, and keys outside the ceiling are dropped and reported by validateCustomRole and permdock doctor PD023.

    assignablePermissions({ tenant? }) joins assignableRoles: both intersect the ceiling (narrowed by RoleSource.assignable) with what the subject holds, and a held role or granted permission with meta.manageRoles: true lifts the intersection. Snapshots carry resolved custom-role grants and a per-tenant assignable list, read by fromSnapshot and the new useAssignablePermissions hook (Vue, Solid, React Native; assignablePermissions store in Svelte). testRoleSource accepts { policy } to check custom-role grants against the ceiling.

    Behaviour change: an includes entry is now bounded by the ceiling too, so a custom role that included a global or non-assignable role no longer reaches that role's grants, and assignableRoles() now also lists assignable roles whose every allow the subject holds.

  • Provisioned roles and plans are bound to their tenant. directoryMembershipSource looks users up with a structured eq filter, so a principal id is never parsed as filter syntax. Core drops roles the policy declares assignable: false from managedBy: 'idp' memberships, and scimHandler reports unknown roles on PATCH too. subjectFromClerk puts o: plans (as entitlements) and o: features on the session organization's membership instead of the principal.

  • RLS CLI fixes found by the coverage suite:

    • rls import maps = 0 and = false conditions instead of importing them as opaque.
    • rls import treats only auth.jwt() and auth.session() as claim sources; ->> on a column or on (select auth.uid()) is no longer a principal.claim.* reference.
    • The raw rls import fallback reads roles, for and as restrictive from the policy header only, so a with check (...) or a word inside using no longer leaks into them.
    • A malformed supabase.hook.memberships entry gets the "takes fromTable / fromJunction sources" error instead of a TypeError.
    • rls generate refuses any output that names service_role, in every target; before, the guard matched only to, from and ; forms.
  • Relationship graph additions. An edge relation takes match (fixed column values, so one table with a role column serves several relations) and groups (a row may name a group whose members hold the relation, nested at most 16 deep per resource), and any relation may list includes, the relations that imply it. A resource declares links, named to-one references, and relation(resource, name, { through: ['folder', 'team'] }) follows them. A resource role on a self-parented resource reaches the instances below it when a relations source is present. RelationHolder gains a group variant, RelationSource.ancestors takes a link name as through, whoCan reports group shares and implied relations, and RLS compiles all four through the permitted_<resource>_ids helpers and new permdock_link_<resource>_<link> helpers.

  • Relationship graph. A resource's parent may now name the resource itself (nested folders, sub-teams, reporting lines), restricted: '<column>' names a boolean column whose rows are reached only by grants on themselves, and relations take three shapes: a field (owner: 'ownerId'), an edge table ({ edge, object?, subject?, expiresAt? }, where an expired edge does not match) and, on a principal resource, { principal, period?: { startsAt?, expiresAt? } }. relation(resource, name, { through: 'parent', depth }) follows the row's parent chain upward to the relation's resource and then along its self-parent for up to depth hops (default 16, at most 32); definePolicy rejects a through grant that cannot reach its resource or walks a memberOf relation.

    Graph grants compile to the new related condition and are decided through a RelationSource (ancestors, related) passed as createPermDock({ relations }) (every adapter's createPermDock forwards it), with answers cached per instance. memoryRelations(permissions, { rows, edges }) is the in-process source and testRelationSource in permdock/testing the conformance runner. Evaluation stays synchronous: await permdock.loadRelations(permission, rows) loads an async source's answers first. A cycle, or a chain that goes on past depth with no holder within it, denies with the new reason relation-depth; a missing, throwing or unloaded source denies with relation-unavailable, and a graph deny that cannot be evaluated denies the decision. await permdock.whoCan(permission, row) lists holders and how (role, relation, share) from MembershipSource.list and RelationSource.related, never grants, and returns complete: false whenever a grantee cannot be enumerated.

    Snapshots carry no graph: graph grants, and grants on a relation with a period, are portable: false there, so clients resolve them on the server; where() keeps graph grants as related nodes and leaves out only relations with a period (partial: true). permdock rls generate emits <schema>.permdock_closure(resource, ancestor, descendant, depth) kept current by statement triggers on each walked self-parented table (stopping at restricted rows and the depth, refusing cycles), permitted_<resource>_ids(relation) helpers, and compiles each graph grant to one uncorrelated closure subquery. permdock rls verify --tree --db checks parity on a generated tree with restricted branches. Catalog resources carry restricted and the new relation shapes, and a relation grantee on the wire may carry through and depth. permdock doctor PD031 warns on a self-parent or restricted column no graph grant uses, and PD032 errors on a graph resource rls generate cannot name. The saas domain in permdock/testing gains a folder tree with shares (saasRelations, saasFolderScenarios).

  • Repository tooling only: presets for lint, TypeScript, tests, CI, Turborepo and Vercel, plus Portless local dev, editor and MCP configs, agent docs and decision records. The published permdock package is unchanged.

  • Restricted API keys and service accounts. An API key is an opaque pdk_<id>_<secret>; the application stores its SHA-256 hash (hashApiKey) next to a Credential (v1) record and never the key (generateApiKey, parseApiKey). A user credential acts as its owner with the owner's live roles and memberships, narrowed to the key's permissions through delegation (OAuth scopes, and RFC 9396 authorizationDetails with an identifier per resource id), so a demoted owner's keys lose the same rights at once. A service credential is a kind: 'service' principal whose only membership is { tenant, roles, via: 'credential' }.

    decideCredential(permdock, request, { settings, approved? }) decides whether the current subject may create a key: a service key's roles and permissions must be within the creator's assignableRoles and assignablePermissions in its tenant, and links, credentials and delegated creators cannot exceed themselves (new denial reason exceeds-creator). A tenant's credentials settings (maxTtl, kinds, approval, allowNoExpiry) come from the new SettingsSource (memorySettings); a violation is the new denial reason credential-policy, a key without expiry is refused unless the tenant allows it, and approval makes creation approval-required with a token bound to the key and its creator. credentialSubject, credentialDelegation, credentialPolicyViolation and parseCredential are exported.

    subjectFromApiKey(options) in permdock/server returns a SubjectResolver that verifies a key through a CredentialVerifier (apiKeyVerifier({ find }) compares hashes in constant time; memoryCredentials() issues, rotates and revokes), re-checks expiry, revoked(id) and the tenant settings on every use, and loads the live owner; any failure is the anonymous subject with an on('auth') cause (malformed, unknown-credential, invalid-claims, expired, credential-policy, credential-revoked, owner-unavailable). Credential changes and sampled uses are credential sink events (created, used with sample, rotated, revoked) with CloudEvents type dev.permdock.credential, built by credentialEvent, and decision events name the key in subject.credential. permdock/testing adds testCredentialVerifier and testSettingsSource, and permdock doctor PD029 (--only credentials) flags fixture keys that never expire and tenants that allow them.

  • Role ownership and audiences. role(name, grants, options) takes min and max (holders per scope instance), transferOnly (the holder count only moves by transfer), assigns (the roles a holder may assign and revoke), for (the membership kinds, Membership.via, that may hold the role) and a typed meta: RoleMeta with audience. A role held through a membership kind its for does not list, or through a membership without via, grants nothing: it is dropped when the subject is resolved and filtered in the generated RLS helpers.

    permdock.decideRoleChange({ kind: 'assign' | 'revoke' | 'transfer', role, scope, id, within?, target, holders? }) checks one change against the assigns graph, the ceiling, for, exclusiveWith, min, max and transferOnly, with the new denial reasons last-holder, max-holders, transfer-only, not-assignable-by, self-demotion, not-allowed-for-membership and conflicting-role; the snapshot-backed client denies it with unsupported. Once any role declares assigns, assignableRoles() returns exactly the roles the held roles list, and heldRoles() / assignableRoles() are ranked by the graph. heldRoles({ scope, id }) narrows to one scope instance, and permdock.audiences() and snapshot.audiences list the distinct audiences of the roles held in the active tenant.

    permdock rls generate reads a via column on membership tables, adds a deferred constraint trigger per scope table for min and max, statement triggers over transition tables for transferOnly, and permdock_can_assign(p_role, p_scope_id). Catalog roles carry min, max, transferOnly, assigns, for, exclusiveWith and audience. permdock doctor PD026 (--only ownership) warns on a scope whose roles set no min.

  • SCIM discovery follows RFC 7644 section 4: /Schemas and /ResourceTypes return ListResponses, serve one item by id, carry meta, and refuse a filter with 403. Every advertised attribute states multiValued and required. Created users and groups now get a real meta.created time instead of an empty string.

  • Smaller server bundles, bounded network calls and a faster policy lookup.

    OpenTelemetry and Web Bot Auth now reach an app's bundle only when it imports them. The adapter options take the function instead of its options, and applyOtel is gone:

    BeforeAfter
    otel: { logger }otel: (permdock) => withOtel(permdock, { logger }), with withOtel from permdock/otel
    webBotAuth: { verify: true, keys }webBotAuth: (request) => verifyWebBotAuth(request, { verify: true, keys }), with verifyWebBotAuth from the adapter entry or permdock/server

    OtelWrap (from permdock/otel) and WebBotAuthVerifier (from permdock/server) type the two options. A Hono app without either option ships about 1.6 KB gzip less; permdock/next and permdock/mcp about 1.9 and 2.4 KB less.

    Every outbound request now has a default timeout: JWKS and discovery 5 seconds (jwksCache.timeout changes it), Web Bot Auth key directories 5 seconds, Cloud requests 10 seconds, the React provider's endpoint calls 10 seconds, terminal device, token and CI OIDC requests 10 seconds, and SSF polls 30 seconds. An aborted request fails closed like an unreachable endpoint. Concurrent JWKS and discovery fetches for one issuer share a single request.

    definePolicy indexes grants by permission key once, so a check no longer scans every grant.

    The CLI reports a missing optional peer (pg, pgsql-parser) with its install line only when the module is missing; any other load error surfaces as it is.

  • Snapshots bind principal.claims.* refs in grant conditions to the subject's values. The snapshot principal carries no claims, so a client read them as missing: an eq or in on a claim denied what the server granted, and a notIn granted what the server denied. principal.id, tenant and the other fields the snapshot carries stay references.

  • Soft and hard quotas. limit accepts mode: 'hard' | 'soft' (default 'hard', today's behaviour) and alertAt, a fraction of count in (0, 1]. A soft limit grants past its count with the obligation { kind: 'over-limit' }; alertAt adds { kind: 'near-limit' } once usage reaches it. A granted decision under a limit carries quota: { remaining, resetsAt } (resetsAt in Unix seconds), and obligations when one applies. An unreachable store still denies with limit-unavailable in soft mode. describePolicy matrix cells accept obligations (the expected kinds). New exported types: GrantLimit, Quota, Obligation.

  • Subject attributes in RLS. permdock rls generate compiles nested claim refs (principal.claims.attrs.region becomes (select auth.jwt()) -> 'attrs' ->> 'region', with every segment checked against the prototype-key blocklist), casts a claim to the column's type read from the resource's Standard JSON Schema (numeric, boolean, timestamptz, date, uuid; numbers and booleans must be that JSON kind), and compiles in / notIn against an array claim to = any (array(select ...)), evaluated once per statement. A grant that reads context.* is refused with a pointer to the new doctor check PD027 (--only context-refs), or skipped under --skip-closures. rlsParity accepts subject claims and a neon dialect.

  • Supabase SQL security and performance:

    • Helpers. rls generate and supabase hook generate put the security definer helpers, role_permissions, the closure, break-glass and authz_version tables and the hook in a private permdock schema the Data API does not expose. authz_version.user_id is a uuid that references auth.users and cascades on delete.
    • Casts. The helpers, the hook, the ownership triggers, graph SQL and rls verify --tree compare a membership's user and scope columns uncast and cast the parameter instead, so the column's index applies.
    • authorize(). It honours effect = 'deny' and membership expiry, and is executable by authenticated only.
    • Break-glass. The break-glass read keeps the tenant boundary: a grant on a role reads only the rows of the scope instances where the subject holds it, through a <permission>#break-glass grant key.
    • Generated SQL. It enables row level security before the grants and schema-qualifies every table. The hook reads app_metadata from the event instead of auth.users.
    • New rls generate --split parts. seeds writes the role_permissions rows as a versioned migration (--seeds-out). indexes writes the indexes the policies and helpers filter through. rls verify --introspect warns about a column no index starts with.
    • New doctor checks. PD046 to PD053 cover user_metadata in SQL, definer functions executable by anon or public, functions without search_path, public tables without RLS, unwrapped auth.uid(), update policies without with check, and unindexed foreign keys. PD054 flags stale role_permissions seeds. PD028 accounts for Supabase's default privileges and tracks insert and update apart.
    • rls.anonymousSignIns: 'deny' keeps a Supabase anonymous sign-in out of every grant but anyone()'s.
    • exchangeCapability signs ES256 by default.
    • Contracts. Every catalog permission carries rowConditions, which is true when the catalog was built without the policy. The claims schema and supabaseClaims() require a non-empty sub at each act level and accept member: { group }, which subjectFromSupabase keeps.
  • Supabase declarative schemas on pg-delta. With [experimental.pgdelta] enabled = true in supabase/config.toml, permdock rls generate --split without --out writes pg-delta's per-schema, unnumbered layout under declarative_schema_path: permdock/helpers.sql, permdock/indexes.sql, public/policies/permdock.sql and permdock/functions/custom_access_token_hook.sql. permdock supabase hook generate without --out writes the same hook path. pg-delta keeps grants, so the hook keeps its supabase_auth_admin grants. It rejects data in a schema file, so the helpers part now needs the seeds part with --seeds-out. Doctor PD042 and PD043 are off under pg-delta. The token hook casts user_id to uuid once, so supabase db lint reports no implicit casts.

  • Suspension in generated RLS, and a token hook that writes memberships. rls.suspension (also a supabaseRls and authorizeSql option) names a users table and a table per scope, each { table, id, disabledAt?, status?, active? }. permdock_has, every permitted_<scope>_ids and authorize() then drop a suspended user's roles and every membership whose instance or ancestor instance is suspended. The check runs live in database and jwt mode, and a missing status row counts as suspended. generate fails on a suspension entry with an undeclared scope, no disabledAt or status, a status without active, or a nested membership table without the ancestor column it needs.

    In jwt mode, permdock rls generate --rbac supabase now emits a custom_access_token_hook that also writes the canonical memberships claim ({ scope, id, within?, roles, via?, expiresAt? }) from every rls.memberships.scopes table. It leaves out expired and suspended entries, gives a suspended user user_role: [] and memberships: [], and grants supabase_auth_admin read access to the tables it reads. supabaseRls({ memberships }) accepts scopes, and SupabaseMembershipTable accepts columns, like RlsMembershipTable.

  • The OCSF projections now match OCSF 1.3.0. accessToOcsf uses Account Change activity 2 (Enable) for started and 5 (Disable) for ended and revoked, instead of 1 (Create) and 4 (Password Reset), and sets the required type_uid. toOcsf always sets the required user, as { name: 'anonymous' } for an anonymous subject.

  • The SQL helpers have a written contract: permdock_has, permitted_<scope>_ids and permitted_<resource>_ids, what each answers, the grant keys to pass, the role-and-scope-only rule and the exact-text id rule, on the RLS page. schemas/supabase-claims-v1.json in the package is the JSON Schema of the claims the hook writes and the helpers and subjectFromSupabase read. The Supabase page adds a "With better-supabase" split of what each package owns.

  • The SSF receiver looks up onEvent handlers by own key only. An event named after an Object.prototype member, such as toString, now reaches the * handler instead of calling the inherited function.

  • The Supabase hook manifest gains memberships (each source's table and its user, scope, id, role, within, via and expiry columns or fixed values), rls (helper schema, jwt or database mode, tenant claim, scope id types, and each helper's arguments, return type and execute roles), decidingColumns (every schema.table.column a membership or an attrs claim is computed from, the same set PD028 checks) and markers ({ hook: 'v1', grants: 'v1' }), plus $schema. Its JSON Schema ships as schemas/supabase-manifest-v1.json. permdock supabase inspect --out permdock.manifest.json writes it, and --check exits 1 when the file's JSON differs. inspect --out used to override the hook path; the path now always comes from supabase.hook.out. fromTable and fromJunction expose their entry as sql.manifest.

  • The Supabase manifest's rls section has a memberships list of the tables member_<scope>_ids_for reads, in the same shape as the hook's memberships. It names the rls.memberships table mapped for each scope, else the rls.membershipSources that can hold it, else the hook's sources. A reader that resolves memberships outside the hook, such as better-supabase's entitlements, can now read the tables the SQL helpers use.

  • The Supabase token hook migration adds permdock_bump_authz_version_for(p_users uuid[]), which bumps authz_ver once for each listed user. A trigger on a table the hook does not read, such as better-supabase's entitlement_members, can now invalidate its users' tokens. The function is security definer, and no client role may execute it. The membership triggers now call it. The manifest names it in authzVersionBump when authzVersion is true.

  • The cloud() sink bounds its re-queue while the Cloud is unreachable (capacity, default 10 000, oldest dropped first), matching memorySink.

  • The permdock CLI parses flags with citty. permdock <command> --help (or permdock help <command>) prints that command's flags with their values and defaults. A flag with a fixed set of values rejects any other with exit 2 and the list it accepts, for example catalog: Invalid value for argument: --format (xml). Expected one of: json, schema, markdown.

    Config, permissions and policy modules that Node cannot load on its own fall back to jiti, so they may use enum, TSX, extensionless relative imports and the paths aliases of the nearest tsconfig.json.

    --check on collect, openapi, rls generate and supabase hook generate prints a unified diff of each stale file, cut to 40 lines.

    A missing optional peer (pg, pgsql-parser, unplugin) fails with the install line for the package manager that ran the command, or the one whose lockfile the project has.

    On a terminal, skills install without --agent asks which agents to install for, and doctor --fix asks before writing. In CI, in a pipe or with --json there is no prompt.

    doctor reports are styled on a colour terminal; NO_COLOR and --no-color turn styling off. supabase/config.toml is read with a TOML parser, and the new PD045 warning reports a file that does not parse.

    The CLI's new dependencies are citty, jiti, smol-toml, package-manager-detector, @clack/prompts and diff. Runtime entries still depend on @standard-schema/spec only.

  • The permdock CLI starts faster and reports failures in a form scripts can read.

    • permdock --version (-v) prints the version. --help prints a static command list and loads no command, no config and no core.
    • --yes (-y) never prompts and takes the answer the flags give.
    • Under --json, a failure prints RFC 9457 Problem Details on stdout, with type https://permdock.dev/problems/cli-usage or cli-unavailable.
    • A database that does not answer exits with 1, not 2, and names the command. --db connections time out after 10 seconds and statements after 60. rls introspect runs its queries in parallel over a pool of four. Ctrl-C ends the connection and exits with 130.
    • Generated SQL, catalogs and who-can output sort by code unit, so the same input gives the same bytes in every locale and runtime.
  • The permdock skill names the docs MCP tools search, list_pages and get_page, the tools the docs server at /mcp now exposes.

  • The subject option of permdock/server and every adapter built on it is now typed to return a full Subject or null as well as the policy's user, matching what the kernel already accepted at runtime.

  • The bundled Agent Skills are renamed permdock-wire and permdock-audit, and six skills join them: permdock, a general skill that routes to the others, plus permdock-agents, permdock-approvals, permdock-tenancy, permdock-data and permdock-credentials. permdock skills install copies all eight, and permdock doctor (PD005) looks for the permdock skill.

  • The catalog, permdock rls and permdock doctor now call Standard JSON Schema's jsonSchema.output with { target: 'draft-2020-12' }, as the spec requires, instead of with no options.

  • The generated Supabase hook starts with a stable -- permdock:hook v1 schema=… tenant=… budget=… claims=… line, and supabase hook generate --check names the marker fields that drifted. permdock supabase inspect [--json] prints the version: 1 manifest of the hook and SQL helpers (helper names, tenant claim, budget and its measure, claims written, authz_ver); permdock/supabase exports the SupabaseHookManifest type and permdock/testing exports supabaseHookManifestFixture.

  • The npm README now covers install requirements (Node.js 24 or later, TypeScript 7), the quick start, one example per surface and every entry. The bundled wire-permdock and audit-permissions skills declare license: MIT and metadata (author, homepage, repository) in their frontmatter, and the repository exposes them to Claude Code as the permdock plugin in .claude-plugin/marketplace.json.

  • The package carries the tanstack-intent keyword. Internal non-null assertions and any flows in the core, conditions, CLI and adapters are replaced with checked narrowing; the PDP adapters' granted decision now fails closed with anonymous when a subject has no principal instead of asserting one.

  • The test runners move into permdock: @permdock/testing is now the permdock/testing subpath, with permdock/testing/saas and permdock/testing/saas/permissions. Vitest is an optional peer, and no application entry imports the testing entries. Import from permdock/testing and drop the @permdock/testing dev dependency; permdock is the only package name.

  • Tokens are bound to their issuer and audience. subjectFromJwt requires issuer with any remote jwks (a URL as well as a key set). joseTokenVerifier and permdock/ssf take the issuer from discovery when none is set and check every token against it. subjectFromIntrospection requires aud to contain the configured audience, rejects a differing iss, and no longer fills principal.issuer from the options. scimHandler no longer derives the audience from the request URL and throws when verifier is set without audience.

  • PermDockDeniedError and PermDockApprovalRequiredError carry a stable digest (PERMDOCK_DENIED;<permission> and PERMDOCK_APPROVAL_REQUIRED;<permission>;<token>), the property React keeps when an error crosses from a Server Component to the client, and parsePermDockDigest reads it. The new permdock/next/client entry exports PermissionBoundary, an error boundary built on catchError from next/error that renders its denied or approval fallback for a thrown PermDock error and lets every other error through, and usePermissionBoundary(), which gives a fallback the permission, the approval token and retry().

  • RateLimit and RateLimit-Policy now serialise the policy name as a valid RFC 9651 sf-string: " and \ are escaped instead of dropped, and a role name outside printable ASCII is percent-encoded as UTF-8.

  • cloud().approvals implements cancel(filter, meta) over POST /v1/environments/:env/approvals/cancel, so session revocation rejects pending Cloud approvals in one call.

  • cloud().policies.refresh() verifies the permdock-policy+jwt against the Cloud environment URL (iss and aud are <PERMDOCK_CLOUD_URL>/v1/environments/<env>; exp is 24 hours after issue). The audience option is removed. cloud() exposes the environment URL as issuer, jwks is the environment's JWK Set URL, and cloudEndpoints() resolves both without a key. The policy JWS fixture in permdock/testing follows the new claims.

  • cloud().snapshots.get() requests application/jwt and returns only a compact permdock-snapshot+jwt; an unsigned snapshot body now throws instead of being parsed.

  • createPermDock freezes a copy of the subject instead of the caller's user object, roles and context, so later writes to them neither throw nor reach the instance. A schema that returns a rejecting Promise at a boundary, in a claims mapping or in WebMCP tool arguments no longer leaves an unhandled rejection behind.

  • decide() evaluates a denial's alternatives at the now you pass, not the wall clock. With a pinned now and no sink or on() listener, a check reads no clock at all, so it runs in a prerendered React Server Component or Client Component under cacheComponents.

  • definePermissions(tree, { renamed }) maps former permission keys to current ones: stored custom roles, OAuth scopes, AuthZEN actions, hosted grants and findPermission accept the old key, while decisions and audit see only the new one. The catalog lists renamedFrom, permdock diff reports renamed (not breaking) and alias-removed (breaking), rls generate seeds role_permissions under former keys too and permdock_custom_keys reads a stored former key as its current key, rls generate --shims adds wrappers under legacy helper names, and permdock doctor PD055 and PD056 report what still uses an old key or helper.

  • definePolicy takes delegations: standing statements that holders of from (a role, authenticated(), a plan or assurance()) let actors matching to (actor('eve'), an actor kind, or { kind, id } for one agent) use permissions for them, with optional validFrom / validUntil. Each is normalised to { from, to, permissions: string[], validity? } on policy.delegations, is part of the fingerprint, and is listed in the catalog's new delegations section; permdock diff reports a removed one as delegation-removed and one that lost permission keys or validity as delegation-narrowed. In decide, the matching delegations form a ceiling for the actor: a permission outside it is not-delegated, inside it a token delegation on the call must still cover, and the principal's grants, conditions, denies and approvals apply first as before. The snapshot carries the ceiling as delegated and the client evaluator applies it. delegatedPermissions is exported from permdock.

  • dev.permdock.catalog drift findings are typed CatalogFinding objects { code, permission, grant? } with code one of permission-removed, not-hostable, grantee-removed or approval-tightened; parseCloudEvent and verifyWebhook reject the earlier free-text strings.

  • endpoint: false on createPermDock from permdock/next, its PermDockProvider and the permdock/react provider makes the client snapshot-only. It never fetches, and a check the snapshot cannot answer (a closure, graph relation or period grant) is denied with the new reason server-only. The provider logs the first such permission once. The same reason replaces opaque-condition whenever the client store has no endpoint. permdock doctor PD044 warns when usePermission reads such a grant and the app has neither an app/**/api/permdock/route.ts using permdockHandler nor an endpoint. The Next.js Cache Components guide adds URL slugs (a public slug lookup ahead of the private snapshot, notFound() and forbidden()), snapshot-only mode, and a cross-origin endpoint section.

  • isPermission(value) is exported from permdock: it narrows an unknown such as an MCP tool's meta to Permission without a cast, and accepts a leaf that crossed JSON. permdock/cli exports parseHookMarker(sql) and parseGrantsMarker(sql), which read the first line of a generated hook or --grants-out migration.

  • mayUse(permdock, permission) is exported from permdock. It answers whether some grant in the instance's snapshot could match for its subject, active tenant and delegation, and is the listing hint permdock/mcp and permdock/a2a already use. An MCP server that protectServer cannot wrap, such as better-supabase createMcp, filters its tool list with it and decides each call with decide; adapters/mcp.mdx has the recipe.

  • membership sink events name the scope instance the way memberships do (breaking). MembershipEvent drops tenant and team for scope, id and within, and gains expiresAt, so a role change at any depth (a contact on a site inside a customer inside an organization) is recorded. membershipEvent() takes the same fields and throws a TypeError when scope and id are not given together, or within has no scope. SCIM group changes emit { scope: 'tenant', id }, and Better Auth onRoleChange({ sink }) emits { scope: 'team', id, within: { tenant } } for a team role. The format stays v1.

  • permdock collect and permdock doctor no longer crash with Cannot read properties of null on a source file with array holes (const [, , id] = parts). Doctor PD010 and PD014 ignore comments, and PD014 no longer reads a const jwks: JSONWebKeySet declaration as a jwks option without an issuer.

  • permdock diff a b compares two policies or catalogs (a permissions.catalog.json or a module exporting policy) and lists the permissions, scopes, roles and grants that changed. It exits 1 on a breaking change: a removed permission, scope, role or allow, a narrowed allow (new or changed where / check, new approval, fewer fields, shorter validity, new limit), or a new or changed deny. --impact runs the rls verify fixtures through both policies and reports who loses or gains what; a lost grant is breaking. --json prints the report. The catalog gains a grants section listing every code grant in canonical order when built with the policy; CatalogGrant and CatalogValidity are exported from permdock/catalog.

  • permdock doctor PD002 and permdock collect no longer report valid code as unknown permission references. The false positives were role and plan vocabulary (role(roles.admin, …), plan(plans.pro)), a leaf's wire fields (permissions.post.read.scope, .key) and a resource subtree (relation(permissions.post), include: [permissions.post]).

  • permdock doctor adds two Supabase checks. PD040 warns on auth.role() in a migration, which Supabase deprecated; name the policy's roles with to authenticated instead. PD041 warns when exchangeCapability signs with alg: 'HS256', the project's shared JWT secret; sign with ES256 and an asymmetric signing key.

  • permdock doctor without --fix and permdock usage no longer write permissions.catalog.json. PD002, PD044 and usage scanned the sources through a full collect, which wrote or refreshed the catalog as a side effect, so a doctor run in CI left a changed file behind. They now scan in memory, as the usage page already said.

  • permdock rls generate --rbac supabase no longer emits custom_access_token_hook: permdock supabase hook generate is the one generator of the token hook, so a single function writes user_role, memberships and the other claims. The scaffold keeps the enums, user_roles, role_permissions, the helpers and authorize().

  • permdock rls generate --split helpers,policies,hook --out <dir>/056_permdock_{part}.sql writes one file per part for Supabase declarative schemas, and --grants-out <file> (or - to print) moves the token hook's supabase_auth_admin grants, execute revoke and read policies into a migration of their own, since supabase db diff drops them. permdock supabase hook generate takes the same --grants-out. --check compares every part and the grants file and names the part that drifted. Doctor adds PD042 (error: the hook is declared under supabase/schemas and no migration from the one that creates it on grants it to supabase_auth_admin) and PD043 (warning: schema_paths applies a file that calls the helpers before the helpers part), and doctor.migrations now defaults to supabase/schemas too.

  • permdock rls generate --target drizzle writes pgPolicy(...).link(schema.<table>) exports with the drizzle-orm/supabase roles, and --target prisma writes Prisma 8 policy_* blocks and refuses deny grants, which Prisma 8 cannot express. Both targets also write <out>.migration.sql with the helpers, grants and enable row level security, and --check compares both files. rls.drizzle.schema, rls.drizzle.exports and rls.prisma.models set import paths and names.

  • permdock rls generate applies a role's for to resource-role and nested-scope membership tables too: the exists check counts a membership only when its via column lists an allowed kind, and a table without a via column holds such a role for nothing, matching decide.

  • permdock rls generate compiles role checks to per-statement helpers. Policies call permdock_has('<grant key>') for global roles and "<tenant col>" in (select permitted_tenant_ids('<grant key>')) (or permitted_team_ids) for scoped roles: security definer, search_path = '' SQL functions over a seeded role_permissions (role, permission, grant_key, scope, effect) table, which Postgres evaluates once per statement (an InitPlan or hashed SubPlan) instead of once per row. --authorize database|jwt now drives them for every dialect. Tenant grants with only a claim and global grants with no condition no longer skip the role check.

    Policies collapse to one permissive and one restrictive policy per table and command ({table}_{op}); --policy-per-role keeps the per-role layout and --policy-name sets a template. The tenant claim is cast to --tenant-type (default uuid). Top-level definePolicy({ grants }) compile too, and a grantee Postgres cannot see fails with the permission named. --rbac supabase builds on the same helpers; authorizeSql reads the shared role_permissions. rls import reads both layouts back to roles and memberOf, rls verify passes roles and memberships in the claims and inserts whole rows, and rlsParity sets the role and memberships GUCs.

  • permdock rls generate compiles two more rules. deny(permission, { to: actor('oauth-client') }) becomes a RESTRICTIVE policy that refuses rows while the token carries client_id or act, so a third-party app's Supabase token stops where the in-process decide stops it. contains on a column the resource schema types as an array compiles to value = any(column), cast to the item type, instead of LIKE over the column's text.

  • permdock rls generate emits member_<scope>_ids() for every declared scope: the instances the caller holds any live membership of, with no permission key, for policies such as an organization switcher or "members read their organization's row". In database mode the helpers read the fromTable / fromJunction sources in the new rls.membershipSources (default supabase.hook.memberships) for every scope rls.memberships maps no table for, so the helpers, the token hook and the application's MembershipSource run the same SQL. rls import reads col in (select member_<scope>_ids()) back as a memberOf with no roles, and the hook manifest lists the new helpers.

  • permdock rls generate follows the Postgres and Splinter rules its docs cite:

    • One permissive policy per table, command and database role. anyone() grants are ORed into the authenticated policy and get their own TO anon policy, so Splinter's multiple_permissive_policies lint stays quiet.
    • The neon dialect targets Neon's anonymous role instead of anon.
    • The guc dialect wraps current_setting(...) in (select ...), so each setting is read once per statement.
    • rls import reads the wrapped form back.
  • permdock rls generate on Supabase writes member_<scope>_ids_for(p_user uuid) for each scope with a membership source (rls.membershipSources or supabase.hook.memberships) or a mapped rls.memberships table. It answers what member_<scope>_ids() answers, for p_user, from the membership tables, with the same expiry and suspension rules, so a supabase.hook.claims function can read the user's scopes before a token exists. execute is revoked from public, anon and authenticated. With supabase.hook.claims set, permdock supabase hook generate grants it to supabase_auth_admin (in the --grants-out file when given), and the hook manifest and PD039 list the member_<scope>_ids and member_<scope>_ids_for helpers.

  • permdock rls generate reads rls.dialect from the config, as permdock rls verify does; --dialect still overrides it. It used to fall back to supabase whenever --dialect was absent, so a neon or guc config silently produced Supabase SQL. An invalid rls.dialect now exits 2 like an invalid flag.

  • permdock rls generate skips every grant that requires an approval. It skipped only approval: 'human', so an approval: { by } grant compiled into a plain policy and the database allowed the action without the approval.

  • permdock rls migrate --sql <dir> rewrites a project's own SQL helper calls in create policy and alter policy statements onto permitted_<scope>_ids, permdock_has and member_<scope>_ids, as configured in rls.migrate (helper forms, exact key renames and prefixes). It is a dry run until --write, splices by parser location so formatting is kept, prints { rewrites, skipped } with --json, and exits 1 while a mapped key is unknown. Calls it cannot rewrite safely (a computed id, a dynamic key, a key with row conditions or not seeded on that scope, a call inside a function body or outside a policy) are reported with their line and left as written. rls generate --helpers-only (or rls.helpersOnly) writes only the helpers, seeds and scaffold, and rls verify --introspect with it diffs the helpers and role_permissions seeds exactly, fails on a hand-written policy that passes an undeclared or row-conditioned key, and lists RLS tables that call no helper as info.

  • permdock rls verify --introspect --db <url> compares the live database with what rls generate would write: policies (by name, command, permissive or restrictive, and roles), row level security on each table, the anon and authenticated grants, and whether each helper is still security definer with search_path = ''. It prints one line per difference and exits 1, so a hand-written permissive policy or a missing grant shows up before a user finds it.

  • permdock rls verify --tree fills the required columns its generated rows leave out, so it runs on tables with a NOT NULL tenant column or name: a foreign-key column takes an existing value of the referenced table, any other column a placeholder of its type. Before, the seed failed on any such table.

  • permdock supabase hook generate grants supabase_auth_admin usage on the schema of every table it reads outside the hook's schema, so a schema-qualified source such as fromJunction({ table: 'better_supabase.memberships', … }) works without a hand-written grant.

  • permdock supabase hook generate warns with PD039 when the helper schema has no generated permdock_has or permitted_<scope>_ids (read from rls.out and the migration folders, or the database with the new --db flag). permdock doctor PD039 reports the same and, with a doctor.claims fixture of sample tokens, each supabase.hook.claims entry larger than the memberships budget.

  • permdock supabase inspect --out with no path writes permdock.manifest.json, and inspect --check without --out checks that file instead of exiting 2. The datetime_preferences claim in supabaseClaimFixtures.full now uses CentraKit's keys: timezone, week_start, date_format and time_format.

  • permdock.explain(permission, data) (or decide with explain: true) returns the decision with a trace: how many grants were evaluated, the allows and denies that matched (trace.denies[0] is the deny that won) and the grants skipped with the reason. MatchedGrant carries the grant's name; a deny denial from a named deny carries detail: { name }. describePolicy cells take deniedBy. The trace is off by default and never emitted on a decision event.

  • permdock/a2a emits Agent Cards in the A2A 1.0 wire form, and the cards validate against the published a2a.json. The card URL moves into supportedInterfaces, security schemes use the one-of form (oauth2SecurityScheme), skill requirements become { schemes: { name: { list } } }, and skills carry tags. The card also fills description, capabilities and the default input and output modes. securitySchemes keeps its OpenAPI-style input with a typed type. sign(card, signPayload) now returns the card with a detached RFC 8785 JWS appended to signatures, instead of { card, signature }.

  • permdock/authzen follows more of AuthZEN 1.0:

    • Every response echoes X-Request-ID.
    • /access/v1/evaluations honours options.evaluations_semantic, and treats a request without an evaluations array as a single evaluation.
    • Discovery under /.well-known/authzen-configuration/<path> names the path-qualified PDP identifier.
    • Search accepts page.limit and returns page.count and page.total.
    • Subject search answers only for the user subject type.
  • permdock/eve follows eve 0.70: approval.response reads the responder from ctx.response.principal, and a Cancel from an eligible responder records the approval as rejected, so the re-check denies. permdock/drizzle accepts drizzle-orm 1.0 release candidates next to 0.40 and later, and recognises 1.0 array columns (dimensions) for contains. The @supabase/middleware peer range is now >=1.

  • permdock/jwt and permdock/supabase now take the outermost RFC 8693 act.sub as the actor. RFC 8693 section 4.1 makes that the current actor and says prior actors in nested act claims must not decide access; before, the innermost (oldest) actor was used. Every level of the chain must carry a non-empty string sub, or the subject is anonymous with cause invalid-chain. The full chain stays on delegation.chain.

  • permdock/jwt follows OpenID Connect more closely. Discovery never fetches an http: jwks_uri, and an inline metadata.jwks_uri over http: is a configuration error. With accept: 'id-token', an ID token needs iat, needs azp when it has several audiences, and its azp must be the client id whenever present. The OpenID Connect Core section 5.1 profile claims (email, name, picture and the rest) no longer reach principal.claims. claims.memberships now flattens Zitadel's role -> { orgId: domain } project roles into one membership per organisation.

  • permdock/mcp follows the 2026-07-28 specification more closely. A missing scope is challenged with the scope the call needs plus resource_metadata, not the held scopes plus the missing one; permdock/a2a and HTTP challenges use the same builder. approval-required becomes a multi-round-trip input_required result with a URL-mode elicitation and the approval token as requestState when approval.at is set and the client declares URL elicitation, and the elicitation hint is gone from MCP and WebMCP refusals. stepUp: { at } does the same for insufficient-user-authentication, with acr_values and max_age from the failing assurance grants, which a denial now carries in to. A resource option refuses tokens issued for another RFC 8707 audience. ActionMeta gains destructive and idempotent; tool annotations the author leaves out are filled from the permission, and crud() marks delete with destructive: true instead of tags: ['destructive']. The unused InsufficientScopeError export is removed.

  • permdock/mcp: createPermDock and subjectFromMcp now read RFC 9396 authorization details from both authInfo.extra.authorizationDetails and the raw claim name authorization_details. Before, each read only one of the two, so the same verifier output lost its details in one of them.

  • permdock/next targets Next.js 16.3 (the next peer range is now >=16.3). createPermDock also returns requireAccess({ permission, data?, tenant? }), which resolves to the granted Decision and interrupts a denial with unauthorized() for an anonymous subject or forbidden() otherwise (experimental.authInterrupts); approval-required and boundary validation still throw PermDockApprovalRequiredError and PermDockValidationError. The request-scoped instance is created after await io(), so decisions that read the clock no longer trip the "Date.now() while prerendering" error under Cache Components, and never block a prefetch the way connection() would. A redirect(), notFound() or other Next.js interrupt thrown by the subject or tenant resolver now propagates (unstable_rethrow) instead of turning the request anonymous. Sink writes and one flush() per render run inside after(), so a serverless function stays alive until buffered decision events are delivered.

  • permdock/openapi marks an operation with x-permdock-approval (and the optional x-badges hint) for every grant that requires an approval. It marked only approval: 'human', so approval: { by }, { distinct: false } and { staleOn } grants looked approval-free in the description.

  • permdock/supabase exports actorOf(claims) and delegationOf(claims), the rules subjectFromSupabase uses for the acting app: actorOf returns { ok: true, actor? } with the innermost act sub (or client_id) and a frozen copy of the chain, or { ok: false, reason: 'invalid-chain' }, which must deny; delegationOf returns the scope claim as { scopes }. supabaseClaimFixtures entries now state the expected actor and delegation.

  • permdock/supabase exports supabaseClaims({ tenantClaim? }), a Standard Schema v1 object for the hook's claim contract, and its types SupabaseClaims and SupabaseMembershipClaim; .extend(appSchema) merges a Zod, valibot or other Standard Schema over it, so a session library validates tokens without copying the shape. subjectFromSupabase now reads grantedBy and reason on memberships, supabase-claims-v1.json covers app_metadata, client_id, scope and act, and supabaseClaimFixtures adds full, portalContact, oauthClient and actChain.

  • permdock/supabase exports supabaseTenantClaim (tenant_id), the one default the hook, subjectFromSupabase, supabaseRls, rls generate, rls verify and rlsParity share. permdock doctor PD038 warns when a subjectFromSupabase or subjectFromSupabaseSession call reads the tenant from a different claim than rls.tenantClaim.

  • permdock/supabase reads act.kind as better-supabase 0.5.1 writes it: support becomes actor kind support with sessionId and readOnly, and impersonation becomes actor kind impersonation. Neither carries a delegation, so they reach only what a policy delegation names. An actor with readOnly: true gets only the read-only permissions of each policy delegation (readOnly on policy.delegations); other permissions deny with not-delegated, and mayUse follows the policy delegation ceiling. An unknown kind, or a support level without session_id, is the anonymous subject. supabaseClaims() and supabase-claims-v1.json validate the new act fields.

  • permdock/terminal asks for the resource id to be typed before running a destructive permission (replace the prompt with interactive: { typed }), and without a terminal exits with the new EX_USAGE (64) unless --yes or -y is passed or the yes option is set. --dry-run (or dryRun: true) decides as a simulation, prints the decision and exits with its code without running the action or consuming a limit. The ci-oidc token source takes { source: 'ci-oidc', audience } to request a GitHub Actions audience and { source: 'ci-oidc', env } to read a GitLab id_tokens variable. permdock/jwt adds subjectFromCiOidc(token, { provider, audience, issuer?, schema? }) for GitHub Actions, GitLab CI and Buildkite tokens, returning a workload principal with repository, ref and environment, never a user.

  • permdock/terminal: a network failure during the device flow now ends the device token source with no credential, so the chain moves on to the next source, the same as a failed refresh or revocation. Before, the thrown fetch error escaped the command.

  • permdock/testing/saas adds scenarios for an agent acting without a delegation, a delegation narrower than the user's grants, an exhausted api-key quota, a team role held on the tenant membership, org-1 against tenant-1 on lists and writes, and an expired membership on every permission class. Scenarios may carry actor, delegation and quotaUsed; saasUser, saasScenarioOptions and saasLimitStore build the subject and options a case runs with.

  • permdock/webmcp now validates instance-tool arguments against the resource schema when registerTools is given a resource node such as permissions.post, or a nested group, as the docs show. Before, the schema was found only from the root tree, so agent input went unvalidated. Collection actions no longer pick up the resource schema, and an explicit schema option now overrides it.

  • receiver.poll reports polled SETs that can never verify under RFC 8936 setErrs in the acknowledgement request, so a transmitter stops redelivering them. A SET whose handler failed is still left pending for redelivery.

  • resource() takes name for a resource name apart from its path, action metadata takes meta.x for application-owned JSON, rls.actions maps action verbs such as view to SQL commands (or 'none'), and describe(decision, { messages }) localises titles and details.

  • scimHandler and directoryMembershipSource read groupRoles by own key only. A group id such as constructor or __proto__ no longer resolves to an Object.prototype member, which made the SCIM endpoint answer 500.

  • sender: 'dpop' (the profile: 'fapi2' default) now resolves the anonymous subject with dpop-proof-invalid when no Request is passed, instead of skipping the proof. verifyDpopProof refuses a symmetric alg and a jwk header carrying private key members, per RFC 9449 section 4.3.

  • simulate() no longer throws on an Arazzo step whose parameters array holds null or a non-object. It skips those items and decides the step as usual.

  • snapshotTag(sub) from permdock/next returns the cache tag for a user's snapshot entries (permdock:<sub>, or permdock:anon without one), so a private-cache loader and the Server Action that changes roles agree on one string. The Next.js Cache Components guide gains the better-supabase 0.4 recipe: bs.cached({ tags }) inside 'use cache: private', stale capped by both the session and cacheLifeFor(snapshot), and bs.invalidateSession(sub, { tags: [snapshotTag(sub)] }) after a role change. Its URL-slug loader now takes the org id and never calls notFound() inside the private cache. The new apps/examples/next-better-supabase runs that recipe in snapshot-only mode against Postgres in testcontainers. permdock doctor PD014 now accepts a shorthand issuer property next to jwks.

  • subjectFromSupabase and subjectFromSupabaseSession take anonymousSignIns: 'deny', which maps a signInAnonymously() token (is_anonymous: true) to the anonymous subject, as rls.anonymousSignIns: 'deny' does in RLS. permdock doctor PD057 warns when rls.anonymousSignIns is 'deny' and a subject call does not pass the option.

  • subjectFromSupabase maps more of the token. plans: '<claim>' reads the active tenant's entry of a per-tenant plans claim (better-supabase's features) into principal.plans. act and the OAuth client_id of a third-party app become an oauth-client actor with scope as delegation.scopes, so such a token only reaches what its scopes delegate. A memberships entry the reader cannot use is still dropped, and now reports membership-dropped to the new onAuth option; permdock doctor PD039 lists those entries from the doctor.claims samples. supabaseClaimFixtures.betterSupabase is the canonical claim set better-supabase 0.4 emits.

  • supabase.hook.claims adds claims other packages own to the generated Custom Access Token Hook, for example { features: 'better_supabase.feature_claims' }. Each value is a schema-qualified (uuid) returns jsonb function; null leaves the claim out. permdock supabase hook generate refuses a claim name PermDock or Supabase Auth writes (roles, memberships, the tenant claim, sub, role and the rest) and an unqualified function, grants supabase_auth_admin execute on each function, keeps the claims outside the memberships budget, and writes none of them for a suspended user.

  • supabaseClaimFixtures in permdock/testing adds supportSession, supportSessionReadOnly, impersonation and anonymousSignIn, and each fixture states the actor and delegation it maps to.

  • supportAccess() now type-checks inside definePolicy({ roles }) when the policy's scopes are literal: it returns RoleBinding<S> for on: S and RoleBinding<'tenant'> without on, the scope it defaults to.

  • webBotAuth takes a now clock in Unix seconds for the created and expires checks, so the RFC 9421 Appendix B vectors and replayed captures can be verified.

On this page