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_guardlets a signed-in caller insert or update a platform role row, one with no tenant, that has theskipcolumn set, as long as the row stays a platform row. Since 0.34 it refused these writes with42501system-role, so platform staff could no longer create platform catalog roles through the Data API under the app's own policies.skiphas no effect on a platform row, so the guard did not need to cover it. Moving a row that hasskipinto or out of a tenant is still refused. Rerunpermdock rls generate.
0.35.0 (2026-11-26)
-
rls.tokenScopes: { delegations: true }compiles policy delegations toactor('oauth-client')(every client, or{ kind: 'oauth-client', id }) fromauthenticated()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: trueis unchanged.Doctor fixes: PD058 compares
sync-config.yamlwith the publication statement in the schema files, aspermdock generate --only powersyncwrites it, so a current file is no longer reported stale, and its fix namespermdock generate --only powersync. PD053 countsunique nulls not distinct (...)andunique nulls distinct (...)constraints as indexes.
0.34.0 (2026-11-26)
- Breaking:
snapshotForleaves custom-role grants out of the snapshot and names the roles incustom.held;customRoleRecord(policy, customRoles, tenant)writes the tenant-level record andfromSnapshot(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
membershipsas{ 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,subjectFromSupabaseand thejwt-modeauthorizeread both forms; code that reads the raw claim as an array usesexpandMembershipsfrompermdock/supabase.permdock claims sizereports 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 assuspendedInandprincipal.suspendedInexposes it. RLS still denies. - The generated
permdock_token_current()accepts the compactmembershipsobject the hook writes as well as the older array, so the claims-first helpers take the token again instead of always reading the database. Rerunpermdock rls generate. authorizationHooks().shareKeyanswers for the active tenant of a token withmemberships_truncatedwhen the token holds an entry of another tenant, because the hook keeps the active tenant's entries first. DoctorPD138counts 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 permaxStaleMs.permdock supabase hook generateaddsauthz_versions_for(p_user, p_tenant), whichpostgrestSourcescalls 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 frompg_stat_user_functionsandpg_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 therowtable it reads with the rule behind it.permdock supabase inspectwritesrls.permissionFilters:permdock_<root>_has_active(p_grant)andpermitted_<root>_permission_keys_active(p_keys), which call the two-argument helpers with the tenant the token names.authorizationProviderfills better-supabase'spermissionFiltersfrom that list. PassingpermissionFilters: trueis no longer accepted. The two-argument helpers stay out of the list, because better-supabase 0.87 checks the key argument only.permdocknow 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 rejectspermissionFiltersas an unknown provider key.postgrestSourcesturns 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.readOnlyActorskeeps 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[].tenantForlists the keys under which arowtable reads astenant.authorizationProvider({ tables: true, widened: true })lists such a table astenant, andauthorizationHooks({ widened: widenedKeys(manifest) })makesshareKeyanswernullfor a caller who holds none of them.rls.tableReadsgives everyrowtable areason: the policy and file behind eachowner,conditionandrestrictiveentry, whatpermdock supabase inspectcould not read for anunknownone, and for aformtable the policy, tenant column or migration that keepspermdock codemod bsb-access-tagsfrom moving it.codemod bsb-access-tags --checkprintswould move N of M tables.
0.33.0 (2026-11-25)
- With
rls.customRoleWrites.roles.skipset,permdock rls generatewritespermdock_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 toowner. Rerunpermdock rls generate. permdock supabase inspectlistsp_resourceonpermdock_request_approver_idswhen delegations are on, soauthorizationProviderrequires the function with its real signature and passes the request kind's resource to it, and it listspg_catalog.split_partamong 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 onpermdock_approver_for_ids()for tenant covers should call the two-argument form.permdock_request_approver_idsgainedp_resource, and the generated SQL drops the old signature first, so drop or recreate a policy or view that callspermdock_request_approver_ids(p_requester, p_tenant)in the same migration.permdock_request_approver_idsandpermdock_approver_for_idsfollow a cover'stenant,resourcesandpermissions, 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_idstakes an optionalp_resource, andauthorizationProviderpasses the request kind's resource to it; rerunpermdock rls generateandpermdock 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
permdock0.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. authorizationProviderfillsportalSubjectsonly withportalSubjects: true: in 0.31.0 a contact's<scope>.readlet them read every comment and internal note on their own record.portalParties: falseleaves outportalParties.authorizer(...).warm(),authorizationHooks(...).warm()andwarm(policy)frompermdock/nextbuild one anonymous instance and run onecan, so the first request skips them. They never reject and answer{ ok, ms }.permdock codemod 0.31is the codemod of this release, and0.32stays an alias of it. The config error fordoctor.waiversanddoctor.ignoresays "in 0.31", and the upgrade guide moves fromguides/upgrade-0-32toguides/upgrade-0-31, with the columns "0.30" and "0.31".permdock rls reportcountsrls.tableReadsper rule (form,follows,via,walk,owner,condition,restrictive,fields,unknown) and lists eachrowtable with its rules. For aformtable,permdock codemod bsb-access-tags --check,permdock rls explainandrls.tableReads[].reasonin the manifest name the grant that keeps the policy off an@bsb accesstag.permdock supabase inspectwritesrls.sharedFunctions(functions that pass better-supabase's BS430 and read onlytenanttables) andrls.tenantPureHelpers(the helpers that answer the same for callers with an equalgrantFingerprint);authorizationProvider({ tables: true, sharedFunctions: true })emits the functions, and doctor PD137 fails for a listed function that now reads arowtable.rls generaterefuses global grants to delegated tokens inpermdock_has. A token with an API key claim holds a global grant only whenrls.apiKeyscaps it by its scopes, and a token with a non-emptyclient_idor anactonly whenrls.tokenScopescaps it by itsscopeclaim. 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 bypermdock_haswith the admin's own global roles. The helper memo keys those tokens apart from the user's session, and the_forhelpers, which name their user, are unchanged.permdock_can_assigngates its global branches the same way. Regenerate after upgrading. A project that relies on OAuth clients, support sessions or API keys holding global grants setsrls.tokenScopesorrls.apiKeys. Two more cases change: session tokens from an identity provider that always carryclient_id(Cognito access tokens, for example) lose global grants withoutrls.tokenScopes, and on thegucdialectpermdock_hasnow reads<prefix>.api_keyand<prefix>.actas JSON, so a non-JSON value there raises.rls.tableReadsleaves out a table a later migration drops and followsalter table … rename to, andpermdock rls verify --shadowfindssupabase/schemasabove the package directory in a monorepo.scripts/centrakit-latency.tsmeasures the Server Action, the sharedbsb.keptentry,runtimeCacheVersionStoreand 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 asksdatabase-write.
0.31.0 (2026-11-24)
- An action's
meta.answerslists the better-supabase actions it decides (blocks.invoices.recordPayment), the catalog carries it asanswers, andauthorizationProvideremits it as better-supabase'sactionKeys. - BREAKING:
permdock doctorreads accepted findings fromdoctor.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-baselinerewrites the file, anddoctor.failOn: "warning"fails on warnings.doctor.waiversanddoctor.ignoreare removed, andpermdock codemod 0.32moves both into the baseline file. - BREAKING:
subjectFromEvefrompermdock/evetakes the principal from the turn's caller,session.auth.current, and falls back tosession.auth.initiatoronly when the turn has none.actorFromEvealways 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), andparseSnapshot,fromSnapshot,snapshotFromClaimsand React Native storage refusev: 1, so a client discards a cached v1 snapshot and fetches a new one. v2 writes eachrequiresholding once in arequirestable, memberships as[shape, id],typeLevelas bit sets over the bundle'skeys, 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,maxGrantsPerTenantleaves an oversized tenant to the server (truncated), andgetSnapshotfrompermdock/better-supabasenow lists every membership instead of one tenant's. - Breaking:
rls.membershipsandrls.suspensionare derived fromsupabase.hook.membershipsandsupabase.hook.suspensionwhen unset, so a project with junction sources gets claims-first helpers. DoctorPD121reports a written entry that disagrees with or restates its source, andpermdock codemod config --prunedeletes a restated one. - Doctor PD037, PD051, PD052 and PD090 and
permdock rls import --sqlreadcreate policystatements through libpg_query instead of regular expressions. PD052 and PD090 no longer take afor updatein a subquery as the policy command, PD037 keeps the key of a policy whose expression holds';',rls importreadson public.ordersas tableordersand rolepublicin lower case, and a dump libpg_query rejects now stopsrls importwith its line and column instead of falling back to text. - Doctor PD103, PD104 and PD108 read policies through libpg_query, so a
for updateinside a subquery no longer becomes the command of a policy without aforclause.permdock rls generateandpermdock supabase hook generateno 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 readslistActionsfrom better-supabase 0.84.0. - Doctor PD125 no longer reports a schema that only
create schema if not existsstatements create, such as thepermdockschema the RLS helpers, the auth hook and the SCIM output each create. - Doctor
PD094compares resolved values as better-supabase's BS427 does (sorted keys, collapsed whitespace, case of unquoted SQL names), also reportsblocks.impersonation.options.claimsHookand block permission keys the provider supplies, and warns whenblocks.permissions.disabledis 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
PD114also runs inrls.authorize: 'database'mode: with--db-url-stdinit reports, as information, the sample users whose token keeps a partial membership list.supabase.hook.membershipsClaimkeeps its defaulttrue; 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
algorithmsarray and PD008 also readsexport { x as dock }. - Doctor info PD126 reports an app that lists
oxc-parserorpgsql-parserand installs another version than the onepermdockpins, which leaves two copies in the project. - PD095, PD099 and PD101 and the
rls generateindex 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 readcreate or replace triggerand skip triggers inside function bodies. - The CLI reads TypeScript and SQL through parsers.
permdock codemodfindsdefineConfigfrompermdockthrough consts,satisfies, aliased imports andmodule.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 countsnativeRefreshin a comment, and the SQL statement splitter handles'a--b',"a;b",E'it\'s;x'and$a1$bodies. - The CLI reads
supabase/config.jsonandconfig.jsoncas well asconfig.toml, resolvesenv(NAME)values (PD045 names an unset one), anddoctor,generate,supabase hook generate,rlsandpowersync verifytake--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-agent1.2.7:OPENCODE=1now switches it to agent mode, asOPENCODE_CLIENTalready did. - The
permdock-dataskill and the Drizzle, Kysely, Prisma and RLS pages name better-supabase doctor BS642 beside the leakproof note: under RLS astatusfilter 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 ingrant_keys, everypermitted_<scope>_permission_keysandpermdock_bootstrap_permissions. - The server kernel and every adapter built on it take
waitUntil(from@vercel/functionsorcloudflare:workers), which keeps the function alive for each pendingsinkwrite and oneflush()per tick, aspermdock/nextalready does withafter(). - Under pg-delta,
permdock generateremoves the copies of PermDock's functions and policies thatsupabase db schema declarative generatewrites, 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
powersyncpublication,permdock powersync generatewritesalter publication powersync add table ...to<schemaDir>/permdock/powersync_publication.sqlinstead of a comment insync-config.yaml, so the declarative sync adds the synced tables outsidepublic. - With
rls.readOnlyActorsand--helpers-only,rls generatewrites a read-only actor guard for every table whosesupabase/schemasfiles letauthenticatedwrite, intopermdock/read_only_actors.sqlunder pg-delta.rls verifycountsbetter_supabase.actor_may_write()as a guard. --format findingsprints{ findings: [{ code, severity, message, target, help }] }, the listbetter-supabase doctorreads 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, forrls verify --shadowand doctor PD125; both resolve from the installedbetter-supabasewhen the app does not list them.Intentadds'database-write', whichauthorizerfrompermdock/better-supabaseselects for a write whosecontext.enforcementisrls. It reads the authorization version from the cache;definerand unset writes stay live.SourceCalladdsintent,liveandreason, the development warning for a repeated version read names both reads, and doctorPD130warns when a project builds an instance with its own sources next topermdockFor.VersionStoretakes better-supabase's shape:getanswers{ version, at }andset(id, version, at)carries the database read time, somaxStaleMscounts from the read on every instance. Breaking for a custom store, which must storeat.runtimeCacheVersionStoreandpostgresCacheVersionStoreare new.authorizationHookssetsshareKey, andgrantFingerprintfrompermdock/better-supabasereturns thegf1:digest of a caller's grants for a list of permissions, so callers with equal grants share oneshare: "tenant"cache entry.authorizationProvideradds anoperationsentry<resource>:<action>for each permission whose allows require an approval, withapproval.stepsfrom the approval'sby,stagesandquorum, so better-supabase's approvals block applies the same floor.authorizationProviderfillsportalPartiesandportalSubjectsfrom a child scope whose memberships namevia,teamIdsOffrom the one child scope withoutvia,versionsfrom the hook'sauthz_version_for, andwildcards: 'none'when no catalog key holds a*.authorizationProviderfrompermdock/better-supabaseno longer setsfunctions.approverFor. better-supabase reads it as the users who may decide a request, andpermdock_approver_for_ids()answers the users the caller decides for. Tested against better-supabase 0.84.0.authorizationProvidersetsdoctor.commandtopermdock doctor --format findings, sobetter-supabase doctorreports PermDock's findings as BS705, and takesdoctor: { timeoutMs }for better-supabase'sdoctor.timeoutMs.authorizationProvidersetstenanton eachroleSourcesentry, scopes itswhereby the custom-role table'sscopecolumn, and asksplatformRoles.canAssignat the'global'scope, soblocks.memberships.options.roleThroughandblocks.invitations.options.platformRolesbecome restated.rls.customRoleWrites.roles.globalScopenames thescopevalue of a platform role row forplatformRoles.through.where.authorizationProvidertakestables: true, which fills better-supabase'stablesfrom the manifest and catalog soshare: "tenant"entries can key on the grant.budgetsinpermdock.config.tssets byte budgets for the client bundle, the snapshot and themembershipsclaim;permdock generate --checkexits 1 and doctor errorPD132reports one the policy is over.permdock bundle sizereports the bundle per role and shared part, the generated bundle module records its bytes and gzip bytes under the header,PD112probes withomitStaticwhen thebundlekind is generated and namestypeLevel,scopesandrequires, and doctor warningPD133reportsclientBundle(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 runsvalidateCustomRoleand denies withnot-assignable-byany key or level outsideassignablePermissionsandassignableLevels, listed inbeyond.permdock codemod 0.26reads the parsed source: it removes inferredrls.actionsentries only under a config object'srls, rewrites SQL helper names only in string and template literals and.sqlfiles, and edits only thetableOfowner it read. It now rewrites.sqlfiles and lists a versioned migration as a follow-up instead of editing it.permdock codemod bsb-access-tagsmoves plainpermitted_<scope>_ids('<key>')tenant policies into a better-supabase@bsb accesstag when the key's rows are provably the same.rls verify --introspecttreats the policies those tags render as generated.permdock codemod bsb-action-keysmoves the keys abetter-supabase.config.tsblocksentry names underpermissionsinto theanswersof the matching permission, soauthorizationProvidersends them asactionKeys.permdock codemod config --prunealso removes arls.actionsverb set to'none'that compiles to no command, andrls.tablesandrls.scopeTypesentries equal to what the schema files resolve. The schema readers, the read-only actor guards andrls reportfindsupabase/in the nearest parent directory of the same checkout, so a config in a workspace package reads the repository's Supabase project;rls.readOnlyActorsthen guards the write policies of that project's tables too.permdock config --printreports theeffectiveconfig with each default filled in, doctorPD120warns about a key set to its default, andpermdock codemod config --pruneremoves such keys after proving every generated file stays byte-identical.permdock doctoradds PD116, a warning for a Server Action exported from a'use server'module that calls none ofprotectAction,requirePermission,getPermissionorassert.permdock doctoradds PD124: with a database URL, an info finding for each table whose policies call PermDock's helpers and that belongs to a publication other thansupabase_realtimeandpowersync, since logical replication copies rows past row level security.permdock doctoradds PD125:@supabase/pg-toporeads the declarative schema directory and reports a dependency cycle, an object two schema files create, or a tablerls.tablesnames that no schema file creates. It resolves pg-topo from the app, then from the installedbetter-supabase.permdock doctoradds PD127: a warning whenrlsis configured and the Supabase project config sets[db] drivertosqliteorsqlite-postgres(Supabase Lite), where the generated policies and helpers do not exist.permdock doctorno longer reports PD069 or PD106 on better-supabase module files (-- better-supabase module:with a@bsb-hashheader);better-supabase doctorowns them.permdock explain <action>decides every fixture for one permission withexplain: trueand prints the grant that decided, the denial reasons, the denies that matched and the grants passed over.permdock generatewithout a database no longer reads thepermdockfolders undersupabase/schemasand 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"todefinePermissions(..., { 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>writesx-authorizationandx-oauth-scopesfrom route comments into an existing OpenAPI document.x-authorization: "handler"now marks a handler-checked operation instead of naming a permission keyhandler.permdock openapi annotatetakes the JSDoc block directly above each handler, so a file header@permissionno longer lands on the first handler. It also readsexport const GETandexport { handler as GET }, mapsapp/route.tsto/and an optional catch-all[[...slug]]to{slug}.permdock rls report [--json]lists each table's policies by command and role, withpermissiveorrestrictive, the origin (library,provider,app), the helpers and keys each calls, sorted by helper calls per statement; with--db-url-stdinor--localit readspg_policiesand lists the indexed columns whose=is not leakproof. Doctor warning PD131 reports a table with more thandoctor.policies.max(default 4, as better-supabase's BS641) policies for one command andauthenticated.permdock rls verify --introspectandpermdock rls reporttreat Stripe Data Pipeline schemas (stripe_sdp…, owned by thestripe_sdprole) 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-deltaand reports each policy expression, function body or grant of a PermDock object that differs from the live database.permdock supabase inspectwritesrls.tableReadsintopermdock.manifest.json: per table, whether its select policies filter by tenant alone (share: 'tenant') or by row, with the rules that make itrow.authorizationProvider({ tables: true })reads it, and doctorPD128fails when the manifest marks a tabletenantthat its policies no longer allow.permdock/better-supabaseneedsbetter-supabase0.85.0 or later as a peer (>=0.85.0, was>=0.81.0): it importsShareKeyHook,AuthorizationTableShare,AuthorizationEnforcementandVersionStoreEntry, which 0.85.0 adds.permdock/eve'sEveApprovalContexttypessession.parent, so anactorordelegationoption can give a subagent's session its own actor id and narrower scopes.permdock/server,permdock/supabase/middlewareandpermdock/nextaddtenantFromPath, which resolves a tenant slug in the URL to a tenant id through the app'sresolve. 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.permdockrequires Node.js 26 or later (engines.nodeis>=26), and the CLI no longer passes--experimental-strip-typesto its watch worker.rls generate --seeds-out <dir>writes only therole_permissionsrows that changed since the newest seeds migration, stamped at the later of now and one second past the newest migration. DoctorPD135suggestsrls.seeds: 'view'for a pg-delta project.rls generatecompiles a verb with norls.actionsentry and no inferred command tononeinstead of failing; doctorPD122lists those verbs. A resource without anrls.tablesentry binds to its snake_case plural table when only that one exists in the schema files, a scope withoutrls.scopeTypestakes its table'sidtype, and doctorPD134lists a resource whose table neither name finds.rls verify --shadow,rls explainand doctorPD090,PD103,PD104andPD108treat the policies an@bsb accesstag renders as generated, reading them from better-supabase'saccessPoliciesinstead of thebsb_access_name prefix;rls explain --jsonlists them undertagged.rls.approvals.managerstakes a self-referencing table,{ table, id, reportsTo, user, tenant, active? }, and addspermdock_manages_row,permdock_managed_row_ids_in,permdock_managed_row_ids,permdock_accessible_row_idsandpermdock_request_approver_ids;authorizationProviderfillsapproverForfrom the last.permdock codemod manager-chainrewrites hand-written walks to them.rls.membershipsis 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.subjectFromCiOidctakesprovider: 'vercel', which verifies a Vercel OIDC token againsthttps://oidc.vercel.com(or a teamissuer) and returns aworkloadprincipal with the team id asowner, the project id asprojectandenvironment.supabase.hook.activeTenant: "request"declares that the app resolves the active tenant per request: doctor PD078 stays silent, andauthorizationProviderstatestokenHook.activeOrganizationFrom: "resolver", so better-supabase's BS409 needs noblocks.permissions.activeTenantentry.workflowSdkWaiterregisters its hook withgetConflict()before parking and takes apending(token)step, so a request decided before the hook registered no longer leaves the run parked.
0.30.0 (2026-11-21)
- BREAKING:
permdock/eveneeds eve 1.2.0 or later, theaiandchatpeers need 7.0.177 and 4.45.0, andpermdock/better-supabaseneeds better-supabase 0.81.0 or later.EveResponseContexttakesrequest.interactionIdandrequest.principalin place ofrequest.requestId, the decision is"approve" | "deny"with nocancel, and the session readsidandinitiator. A response on another instance now recomputes the approval token withrequest.principalas the caller.approvalForfrompermdock/evecombines with better-supabase'sstrictestApproval; see Eve with better-supabase.
0.29.0 (2026-11-19)
authorizationProvider({ ..., roleIn: true })fills better-supabase'sfunctions.roleInwithpermdock_role_in, so withblocks.memberships.options.roles.manyitsmembership_rolestrigger refuses another organization's custom role (SQLSTATE23514,MEMBERSHIP_ROLE_SCOPE). The option needs better-supabase 0.77.0, since older releases refuse the key, and is off by default;problemsreports it when the manifest lists nopermdock_role_in.permdock rls generatewritespermdock_role_in(p_role, p_tenant)withrls.customRolesindatabasemode: whether a role is declared or a custom role of the tenant (or one with no tenant), read from therls.customRoleWrites.rolestable or else the custom-role tables. Only trusted SQL may execute it, andpermdock supabase inspectlists it inrls.helpers. Regenerate the helpers and the manifest to pick it up.
0.28.1 (2026-11-19)
- PD054 understands
rls.staticGrants: 'ref'. Whenrole_permissionsis 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 callsrefreshSession()and refreshes PermDock throughauthzChangeRefresh. 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()frompermdock/supabasenow compares the custom-roletenant_iduncast, through a variable of the column's type, so the tenant index serves it. Regenerate theauthorize()SQL to pick it up.
0.28.0 (2026-11-16)
- Breaking:
permdock/better-supabaseneeds better-supabase 0.63.2 or later (>=0.63.2); upgrade better-supabase before this release.authorizerandpermdockForignore a bootstrap subject seeded for another tenant. permitted_<scope>_ids_by_permissionand its_forforms read the caller's memberships once per call instead of once per grant key, for policies without custom roles. Rerunpermdock generateto pick it up.usePermDockno 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_allowsandpermdock_interactive_allowsare 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 forpermdock_token_scope_allowsalso 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 apermitted_<resource>_rowsset policy drops from 1.9 ms to 1.2 ms for an 11-organization admin. Runpermdock generateto pick up the new helpers.
0.27.2 (2026-11-12)
grant_keysandpermitted_<resource>_matchare now PL/pgSQL. Acan_<resource>(row, permission)policy calls the match once per row, and Postgres never inlines asecurity definerSQL 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 acan_<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. Runpermdock generateto 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)evaluatespermdock_api_key_allows,permdock_token_scope_allowsandpermdock_interactive_allowsonce per call, where it used to call all three for every instance it returned.permitted_<scope>_permission_keysand 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_permissionsreads the platform keys from onepermitted_<root>_permission_keys(null)call instead of onepermdock_has_permissioncall per global key. On a member of 11 organizations with about 200 grant keys each,permdock_bootstrap_permissionsdrops 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 andpermitted_<resource>_matchreadpermdock_user_id(),permdock_has_permission(key)andpermitted_<scope>_ids_by_permission(key)from a one-rowpermdock_hoistedCTE when more than one arm names them, computed only for the permissions whose arms read them. Withrls.apiKeysorrls.tokenScopes, everypermdock_api_key_allowsandpermdock_token_scope_allowscall 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 genwrites only the kinds thatgen.kindsor--kindlists.typesandsqlare now kinds of their own, withtypes()andsql()plugins inpermdock/cli/plugins/app, andconstantswrites onlyconstants.ts(andfields.tswithgen.fields). Before,constantsalso wrotetypes.tsand theserver-onlysql.ts, so an app that listed onlyconstantsandreactgot two modules nobody imported.zod,valibotandfactoriesaddtypes, which they import. With nogen.kinds,genstill writesconstants,typesandsql. An app that importssql.tsortypes.tsand setsgen.kindsaddssqlortypesto it; apluginsconfig addssql()ortypes().
0.26.0 (2026-11-12)
-
A generate cache hit is reported as
Skipped (cache)on stderr.summary.skippedcounts those files. A config key PermDock does not read warns with the reason codeunknown_key. -
A token that holds a custom role stays claims-first:
MembershipSource.customRolesVersionandPrincipal.customRolesVersion(thecustom_roles_verclaim) are compared with the tenant's version, and only a token behind either version reads the subject.postgrestSourcesreadscustom_roles_version_for(wrapperpermdock_custom_roles_version_forwithsupabase.hook.api),SubjectCache.recordtakes the tenant versions andSubjectRecord.customRolesVersionscarries 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 theassignableentry of one tenant on demand, the entrysnapshotFor(…, { tenants: "all" })carries for it.snapshotFor'svoption now accepts only1, the one wire version, and throws aTypeErrorfor 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 afterallow(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) andpermdock claims size(themembershipsclaim, 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 newmemberships_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 returnmemberships: [].supabase.hook.apialso writes the<prefix>subject_forwrapper for the two-argument form, granted toservice_roleonly.permdock generate --only rlsandpermdock supabase hook generaterewrite 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, thecustom_roles_verclaim, AuthZEN resource search paging, andwhere(permission, { tenant })on the Drizzle and Kysely pages. -
Add
supabase.hook.refresh('reuse'default,'full') andsupabase.hook.oauth('full'default,'slim'). A token refresh whose incomingauthz_verequals the current version keeps itsroles,membershipsandteam_idsinstead of reading them again, for sources withoutexpiresAtor a scope suspension table;oauth: 'slim'returns emptyrolesandmembershipsfor a token with aclient_id. The generatedcustom_access_token_hookchanges for every hook whose sources qualify: runpermdock generate --only supabaseHookand apply the rewritten migration. No data migration is needed. -
AuthZEN
search/resourcehandsresources.<type>.listthe compiledaccesscondition, the pagelimitand the request'spage.tokenascursor, and skipslistwhen the action reaches no row. Alistthat answers{ rows, next }makes its own pages; the handler still decides every row, and the page answersnext_tokenfromnextwith nototal. 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.onpair the deciding columns omit. -
Breaking: PD079 is an error. It also fails when
better-supabase/sqldoes not exportmodulePermissionKeys, because the keys the blocks check cannot be listed.permdock/better-supabaseexportsdefineBlocksConfig<typeof policy>(), which rejects ablocks.<name>.permissionsvalue that is not a permission key of the policy at compile time. -
Breaking:
approve,reject,cancel,send,withdraw,confirm,fulfill,receive,reimburseandwriteOffcompile asupdate,removeasdeleteandduplicateasinsert.mark*,pause*andresume*compile asupdate. Anrls.actionsentry still wins, soremove: "none"stays. -
Breaking:
authorizationProvider({ personas: 'roles' })sendspersonas: 'roles'withfixtureRolesinstead 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 intorls.roles. The provider also fillsfunctions.subjectForTenant,bootstrapPermissionsandcanIn,permissions[].levelsandtokenHook.teamIdsTruncatedClaim. -
Breaking:
authorizationProviderfillsplatformRolesfromrls.rolesandfunctions.subjectfrompermdock_subject()unlessplatformRolesorsubjectisfalse.suspension.userKeyisrls.suspension.users.id.personas: "roles"builds one persona per catalog role. A role sourcewherelists that scope's roles and treats a non-nullcustomRoleTenantas a custom role.approverForandmanagedUserscallpermdock_approver_for_idsandpermdock_managed_user_idswhen the manifest lists them. Passpermissionsto type the provider's keys. -
Breaking:
claimsFirstwithonStale: 'reread'rereads a token that names a role the policy does not declare, and keeps the actor.subjectFromSupabasekeeps those global roles whencustomRolesis set, and aclient_idwith noscopeorauthorization_detailsstays actor-less.useAssignablePermissionsreturns{ permissions, status }; a local snapshot answersstatus: 'server-only'. -
Breaking:
member_team_ids_forandmember_team_ids_ofare written byrls generate, and the hook calls the reader instead of the teams table.team_idshas its own budget: on overflow the claim is omitted andteam_ids_truncatedis set. A change tosupabase.hook.teamsbumpsauthz_verfor the old and new holder. -
Breaking:
permdock codemodno longer runs the 0.5 or 0.8 rename tables. Those names stay on the Naming page as history.permdock codemod 0.26rewrites a stored catalog and the generate commands this release removed. -
Breaking:
permdock rls generateis removed. Setout,split,target,schemasandseedsonrls()and runpermdock generate --only rls. The old command fails with one suggestion.seeds: falsereplaces--no-seeds, andseeds: { out, backfill }replaces--seeds-outand--backfill-out.rls.seedsstill accepts'function'and'view'. -
Breaking:
permdock/better-supabaseneeds better-supabase 0.58.0 or later (>=0.58.0); upgrade better-supabase before this release.authorizationProviderreturns better-supabase'sAuthorizationProvider, and thePermDockAuthorizationProvidertype is removed: importAuthorizationProviderfrombetter-supabase/contractinstead.blockApprovalStorereads a request with the approvals block'sconsumedstatus as approved and consumed. -
Breaking:
permdock/mcptreats a token with no scopes and noauthorization_detailsas a session token. It passes the scope check intools/listand in calls, raises no scope challenge, and gets no actor and no delegation, where it was refused withinsufficient_scope. A token with scopes, none of them the policy's, is still governed byunscopedTokens. -
Breaking:
permdock_<resource>_chain()starts at the caller's own row, the row whoserls.tables.<resource>.usercolumn (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()andpermdock_managed_user_ids(p_tenant)returnsetof uuidon Supabase andsetof textelsewhere, and cast no column.rls.approvals.managers.tenantnames the column of the manager table that holds each edge's tenant. It is required when the policy has a tenant scope, otherwisegeneratefails withconfig_invalid.permdock_managed_user_ids,permdock_manages_forandpermdock_manageskeep 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 ispermdock_managed_user_ids({tenant}). -
Breaking:
permitted_<resource>_idsandpermdock_link_<resource>_<link>return the resource id type fromrls.idTypes. Callers compare that type directly. A closure comparison castsancestoranddescendantto the id type. The closure table itself staystext. -
Breaking:
problemFromDecisionno longer takes a subject. The detail never named it. Pass the options object as the third argument. -
Breaking:
rls.jsonSchema: 'auto'is refused. Settrueorfalse. The attrs privilege check and the custom-role backfill are functions, notdoblocks. -
Breaking:
supabase hook generate,powersync generate,scim generate,openapi emitandgenare removed. Runpermdock generate, with--only supabaseHook,--only powersync,--only scimor--only openapifor one plugin.genoutput is part ofpermdock generatewhengenis 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 callspermitted_<scope>_ids_by_permission, so the resource's row conditions apply. -
Breaking: a Supabase manifest whose row helper omits
idTypeis refused. Runpermdock generate. PermDock no longer reads a missingidTypeasuuid.platformRolesandpersonasare fields of the better-supabase 0.53 provider. -
Breaking: a
teamorteamsscope'smember_<scope>_ids_foris(p_user uuid, p_active text default null), the signature of thesupabase.hook.teamsreader, and its one-argument form is dropped;global_roles_forissecurity definer, so the invoker hook no longer grantssupabase_auth_adminselecton the membership, roles or referenced user tables.memberships_fordrops 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 explicitsupabase.hook.refresh: 'reuse'then fails), andsupabase.hook.teamstakesdisabledAt. -
Breaking: a level grant key is
<permission>@<level>, with the level condition only. It is no longer crossed with a#ncondition group, andorderedLevelsno 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_roleslists 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.requiresis matched at global scope for a global role and at the role's tenant otherwise. Deleting a role callspermdock_trusted_delete_custom_role_grantsand removesinclude_rolereferences, never a declared role. -
Breaking: a verb that does not infer and has no
rls.actionsentry isconfig_invalid. The error names the verbs that infer.rls.approvalswritespermdock_approver_for_ids()(the caller plus active delegators, one hop) and, withmanagers,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.membershipsdefaults to therls.membershipsscope tables. -
Breaking: the CLI
--jsonoutput follows better-supabase CLI contract 3 (cli-result-v2.json, replacingcli-result-v1.json): a failure prints one error document line on stderr withreason,message,data,userActionRequiredandretryable, and nothing on stdout, andnextsteps carryargv. Exit code 3 is gone (auth_required,input_requiredandconfirmation_requiredexit 2),consent_requiredwith--confirm <token>isconfirmation_requiredwith--yes --effects-digest <digest>, anddirty_worktree,write_failedandcatalog_invalidarefile_conflict(exit 1),failedandinvalid_input. -
Breaking: the catalog wire format is
catalog-v2.jsonwithversion: 2. A stored approval that still usesmode: any|all|sequentialor a booleandistinctfails closed.permdock codemod 0.26rewrites a stored catalog-v1 document. -
Breaking: the closure backfill
selectmoves into the seeds migration, and is skipped whenrls.seedsisview. An inherited row helper is defined once. A role enum is a plaincreate type. -
Breaking: the hook reader
membership_entries_forismemberships_for. It issecurity definerand execute stays withsupabase_auth_adminonly. Re-runpermdock supabase hook generate. -
Breaking: the row-valued and per-id helpers are
can_<resource>(p_row | p_id, p_permission).permitted_<resource>_rowis no longer generated. Both forms callpermitted_<resource>_match. -
Breaking: under pg-delta,
rls.realtimeandrls.storagepolicies are static SQL beside the schema directory, atsupabase/service/realtime/permdock.sqlandsupabase/service/storage/permdock.sql. The authz receive policy issupabase/service/realtime/authz.sql. A scoped declarative sync does not load them. Apply them where the service tables exist. They are no longerdoblocks 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'spermitted_<resource>_rows('key', array[id]), which Postgres runs again for every row. Abetter_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_permissionas a tenant lead, and stops suggestingpermitted_<resource>_rows(p, <tenant column>), which PD103 now reports. -
Doctor,
permdock supabase inspectandpermdock generateread the output paths from therls(),supabaseHook()andsupabase()plugins. The plugins fold theirout,splitand hookoutintorls.out,rls.splitandsupabase.hook.out, so PD039 and PD064 find the generated helpers, the manifest'shook.outnames the file the hook plugin writes, andrls()withseeds.outusesrls.splitfrom the config instead of failing with "--seeds-out needs --split".definePlugintakes an optionalconfigmember for this. -
Files under the pg-delta schema directory are declarative SQL, including
{part}paths andsupabase.hook.out.create tableandcreate unique indexdropif not exists, and a trigger iscreate or replace trigger. -
Generated
raise exception usingstatements listhintbeforemessage, 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. Runpermdock generate. -
Instances with many custom roles build and decide faster: custom roles and grants are indexed per instance,
mayUsereads one snapshot per instance,decideIdsbuilds one instance per tenant, anddefinePermDock().forClient(client)returns the same bound definition for the same client.where()returns oneinfor 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(thefollowspart 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_assignableand itspg_trigger_depthguard (customRoles.from.sync: "trigger"guards a signed-in write), and thescopeChallengedelete inapps/mcp/src/handler.ts(a session token raises no scope challenge).supabase/schemas/realtime/authz.sqlgoes too:generatewrites the receive policy only tosupabase/service/realtime/authz.sql. Thedeclarative-jobsfixture matches Lienlink's config, and a secondgeneratewrites nothing. -
PD072, PD064, PD090, PD115 and the plan checks expand a
{part}inrls.outto each split part before they read it, so a guard trigger in the helpers part ofrls({ out: "db/{part}.sql" })no longer reports PD072. PD111 accepts an optionallimitwith adefaultand amaximum, as its fix text says. -
PD094 reports
blocks.invitations.options.platformRolesonly when it equals theplatformRolesthe provider fills. It reported any config that namedpermdock_can_assign_any, so a deliberately narrower override, such ascanAssignfor theglobalscope with athrough.where, failed the doctor. -
PD094 reports
blocks.memberships.options.roleThroughandblocks.permissions.disabled.tenantor.useronly when the value equals what better-supabase would fill from the provider: a role source with the samethrough, or a suspension row underblocks.permissions.model: "provider". A value that overrides the provider no longer fails the doctor, and a top-levelroleThroughis no longer reported. -
PD095 also reports
if not existsoncreate table,create indexandcreate policy, and adrop triggerbefore acreate triggerin a PermDock schema file. -
Security: an action can set
meta.interactiveOnly: trueto keep it to the user's own session.decide,mayUseand 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_idoract, and their memo keeps those tokens apart from the user's session.permdock_can_assignrefusestransferOnlyroles to the same tokens.authorizationProviderlists the keys asdelegation.interactiveOnlyfor better-supabase. Mark ownership transfer, organization deletion and similar actions, then runpermdock collectandpermdock rls generate. -
The Supabase manifest schema accepts the
permdock_interactive_allowshelper thatrls generatewrites for interactive-only actions. Before,permdock supabase inspectwrote it andparseSupabaseManifestrefused the manifest, so better-supabasegenfailed in an app that marks an actioninteractiveOnly. -
The authorization version bumps once per statement. A direct membership table gets
permdock_authz_version_insert,_updateand_deletestatement triggers with transition tables in place of the row triggerpermdock_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 themembershipsclaim rows parse the token one time instead of three to four times.permdock generate --only rlsrewrites 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 joinedrole_permissionsitself.permdock generate --only rlsrewrites the helpers file, and the decisions are unchanged; no data migration is needed. Runpermdock generateand 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 generateprintsseeds: +N rows, -M rowsagainst the newest seeds migration when a new one is due.permdock generate --only rlsrewrites 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'ssubject_forrecord for one tenant ornull, andrls generateon Supabase writespermdock_bootstrap_permissions(p_tenant text default null), the caller's keys as better-supabase's compact bootstrap wire;authenticatedmay execute both.permdock supabase inspectaddsfixtureRolesto the manifest: the roles thedefineSeedsfixtures 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 countsuser_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. TheinstanceCachemaxAgeMsdefault 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 apermdock.manifest.jsonor catalog thatpermdock generatehas not written yet, was treated as absent, so the first run wrote the hook againstapp_metadata.active_<first scope>and the next againstapp_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.splithas nopoliciespart, no table policy is written. The CLI prints one line naming the skipped part. -
With
rls.memo,permitted_<resource>_rows(p_permission)and itsp_tenantform keep their ids in the same transaction-local memo aspermitted_<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 therole_permissionsview. They stay on the membership, suspension, custom-role and roles tables. -
authorizationProviderwritesfunctions.subjectaspermdock.permdock_subject, theschema.functionname better-supabase calls with(). It wrote the full call before, so better-supabase 0.58.3 and later generatedpermdock.permdock_subject()()inbootstrap_app, which failed on every call. -
custom_role_permissionsandcustom_role_includesget aunique … nulls not distinctindex named*_nnd_keyin place of thecoalesce(...)expression index (Postgres 15 or later; pg-delta drops the old*_keyindex, a migration project drops it once;on conflict (coalesce(...))in app SQL becomeson conflict do nothingor 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()frompermdock/better-supabaseaddsgetSnapshot(source, { tenant, include?, omitAssignable?, omitStatic? }), which builds one tenant's snapshot listing only that tenant's memberships: on the CentraKit-shaped admin withomitStaticit stays at 4,832 B for 1, 50 and 150 memberships, where the default snapshot grows to 7,322 B and 12,472 B.readSubjectRecordkeeps a record'stenant, so a bootstrap subject read for one tenant seeds the subject cache under that tenant and never replaces the all-tenants record. -
defineSeedsis imported frompermdock/seeds, a new entry, so no runtime bundle carries it. Its data is emitted by the RLS plugin: default roles become an idempotentrole_permissionsmigration, and fixtures becomesupabase/seeds/permdock.sql.permdock/testingaddsmemorySourcesandapplySeeds. Doctor PD097 fails when fixture data is in a migration or schema file, and prints the[db.seed]sql_pathsline to add. PermDock does not editconfig.toml. -
mayUseandmayUseManyread the instance's expanded snapshot without the wire compaction and the type-level table, so an MCPtools/listor tool call with 150 memberships of 20 roles over 300 tools takes 24 ms instead of 290 ms. Thepermdock/better-supabaseauthorizer()serialises a claims object once per request scope instead of once per check; the memo key is unchanged. -
permdock <name>runs aPermDockPlugin.commandsentry that has arunfunction when no built-in command has that name. Theconstantskind exportsplanNamesandPlanName. Zod and Valibot row schemas end insatisfiesagainst thetypes.tsrow type, and an optional row field is typedfield?: T | undefined; the generated validators import./types.ts, so generateconstantswith them. -
permdock codemod 0.26names eachrls.actionsentry it drops because it repeats the inferred command, asrls.actions approve: "update" → inferred, instead of onerls.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.26renamespermitted_<resource>_row(tocan_<resource>(, removes::textaround a helper call, deletesown_subject(), and moves{ tableOf }onto the owner'salsolist.It also drops
rls.actionsentries that repeat the inferred command (remove: "none"stays) and reportsroleThrough,blocks.permissions.disabledand acanAssignthat namespermdock_can_assign_anyinbetter-supabase.config.*as follow-ups, not deletions: the provider supplies them only for a matching role source, underblocks.permissions.model: "provider"and for its own tenant scope, so PD094 decides which values to delete. A removed generate command keeps each flagpermdock generatedoes not take, such as--out, and reports it as a follow-up. -
permdock doctorPD079 reports ablocks.<name>.permissionskey that better-supabase 0.58 renamed (view,viewAll,viewSensitive,edit,admin) as its own error, naming the new key andbetter-supabase codemod naming. Before, better-supabase'sformer_permission_keyrefusal showed as a missingmodulePermissionKeysexport. -
permdock doctoradds PD103 to PD111: a PermDock helper called per row in a policy, two permissive policies on one command, an unindexedfollows,viaorwalkcolumn, a::textcast on a key, an unsargable custom-role probe,permitted_*_rows(p)without a tenant,rls.customRolesinjwtmode (error), an access token over 4,096 characters (with--db-url-stdin) and an optionallimiton a list endpoint.--only performanceruns them.permdock rls verify --advisorsalso runssupabase db advisors --type performanceand mapsmultiple_permissive_policiesto PD104 andunindexed_foreign_keysto PD105. -
permdock doctorreports 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 snapshotruns it alone; the Next.js adapter page explains how to measure withpermdock snapshot size. No generated SQL changes. -
permdock doctorreports PD114 forrls.authorize: "jwt"with a token hook: the helpers read only the memberships the hook budget keeps. With--db-url-stdinit is an error for a sample user whose token is truncated. No generated SQL changes; userls.authorize: "database", which reads the tables for a truncated token. -
permdock generate --dry-runand--checkprint one row per changed file with its byte delta, and--jsonfiles carrybytesanddelta. The hook budget measure inpermdock.manifest.jsonnow countsuser_role, the active tenant claim and 20 bytes forcustom_roles_ver, which the SQL already counted.permdock supabasehelp namespermdock generate --only supabaseHook, andPermDockProviderno longer passesomitAssignableto the client provider. No generated SQL changes and no data migration;permdock generate --only rlsrewrites nothing. -
permdock generate --watchgenerates again when a policy, config or plugin input changes. Each cycle loads the policy in a new worker and prints one receipt.--jsonprints one JSON line per cycle. Ctrl-C exits 130. -
permdock generatewrites membership indexes as(user, scope) include (role) where disabled_at is null, and under pg-delta an existing schema directory always getsindexes.sql. Memoisedpermitted_<scope>_idshelpers carryrows 10for the planner, and the defaults seed migration sets a 5 slock_timeoutand 30 sstatement_timeout.permdock doctoradds PD098, a database URL on the transaction pooler (port 6543), and PD099, a hand-writtenupdatepolicy on a table with noselectpolicy. -
permdock generatewrites typed modules tosrc/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.fieldsreplacesgen.fieldMetaand writesfields.ts, andpermdock/testingaddssequence,resetFactories,idOf,factoryUuidandfactoryText. Every module starts with a header naming the plugin version, the policy and a model digest.permdock codemod 0.26rewrites imports of the old files andgen.fieldMeta.Old New permdock.generated.tsconstants.ts,types.ts,sql.tspermdock.zod.ts,permdock.valibot.ts,permdock.arktype.tszod.ts,valibot.ts,arktype.tspermdock.schemas.ts,permdock.schemas.jsonstandard-schema.ts,json-schema.jsonpermdock.factories.ts,permdock.react.ts,permdock.svelte-stores.tsfactories.ts,react.ts,svelte.tsscopes,rolesscopeNames,roleNamestopics.<name>,paths.<name><name>Topic,<name>PathsqlNames.*one export per helper in sql.ts,<resource>Tablefactories.<resource>,factories.subject<resource>Factory,subjectFactoryAppVocabulary,AppScope,AppRolesOptionsVocabulary,ScopeName,RolesOptionsgen.fieldMeta,<resource>Fieldsinside each validator filegen.fields,fields.tsgen.outdefaultsrc/generatedsrc/permdock -
permdock openapi annotate --doc <file>writes the operations map from an OpenAPI document:operationswithoperationId,operationGroupsby first tag or path segment, and with--tenant-path <param>operationTenants. Each key is checked against--permissions; unknown, duplicate or missing keys exit1and write nothing. -
permdock openapi annotate --routesreads@permission,@permissionCheckand@oauthScopesfrom route handlers and writes the operations map.operationPermissionsFromOpenApireadsx-authorizationandx-oauth-scopes; emission still writesx-permdock-*andsecurity.permdock generate --only openapiemits the map when the plugin setsroutes. -
permdock powersync generatewidens the junction ofblockMembershipSource({ roles: "many" })to every member of the caller's organisations, whatever the table is called, and no longer widens a plain junction namedmembership_roles. The caller's and the listed member's membership both keep the source'sdisabledAtcolumn. PD102 warns whensync-config.yamlstill filters that junction with<table>.user_id = auth.user_id(). -
permdock rls verify --advisors --grant-calls --db-url-stdinalso lists the executions of the statements that name each permission key, read frompg_stat_statements, and addsgrantCallsto the JSON. It only reads.permdock generate --only rlsrewrites nothing and no data migration is needed. -
permdock supabase inspectbuilds the manifest of anrls.authorize: 'database'project withoutsupabase.hookfrom itsrls.membershipstables when it sets norls.membershipSources. It failed with "supabase.hook.memberships needs at least one … source", and doctor PD094 skipped such a project. -
permdock supabase inspectlistspermdock_approver_for_idsandpermdock_managed_user_idsinpermdock.manifest.json, soauthorizationProviderfillsapproverForandmanagedUsersfrom a generated manifest. Arls.approvals.managerstable without atenantcolumn leavesmanagedUsersunset, 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, andpermdock.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'ssubjectcarries the tenant, sotoWherefor Drizzle, Kysely and Prisma compilesmemberOffor it. A tenant the subject does not hold reaches no row. -
permdock/better-supabaseexportsdefinePermDock. It owns the version, instance and subject caches, loadsclient()on first use, and adds.server,.fromClient,.authorizerand.next. It takes thepermdock/supabasesubjectandapioptions, andcreatePermDock(definition)frompermdock/supabase/middlewareaccepts it and reads the same caches. PD100 reports a source file that importsdefinePermDockfrompermdock/supabasewhile a better-supabase config exists.permdock/appstill has no.nextor.authorizer. -
permdock/eveaccepts Eve's approval response decisiondeny. Acanceldecision from an earlier Eve release still rejects the stored request.EvePrincipal.attributesis Eve's map of strings and string arrays. -
permdock/jwtcaps the JWKS cache at 600 seconds for a Supabase issuer, andjoseTokenVerifierreturns aJoseTokenVerifierwithpurgeKeys().supabase.hook.claimscannot namejti,nbf,acr,act,client_id,scopeorcustom_roles_ver. Doctor adds PD113, a warning for source that reads the legacy HS256 secret, and PD110 andpermdock claims sizemeasure a token with OAuth-sizeduser_metadata, a long email and aclient_id. No generated SQL changes:permdock generate --only rlsrewrites nothing and no data migration is needed. -
permdock/nexttaints its options and each instance when React exposesexperimental_taintObjectReference, andcreateNextConfig()setsexperimental.taint.getSnapshot({ context })and<PermDockProvider context>keep only the namedsubject.contextkeys.evaluator="lazy"on the Next provider renders the lazy-evaluator provider.getSnapshotwarns once in development under 30 seconds as well as under 300, and an uncachedPermDockProviderwarns once.permdock/reactaddsonlineRefresh()foruseRefreshOn. -
permdock/nextwrites one snapshot copy to the Flight stream for nestedPermDockProviders with equal options:PermDockProviderandgetSnapshotshare one memoised promise per request. In development one warning reports an equal snapshot passed as two separatesnapshotpromises. -
permdock/react/lazyand theevaluator: "lazy"provider ofpermdock/nextno longer load SHA-256 or expand the snapshot before the evaluator arrives: the first chunk ofPermDockProviderplususePermissionfalls from 15,301 B to 13,840 B gzipped. A check without a row still answers from the snapshot'stypeLevel, and the evaluator loads on the first check that needs it. -
permdock/supabaseexportsdefinePermDockandsubjectFromSupabaseClient, andpermdock/supabase/middleware'screatePermDockaccepts that definition withsubjectoptional.permdock/cli/plugins/supabaseaddssupabase(), which writes the RLS SQL, the hook SQL andpermdock.manifest.json; it conflicts withrls()andsupabaseHook(). -
permdock/testingaddsmemoryPostgrestSourcesandrolePersonas, which readdefineSeedsfixtures without a database.permdock rls verify --kind pgtap --personas roleswrites one pgTAP persona per role the fixtures hold. CASL and Casbin imports emitdefineSeedsdefaults with the policy. -
permitted_<resource>_match(p_row, p_permission)is the stable row predicate.permitted_<resource>_rows, its id-list form and bothpermitted_<resource>_rowforms call it. The jsonb term map inside the row helper is gone.permitted_<resource>_rowskeeps 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 throughpermitted_<resource>_match. A 5,500-rowfile_nodesfolder page that took 57 s now takes tens of milliseconds.permdock doctorPD103 reports a policy that calls apermitted_<resource>_rows('key')from an older release, whose body has no arm for the key. Regenerate withpermdock rls generate. -
permitted_<resource>_rowscarries an arm that reads only the row inline, so itspermitted_<scope>_idscalls 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, andpermitted_<scope>_idsreads its keys once per distinct set of entries. Withrls.seeds: 'view', the helpers read grant keys frompermdock_role_keys(scope, role). The token hook reads the roles, memberships, teams andauthz_verin one statement, and the budget countsroles,memberships,team_ids,attrsandauthz_ver: asupabase inspectmanifest marksrolesandauthz_veras budget claims, andbudget.measurelists them. Helper names and signatures do not change, so better-supabase 0.53 works as before. -
permitted_<scope>_users(p_permission, p_id)over anrls.membershipstable 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 ofp_permissiononce, instead of callingpermitted_<scope>_ids_by_permission_forandpermdock_has_permission_forper 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; runpermdock generateto rewrite the helper. -
postgrestSources(client, { tenantScoped: true })reads the memberships of the instance'stenantthroughsubject_for(p_user, p_tenant)instead of every tenant's, and without a tenant it reads none.SubjectRecord.tenantand a fourthtenantargument onSubjectCache.recordkeep one cache entry per user and tenant, andpostgrestFixturetakestenantSubjects.permdock generaterewrites no files and no data migration is needed. -
powersync.memberLevel.<resource>({ table, column }, typePowerSyncMemberLevel) narrows a generated PowerSync stream by the member's level: a membership column holdingown,team,allor null syncs the rows of the resource'sownorteamlevel, or the whole tenant, instead of every row of the tenant on each device. -
rls generate --splitwrites thefollowspart wheneverrls.tables.<resource>.followsis set, to<schemaDir>/permdock/follows.sqlunder pg-delta and to{part}otherwise, with or without thepoliciespart. Thepoliciespart no longer holds the child-table policies. PD101 warns when a schema file defines a permissive policy on afollowschild table. -
rls generatecompiles each stored custom role intopermdock.custom_role_compiledfrom statement triggers, and the policies,subject_forand the probe read one indexed row per held role instead of callingpermdock_custom_keys. A custom-role edit bumpspermdock.custom_role_versiononce per tenant, the hook writes the active tenant's version ascustom_roles_ver, andcustom_roles_version_for(p_tenant)reads it. Runselect 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 ofis not distinct from, so a save no longer scanscustom_role_permissions. -
rls generategrantssupabase_auth_adminexecute on everymember_<scope>_ids_forit writes, next to the function, and the manifest lists the role. better-supabase'smemberIdsFor, whichauthorizationProviderfills whenever the manifest lists the helper, now has the grant it declares withoutsupabase.hook.claimsorsupabase.hook.teams, and inrls.authorize: 'database'mode without a hook. A single migration file wraps the grant in adoblock that runs only where the role exists; a--splitschema file grants it outright. Runpermdock generate. -
rls generatewrites five set helpers (#302):permitted_<scope>_id_array(p_grant),permdock_<root scope>_has(p_grant, p_tenant), and for eachrls.rowHelpersresourcepermitted_<resource>_rows(p_permission, p_tenant),permitted_<resource>_ids_in(p_permission, p_ids)andpermitted_<resource>_count(p_permission, p_tenant, p_cap). The tenant and count forms need amemberOfrelation to the root scope. -
rls generatewrites 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 importreads both forms. The custom-role probe comparestenant_iduncast and the custom-role tables gaincustom_role_permissions_probe_idxandcustom_role_includes_probe_idx. The closure refresh casts its id array to the id type, not the id column. The helper memo key uses thesession_idclaim instead of an md5 of the whole token.subject_forstarts from the roles a user holds instead of unioning both custom-role tables. Re-runpermdock generateand apply the diff.rls.tables.<resource>.followsand apermitted_<resource>_rowsarm 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 keepcan_<resource>(parent, …). The upward manager walk and the delegation policies cast the parameter, not the column.rls generateindexes thefollowsforeign keys, thewalkparent and user columns, the manager table's user and manager columns with the tenant, andapproval_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 carrycost,rowsandparallel safe. -
rls.customRoleWrites.roleswrites its cascade trigger ascreate or replace trigger.member_team_ids_foris granted tosupabase_auth_adminonly whensupabase.hook.securityisinvoker, which is the default; adefinerhook 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 createpermitted_<scope>_permission_keys. -
rls.memodefaults to'none'indatabasemode on Supabase: the helpers write noset_configmemo and arelanguage sql stable parallel safe, and everysetofhelper carriesrows 10. Setrls.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 therole_permissionsrows out of the generated SQL and pins thesha-256:hash of apolicy-bundlev1 document.permdock policy bundlewrites the bundle (--kind sqlwrites the statement that loads it into<schema>.permdock_policy_bundle). A missing or mismatched bundle denies every static grant.permdock generate --only rlsrewrites thehelperspart 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>.followspolicies always match the foreign key against one set of parent rows read once per statement, neverexists (… can_<resource>(p, …))per child row: a permission held through root-scope roles readspermitted_<resource>_rows(p, t)over the caller's tenants, a global role addspermitted_<resource>_rows(p)only for a caller who holds one of its grant keys, and any other grantee readspermitted_<resource>_rows(p). Runpermdock generate --only rlsto rewrite thefollowspart; no data migration is needed. -
rls.tables.<resource>.followswrites select, insert, update and delete policies on each child table. They callcan_<resource>on the parent row.alsonames resources that share the table and get no policies of their own.walk: "recursive"writespermdock_<resource>_chain(), and withrls.approvals.delegationsthe chain also starts from an active cover. -
rls.treeValuesnow picks the self-parented resource when several resources map to the same table, so afileresource listed before a self-parentedfileNodeonpublic.file_nodesno longer fails with "must be a self-parented folder". Two self-parented resources on one table fail with an error that names both. -
rls.treeValueswritespermdock_tree_<resource>()for each named folder. The helper walks that table only, and only rows in the caller's tenants. -
snapshot({ omitStatic: true })andsnapshotFor(..., { omitStatic: true })replace the grants of declared roles withstaticreferences, a new optional field of the v1 snapshot:{ held: [role, membershipIndex | null][], digests: Record<role, "sha-256:…"> }.permdock generatewithgen.kinds: ["bundle"]writesbundle.ts, a"use client"module exportingclientBundle, and the providers ofpermdock/react,vue,svelteandsolid,createClientStoreand thepermdock/nextprovider take it asbundle. A client without a bundle, or with a stale digest, denies what the roles granted.meta.clientBundle: falsekeeps a role inline.permdock snapshot size --omit-staticreports 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.grantedPermissionsstill reads every tenant. A request with no active tenant is unchanged.PermDock-Cloud reads the snapshot: it must ignore
staticor resolve it against the bundle of the policy it holds. -
supabase.hook.membershipsClaim: falsekeeps the token hook'smembershipsclaim empty and setsmemberships_truncatedfor 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 needsrls.authorize: 'database';generateexits 2 injwtmode.
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 therole_permissionsview. - The
membership_roleswiden. The stream is not filtered touser_id = auth.user_id(). The caller's own membership must be active, and the id uses everythrough.onpair. - The dropped
permdock_authz_versionstream. The table stays. Generate does not stream it. - The deleted
scopeChallengefor a subject token. A token with no scope claim and noauthorization_detailsis the user.challengeForreturns noinsufficient_scopewhen the call decides on the subject. - The custom-role assignable trigger. The sync guard skips when the caller is signed out or
permdock.syncison.pg_trigger_depth()is not the guard. - The platform-role before-delete trigger. The provider supplies
platformRolesfromrls.roles, includingpermdock_can_assign_anywhen the manifest lists it. - The duplicated membership block and
::textcasts.permdock codemod 0.26removes::textaround a helper call and deletes a second copy of the membership block the generator now writes. permdock/testingmemoryPostgrestSourcesandrolePersonasanswer membership and persona reads fromdefineSeedsfixtures.permdock rls verify --kind pgtap --personas roleswrites one persona per role those fixtures hold.- CASL and Casbin imports emit
defineSeedsdefaults 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 generatewithrls.seeds: "view"no longer writes the memo generation triggers on therole_permissionsview. Postgres refusesaftertriggers 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 generatewrites each*_read_only_actorspolicy as(select permdock_actor_may_write())instead of inlining theactexpression; regenerate and apply the output.permdock doctorPD090 also readssupabase/schemasandrls.outand flags a hand-written policy that inlines the 0.24 guard. - The
permdock-wireskill passes the unawaited loader promise to thepermdock/nextPermDockProviderassnapshot, notsnapshotPromise, and says a layout fetches while pages, loaders and actions decide. Snapshotis now one compact form: each distinct grant condition is stored once inconditionsand a grant is{ permission, cond }(an admin snapshot of 1,790 grants drops from 467,592 to 58,412 bytes). Breaking: code that readssnapshot().grants[i].effector.wheredirectly must callexpandSnapshot; the{ v: 1 }option,SnapshotInput,CompactSnapshotand the flat publicSnapshotare removed, andparseSnapshotrejectsv: 2.schemas/snapshot-v1.jsondescribes the compact form. Reissue PermDock Cloud snapshot consumers that read the wire format before upgrading.authorizationHooksinstallsdelegationonly when you passdelegation: trueordelegation: { permissions }, andauthorizationHooks({ policy })returns{ apiVersion, name, sessionTags }. Breaking: an app that relied on the implicit delegation hook addsdelegation: true.definePermDocktakessources: (client) => { memberships?, customRoles?, subjects? }and addsapp.forClient(client), a definition bound to that client with its sources cached in aWeakMap.forClientthrows aTypeErrorthat namessourceswhen the option is missing.operationPermissionsFromOpenApireads OAuth scopes fromsecurityand the newx-permdock-enforcement: "kernel" | "handler", and exposeskernelandhandlermaps. Behaviour change: an operation with OAuth scopes and nox-permdock-permissionsbecomes a scope-only entry where it used to be skipped asno-permission, an operation'ssecurityscopes now reachoauthScopes, andsecurity: []is skipped with the new causepublic.permdock doctorPD091 gainsopenapi.enforcement: "kernel".permdock doctorPD089 also readscreate functionbodies and the= any(array(select permitted_*_rows(…)))form, and recommendspermitted_<resource>_row(id, permission). A measurement on 5,000 rows in 10 tenants shows the generated row helpers already readpermitted_<scope>_ids_by_permissiononce per statement, so the generated SQL is unchanged;tests/integration/bench/row-helpers-hot-path.test.tsrecords the numbers.permdock doctorPD092 reads only thesnapshots:section ofpnpm-lock.yaml, so a single copy ofpermdockno longer reports a second copy without peers from thepackages:section.
0.24.0 (2026-11-04)
- Breaking:
permdock/better-supabaserequires 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 withescalateAfterthrows. Upgrade better-supabase, runbetter-supabase codemod 0.53andupgrade, then update permdock. permdock/reactships the snapshot evaluator in its entry again, so a provider with a synchronoussnapshotanswers 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,useFilterand<Protected>with row data suspended while the evaluator chunk loaded, even withoutsuspend.permdock/nextrenders this provider. The on-demand evaluator moves to the new opt-in entrypermdock/react/lazy, with the same exports: its hooks suspend until the chunk arrives and need a Suspense boundary.saas client reactmeasures 21,184 B gzip;permdock/react/lazymeasures 14,690 B initial and 21,708 B in total. The lazy entry's hooks also no longer throw React's conditionaluse()error when hydration retries after the chunk lands.
0.23.0 (2026-11-04)
- On the
supabasedialect indatabasemode,permdock_has(p_grant)memoizes its answer per statement inpermdock.m.global.k<bucket>, keyed and invalidated likepermitted_<scope>_ids. A policy site and everypermdock_has_permissiongrant 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 becomesvolatileplpgsql;permdock_has_foris unchanged. Regenerate the helpers and add the changed function to a migration. authorizationProviderfills better-supabase'smemberships[].disabledAtandplatformRoles, takespersonasand the opt-insubject: trueandplatformRoles: true, and the hook manifest listspermdock_subject().permdock doctorreports a hand-writtenown_subject()as PD093.permdock.grantedPermissions()evaluates the snapshot grants directly instead of building a snapshot instance, so a server bundle that never callsfromSnapshotno longer ships it.permdock/serverdrops 1.3 KB gzipped andpermdock1.3 KB.permdock/reactloads its evaluator on demand: the initial download ofPermDockProvider+usePermissiondrops from 20,263 B to 14,637 B gzip. Breaking:usePermission(permission)withoutdatareturns{ allowed, status, outcome }and nodecision; use the newuseDecision(permission, data?)for aDecision.usePermission(permission, data),useDecision,useGateandusePermDocksuspend while the evaluator chunk loads.snapshot()adds an optionaltypeLevelfield ({ 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
rowsWithtemplate casts better-supabase'stext[]candidate ids to the row helpers' id type, so generated block functions such ascan_subjectno longer fail with42883 function permitted_<resource>_rows(unknown, text[]) does not existonuuidids.permdock supabase inspectrecords each row helper'sidType(fromrls.idTypes, elseuuidon Supabase andtexton Neon) innames.resources, and the provider requirespermitted_<resource>_rows(text, <idType>[]). A manifest written before this release has noidTypeand reads asuuid. When the row helpers take different id types, the template calls the one-argumentpermitted_<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. Runpermdock supabase inspect --outto record the id types.
0.22.0 (2026-11-04)
-
Add
accessOutcome(decision), which reduces a decision togranted,approval-required,anonymous,no-tenant,no-membershipordenied;permdock.memberships({ via, scope });permdock.grantedPermissions({ tenant, scope, id }), which lists the permissions a rowless check grants; andisGlobalPermission(policy, permission). -
Add
postgrestFixturetopermdock/testing/fixtures: a Supabase client double that answerssubject_for,authz_version_forandmembers_offromSubjectRecords. -
Add the
SubjectCacheextension interface,memorySubjectCacheandtestSubjectCache, and asubjectsoption onpostgrestSourcesandpermdockFor.postgrestSources().record()reads the cache beforesubject_forat the authorization version the instance resolved, and refuses to seed a record below a version already seen. -
Add the
permdock/appentry withdefinePermDock, which replacesdefineAppand addsgetPermDock,fromClaims,fromApiKey,sourcesandevictto the policy it returns.permdockFor,authorizer,authorizationHooks,supportPolicy,subscriberPolicyandpostgrestSourcesreadmemberships,instances,versionsandsubjectsfrom the definition. Breaking: changeimport { defineApp } from "permdock"toimport { definePermDock } from "permdock/app";permdock codemod 0.5lists each import.Old New defineApp(policy, options)frompermdockdefinePermDock(policy, options)frompermdock/app -
BREAKING:
jitiandoxc-parserare optional peers ofpermdockinstead of dependencies.permdock doctor,scan,collectandcodemodneedoxc-parser, and a policy module Node cannot import natively needsjiti; a missing one fails with an install line. Runpnpm add -D oxc-parser jitiin a project that uses the CLI. The client store key is nowSymbol.for("permdock.store"), andpermdock doctorwarns with PD092 whenpnpm-lock.yamlresolves onepermdockversion with two peer sets. -
Detect better-supabase through
betterSupabase.configinpermdock.config.tsor through abetter-supabasedependency in the nearestpackage.jsonor a workspace package, not only through abetter-supabase.config.*found upward from the config. The generated hook then broadcasts onbetter_supabase:authz, so a project whose better-supabase config sits in another package no longer getspermdock: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, andparallel safewhere they use noset_configmemo.rls.memo: 'better-supabase'keeps thepermdock.m.*memo inbetter_supabase.memo_getandmemo_set; the default'permdock'is unchanged. -
Keep the policy vocabulary in
permdock/better-supabase:PermDockResolver,AuthorizerOptions,AuthorizationHooksOptions,SupportPolicyOptions,SubscriberPolicyOptionsandAccessReviewApplierOptionstake aVthatauthorizer,authorizationHooks,supportPolicy,subscriberPolicyandaccessReviewApplierinfer frompolicy. ApermdockForof another vocabulary next topolicyis now a type error. -
Row helpers use the resource's id type:
permitted_<resource>_rows,_rows_forand the newpermitted_<resource>_row(p_id, permission)take and returnuuidon thesupabasedialect andtextonneon; setrls.idTypesper resource. This changes the generated signatures: regenerate, drop the oldtext[]overloads, and remove::textcasts around calls (doctorPD088). Root-scope keys start with a tenant prefilter, andPD089flagsid in (select permitted_*_rows(…))where one id is known. -
The relationships page documents manager chains: a self-parented
employeewith a{ principal }relation walkedthrough: 'parent'compiles to the closure subquery, so noRlsTableVia.recursiveoption is added. -
authorizationHookstakesclaimsas an optional option. Without it the hooks omitautomation,supportandtickets, and passingservice,supportorticketswithoutclaimsis a type error. -
memoryVersionCacheandinstanceCachedefault to 30,000 ms (maxStaleMsis optional; the 60 s ceiling stays), so a removed member keeps read access for up to 30 s by default.memoryVersionCache({ shared })takes aVersionStore,betterSupabaseVersionCache(cache)inpermdock/better-supabasewraps better-supabase'screateVersionCache, andauthorizerandpermdockForaccept either cache.permdock/testinggainstestVersionStore. -
operationPermissions(...)frompermdock/openapigainsentries(),operationPermissionsFromOpenApigainsonSkip(operation, cause), andtestOperationCoverageinpermdock/testingfails on a tenant-path operation with no entry.permdock doctorruns the same check as PD091 from the newopenapi.operations,openapi.tenantPathsandopenapi.baseconfig keys. -
permdock rls generate --helpers-onlywrites therls.readOnlyActorspolicies as plaincreate policystatements instead ofto_regclassguardeddoblocks, so apply the helpers after the migrations that create the tables. DoctorPD090flags a hand-written policy that repeats the generatedpermdock_actor_may_write()guard. -
permdock rls generatemaps a compound action whose first word is a default verb (updateStatus,list_archived) to that verb's SQL command, andrls explainlists each inferred action.rls.tables.<resource>: { tableOf: '<owner>' }stores a resource in its owner's table; the owner writes the policies.doctor.sharedTablesis removed: declare the shared resource withtableOf, whichPD075skips.Old New doctor.sharedTables: ['public.documents']rls.tables.<resource>: { tableOf: '<owner>' }on each resource that shares the table -
permdock supabase hook generatecreates the hook schema beforemembership_entries_forandglobal_roles_for, so the file applies to a database where the schema does not exist yet. -
permdock supabase hook generatewritesmembership_entries_for(p_user)andglobal_roles_for(p_user)in the hook schema. The hook andsubject_forcall them instead of repeating the membership union and the global-roles aggregate. Re-runhook generateand apply the migration; the token andsubject_foroutput are unchanged. -
permitted_<resource>_rowis faster in policies. A policy calls it once per row and Postgres cannot inline asecurity definerfunction, 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 becomelanguage plpgsql volatilewith the same signatures and grants, and share the memo. Answers are unchanged,insert ... returningstill sees the new row, and thejwtmode and thegucandneondialects keep thelanguage sqlform.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_generationtrigger and aTRUNCATEtrigger, 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. -
protectActionfrompermdock/nexttakesargs, a tuple of Standard Schemas for leading arguments, and the applied wrapper takes{ after, result }.tenantanddatareceive(input, args), and the handler context gainsargs. -
supabase.hookalso emits<helpers schema>.permdock_subject(), which returns the signed-in user'ssubject_forrecord toauthenticatedandnullotherwise.authorizerreads better-supabase'sruntime.seedand, when it names the token's user at the live version, seeds the subjects cache so the instance makes nosubject_forcall.permdockForresults carrysubject.
0.21.0 (2026-11-04)
- Add
omitAssignabletopermdock.snapshot,snapshotFor,getSnapshotand the Next.js provider. It leavesassignableout of the snapshot, which repeats every assignable role and permission per tenant and made atenants: "all"snapshot for a member of ten organisations about 270 KB larger. Checks are unchanged;assignableRolesandassignablePermissionsreturn nothing on a snapshot built this way.
0.20.1 (2026-11-03)
-
permdock rls generateemits cheaper helpers. A helper reads the memberships already in the token when the token'sauthz_vermatches 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, includingTRUNCATE, 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 orTRUNCATE) leave the storedauthz_verunchanged, so tokens minted before keep their memberships until they expire. The memo trusts the same session GUC store asrequest.jwt.claims: any role able to callset_configcan forge both.
0.20.0 (2026-11-02)
- Add the
sqlFunctionset 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-functionsstill use the twin.rls importreadscol in (select fn(...))andcol = any (select fn(...))back as the same form, and doctorPD086checks the set column and warns when row-field args would be dropped.
0.19.0 (2026-10-29)
-
Approvals gain
approval: { fallback: "confirm" }withapproverDirectoryonapprovalsHandlerandresolveApproval, which lets the principal approve while no other eligible approver exists. Withrls.approvals.managers, the two-argumentpermdock_is_approveracceptsmanagerapprovers.rls.approvals.tenantPoliciestakestable,function,columnsandpath, andtableApprovalPolicySourcetakesfunction. An adopted approvals table's token column carries the@bsb identifiertag. -
permdock doctorgives every finding atargetand anidof<code>:<target>, and accepts findings throughdoctor.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 indoctor.cacheHelpers. PD072 stays silent when the schema files, migrations orrls.outcreatepermdock_custom_role_name_guard. -
permdock powersync generatenow joins a composite roles junction (athroughwith more than oneonpair, such as better-supabaseroles: "many") on every pair and selects anidfor 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 anid.powersync verifychecks the junction stream for leaks. On the device,readRowsmatches the junction on every pair and keeps every role; the device manifest'sthroughgains an additiveon. Rerunpermdock powersync generate. -
permdock/mcp: a tool registered withpermission: nullis public, listed and called with no check; leavingpermissionout still throws. A tool'spermissionmay be a list, withanyOf: truefor any-of, androws(args)checks every row the call touches. The newunscopedTokens: "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.permissionFormay return a list ornull. -
permdockForfrompermdock/better-supabaseis generic over the policy vocabulary, so its instances keep their typed permissions. The CLI findsbetter-supabase.config.*from the directory ofpermdock.config.tsup to the workspace root, so a monorepo app picks up the root config and its broadcast topic defaults tobetter_supabase:authz. -
powerSyncSourcereturns aPowerSyncSnapshotSourcewithauthzVersion(), the user's syncedauthz_version.nativeRefresh({ powersync: { source } })reuses it for the foreground catch-up instead of its own query. -
protectinpermdock/orpc,permdock/trpcand the server kernel takes a permission list: every permission by default, one withanyOf: true. Therowsoption loads many rows in place ofdata; every row must be granted, a denial reports the first denied row,permdockDataholds the rows, and no rows answers 404.openapi.security,openapi.specand the oRPCpermissionOftake or return the list;permissionOfnow returnsPermission | readonly Permission[] | undefined.Wire change: the Problem Details
detailof 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 errormessageand the audit event. A client that parsed the subject out ofdetailreads it from its own session.problemFromDecisionignores itssubjectargument. -
rls.splitin the config takes the--splitparts, and the flag overrides it.permdock supabase inspect,supabase hook generateand doctor PD039 follow the splithookpart ofrls.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 takefetchSnapshot({ tenant }), which answersrefresh()without a URL.subjectMembershipSource(subject)builds aMembershipSourcefrom a subject's memberships.PermDockProviderwith asnapshotPromiserenders 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 assecurity definer, grantsexecutetosupabase_auth_adminonly and skips thesupabase_auth_adminread policies, so the hook reads tables with its owner's rights. The default stays"invoker".permdock doctor --db-url-stdinruns the new PD085, which calls the hook assupabase_auth_adminfor eachdoctor.claimssample and reports a Postgres error such aspermission denied for table. -
supabaseRealtimeRefresh(client, { userId, channel, foreground })takes an app-ownedchannel, which it binds without subscribing or removing, and aforegroundsubscription: in the background it leaves its own channel, and on return it rejoins and callsrefresh()once.
0.18.1 (2026-10-29)
authorizationProvider({ requestApprovers: true })writespg_catalog.split_partin itsisApprovertemplate, 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 generatewithrls.approvals.delegationsorrls.approvals.managerswrites a five-argumentpermdock_is_approver(p_approvers, p_tenant, p_requester, p_resource, p_request_approvers)that also checks the approvals block step'susers,managerandpermission, andauthorizationProvider({ requestApprovers: true })passes better-supabase's{approvers}to it for every kind. Set it only with a better-supabase release that fills{approvers}. Withmanagersanddelegations, a cover now passes amanager()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, andresolvenow calls the block'sapproveorrejectwithdecidedByinstead of throwing, soapprovalsHandlerworks over the block.blockApprovalPolicySource(approvals, { platform, permissions, effects })reads platform policies, turnsconditionsinto acheck(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 takesrequired: "all"over users.BlockApprovalTenantPolicy.organizationIdisstring | nulland a step'srequiredisnumber | "all", as in better-supabase 0.41.Rerun
permdock rls generateand migrate:permdock_cover_approvestakes the requester as a fourth argument, andpermdock_managescalls the newpermdock_manages_for. -
React Native and servers outside Next.js now load permissions once per authorization version.
nativeRefreshfrompermdock/react-nativerefreshes the session, PowerSync and the snapshot when the user'sauthz:<uid>channel fires, andpermdock powersync generatestreams the user'sauthz_verrow sopowerSyncSourcesetssnapshot.authzVersion.powersync generateandverifyreport streams that read token claims as PD084, and a claims-change fixture checks those streams' row sets.authorizerandauthorizationHookstakepermdockFor, andpermdockFor(...).sources(versions)lets oRPC, MCP andpermdock/nextshare its instances.createPermDock({ version })andgetPermDock({ version })inpermdock/nexttake a known authorization version for read-intent instances.instanceCache()caches a custom-role factory's answers per factory and principal.permdock doctorreports aclaimsFirstcreated per call as PD080.rls.approvals.managersmakesmanager()approvers match in SQL and inauthorizationHooks.
0.17.0 (2026-10-29)
-
Breaking:
permdock/better-supabasenow needsbetter-supabase0.39.0 or later; runbetter-supabase codemod 0.32for its auth renames (requireTenant,auth.tenant,bsb.claims(),bsb.evictSession()).authorizerreadscontext.intent, validatessource: "input"rows andchangepairs, and resumesPermDock-Approvaltokens with the newstoreoption;blockMembershipSourcetakestablesfromblockTables(config); the token hook namesmemberships_truncatedas its onetruncatedClaim. -
Breaking: permissions load once per authorization version.
getPermDock({ instances: instanceCache() })andpermdockForreuse an instance until the version moves, andVersionCache.seedandversion: { known }skip the version read. Runpermdock codemod 0.17for the membership and approval literals; approval tokens issued before the upgrade no longer resume, because the token's policy input is nowsource.Old New { 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 defaultApprovalMode(the stage combinator)ApprovalCombine;ApprovalModeis'confirm' | 'authorize'VersionCache.observeVersionCache.seed(id, version, at?)cacheLifeFor(snapshot)capped at the token's expiry{ stale: 300 };cacheLifeFor(snapshot, { capToToken: true })postgrestSourcesversion read falling back tosubject_forThrows; doctor PD083 reports a hook file without authz_version_forCLI flags and commands renamed in 0.5.0 ( flag_renamed,command_moved)unknown_flag,unknown_command;permdock codemod 0.5still rewrites them
0.16.0 (2026-10-27)
rls.rowHelpersnow writespermitted_<resource>_rows_for(p_user, p_permission, p_ids text[], p_claims jsonb default '{}')beside the existing_forform, outside theneondialect. It answers which of the candidate idsp_usermay act on with the permission, the same answerpermitted_<resource>_rows(p_permission, p_ids)gives whenp_useris the caller, so asecurity definerfunction 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_forhelpers,executeis revoked frompublic,anonandauthenticated. A call that passes claims as an untyped third argument now matches both forms; cast it ('{...}'::jsonb) or passp_claimsby 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 defaultsupabase.hook.activeFromand doctor PD078 now read the claim better-supabase writes:auth.organization.claim(orclaims.tenantin a flat config), thenrls.tenantClaim, thentenant_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
onErrorsink ofprotectServerinpermdock/mcpnow receivestenantnext topermissionandname(McpErrorContext), so aBetterSupabaseOnErrorfrompermdock/better-supabasecan be passed as is.tenantis what thetenantoption resolves for the call, ornull. - The
rls.customRoles.from.syncguard triggers now refuse a signed-in write of an entry PermDock cannot hold, aspermdock_replace_custom_role_grantsdoes:22023withoutside-ceiling,unknown-permission,unknown-levelorunknown-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-nativeexportspowerSyncSourceCache(db): itssource(options)answers the samepowerSyncSourcefor the same manifest and options, so a component that rebuilds its options on every render keeps one source and one set ofdb.watchsubscriptions.
0.14.0 (2026-10-26)
-
Breaking:
permdock/better-supabaserequires better-supabase 0.29.0 or later.ShareLinkRowtakes onlysubject: { type, id }, so a share-link row withsubjectTypeandsubjectIdnow denies, andauthorizationHookscaps an automation run withbsb_permission_caponly. Before upgrading, runbetter-supabase migrate schema-firstif yourbetter-supabase.config.tshastablesorrecords, thenbetter-supabase upgradeand 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
disabledAttoIS NULLfilters instead of excluding their streams. Honourrls.suspension.memberships.keepin declared grants, membership conditions and custom-role levels; keepexpiresAtgaps 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 readablebetter-supabase.config.*exports an object. Generation, inspection and PD078 share detection. Explicit sources still win; absent, invalid or unreadable configs keep the plain Supabaseapp_metadata.active_<first scope>default.This changes the default for detected better-supabase projects. To keep the old source, set
supabase.hook.activeFromexplicitly before regenerating SQL and the manifest. Regenerate and deploy both together; no wire-format fields change. -
Document every
authorizeroption inpermdock/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 andauthzVersionreader together. -
protectServerinpermdock/mcptakesonError(error, { permission, name }), which receives a check that threw: adataloader,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'srowsWithandrowsWithFortemplates from thepermitted_<resource>_rowshelpers thatrls.rowHelperswrites, so better-supabase record actions withrowscheck the rows a caller holds a permission on, as the generated policies decide them. It lists each helper inrequiresand, 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-onlywithrls.readOnlyActorsnow writes the restrictive{table}_{op}_read_only_actorspolicies for each tablerls.tablesnames, in the output or thehelperspart, each skipped when its table does not exist. This changes helpers-only output: regenerate, and drop any hand-written restrictive policy that only callspermdock_actor_may_write()on those tables. A resource without anrls.tablesentry still gets the warning.
0.11.0 (2026-10-25)
supabaseApprovalStoretakes abeforeOpenhook that runs on everycreate, before the request is stored, with the request. Over an adopted table withrls.approvals.open: 'attach', insert the app's own row holdingrequest.tokenthere instead of wrappingcreate; 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 thewrite-unguarded:<table>:<command>finding id thatrls verify --introspect --helpers-onlyreports for a hand-written write policy withoutpermdock_actor_may_write().
0.10.0 (2026-10-25)
- The Supabase manifest records where the token hook reads the active tenant (
hook.activeFrom), andauthorizationProvider({ activeTenant })reports inproblemswhen better-supabase'sblocks.permissions.activeTenantwrites it elsewhere.permdock doctorreports the same mismatch as PD078 and lists each permission key a configured better-supabase block checks that the catalog lacks as PD079. - The
betterSupabaseCatalogandbetterSupabaseManifestfixtures inpermdock/testing/fixturesname the audit keyaudit.read, as better-supabase's audit block does, instead ofaudit.view. - The better-supabase adapter page shows a calendar or feed URL on a share link with no expiry:
subjectFromShareLinkresolves the link on every poll, so revoking it empties the feed on the next request. - The docs and the
permdock-wireskill 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 testspermdock/better-supabaseagainst better-supabase 0.13.0 and 0.18.0. - With
rls.readOnlyActors, theapproval_delegationsinsert, update and delete policies thatrls.approvals.delegationsgenerates now callpermdock_actor_may_write(), so a read-only support or impersonation session can no longer write covers as the user. Runpermdock rls generateand migrate.rls verify --introspectalso accepts the restrictive<table>_<command>_read_only_actorspoliciesrls generatewrites, instead of reporting them aswrite-unguarded. PermDockProviderfrompermdock/nexttakessnapshot, a promise from the app's'use cache: private'loader aroundgetSnapshot, so a prefetch carries the snapshot. Withsnapshotthe provider builds none itself, andincludeortenantsnext to it is a type error; without it the provider behaves as before.authorizationHooksfrompermdock/better-supabasenow caps an automation run on better-supabase 0.15 and later:automation.runAswrites the automation's keys tobsb_permission_cap, the claim 0.15 and 0.16 read, as well asbs_permission_capfor 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 deprecatedbs_permission_capfallback.authorizerandtoolPolicyfrompermdock/better-supabasetakeonError(error, { permission, tenant }), aBetterSupabaseOnError, which receives every error a check throws; the check still denies.authorizerfrompermdock/better-supabasetakesmemberships,versionsandintent. It wrapsmembershipsinclaimsFirst(source, { onStale: 'reread', versions })with the version cache better-supabase passes at runtime, and checksread,listandviewactions and batches with intentread, every other check withwrite.blockMembershipSource({ roles: "many" })reads every role of a member from better-supabase 0.18'smembership_roles, and atableMembershipSourceorjunctionMembershipSourcerolethroughmay now join on several columns.authorizationProvidernames such a role set as the membership'srolesTableand fillstokenHook.activeOrganizationFromfrom the manifest'shook.activeFrom, so better-supabase's doctor BS411 and BS409 check them. The Supabase manifest'sthroughgains an optionalon.blockMembershipSource({ table?, roleThrough?, roles?, columns? })frompermdock/better-supabaseis aMembershipSourceover better-supabase's memberships block table, including a table the block runs over withassignmentGuard: "external".roleThroughreads the role key through a roles table androlesreads several roles per member from a junction.permdock powersync generatecompiles aninherit()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 verifynotes a row aninherit()stream syncs rather than failing on it.permdock supabase hook generatewritesmember_team_ids_of(p_user uuid) returns setof uuidfromsupabase.hook.teamswhen no team scope has membership sources, andauthorizationProviderfrompermdock/better-supabasefillsteamIdsOffrom it.permdock/better-supabasejoins better-supabase 0.15's version cache.subjectFromBetterSupabaseaccepts aSessionSnapshotfrombsb.getRequestSession()and maps itsiatandauthz_verclaims.authorizershares one instance per claims and tenant through the request-scopememo0.15 passes toevaluate. OnememoryVersionCachepassed to bothclaimsFirstandcreateNext({ versions })is evicted bybsb.invalidateSessionandsubscribeAuthzVersions.powersync.tablessyncs tables that are not resources, such as a notification inbox or a file table: the user's own rows by ausercolumn, and the rows that point at a resource row the user reads throughfollow: [{ resource, field, match? }].toolPolicyfrompermdock/better-supabasenames the first denial reason in a refused tool's text (PermDock denied quotes.update: no-grant.) instead ofPermDock denied quotes.update.workflow.start(id, { resource: { type, id } })binds a run to one record: the automation's permissions on that type go into anauthorization_detailsentry withidentifier, so they hold on that row only. The run ticket gains an optionalresourceclaim (stillrun-v1), returned onStartAutomationResult.runandsubject.context.run.hookCanandhandlerCanfrompermdock/better-supabasetake adataoption that loads the row a permission is decided on.
0.9.0 (2026-10-25)
-
memoryVersionCache({ maxStaleMs })shares authorization-version reads across instances throughclaimsFirst(source, { onStale: 'reread', versions }), so a page of ten Next.js private cache scopes makes at most oneauthz_version_forcall. A token minted withinmaxStaleMsmakes none.getPermDock(…, { intent })picks how fresh the version must be:permdock/nextrendering andGET,HEADandOPTIONSin the HTTP adapters useread, whileprotectAction, other methods and coregetPermDockusewrite, which always reads live. Sources now receive a per-instancememo, andsubjectFromSupabaseandpermdock/jwtmapiattoSubject.issuedAt. Breaking:postgrestSourceskeeps no answers between calls; outside an instance, each call now reads the database. To keep one read per version:- Create
postgrestSources(admin, { policy })once at module scope, not per request. - Pass
versions: memoryVersionCache({ maxStaleMs })toclaimsFirst(sources.memberships, { onStale: 'reread', versions }), with the cache created at module scope too. - In
permdock/next, which reads withintent: 'read'by default, callgetPermDock({ intent: 'write' })before a mutation outsideprotectAction, 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, }), }); - Create
-
rls.rowHelpersalso writespermitted_<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 insidepermitted_<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 generatealso compiles a one-linkinherit()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'sprincipal,subjectandcontext,ServerPermDock.protectOn,OperationDataandOpenAiRunStatestay methods, so aPolicy<User>or aServerPermDock<V>is still accepted where the default is. - Breaking:
rls.tenantType,rls.teamTypeand therls.memberships.tenantand.teamshorthands are removed, and so are thetenantandteamcolumn shorthands onrls.memberships.scopes.*andrls.memberships.resource.*tables. Userls.scopeTypes,rls.memberships.scopesand each table'scolumns, wheretenantandteamstill name the first and second scope.permdock codemod 0.8moves the old keys indefineConfigobjects andpermdock.config.*default exports. - Breaking:
useRolesinpermdock/react,permdock/react-native,permdock/vueandpermdock/solid, androlesandrolesForinpermdock/svelte, take{ scope, id }instead of{ team: id };useRoles({ team: id })becomesuseRoles({ scope: "team", id }).tenantstill names the first scope.permdock codemod 0.8reports each call to change. - Breaking, types only: a
Permissionkeeps its row type, whichRowOf<P>reads.can,decide,assert,explainanddecideEachtype checkdataagainst that row (a partial row or a{ current, next }pair), with an overload forunknownoranydata.permdock/nextgetPermissionandrequirePermission, the React, Vue and SolidusePermission, ReactuseGateandProtected, and Sveltepermissionfollow, so data that does not fit the row no longer compiles. - Breaking:
permdock/better-supabaserequires better-supabase 0.13.0 or later, and no peer range caps the major any more (joseis>=6,reactis>=19).permdock rls generatewritesmember_<scope>_ids_of(p_user)on Supabase for ateamorteamsscope with membership sources; it answers only for the caller, andauthorizationProviderfills better-supabase'steamIdsOfwith 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 generatenow addspermdock_sync_custom_role_guard_<table>before-row triggers that hold such a write to the checks ofpermdock_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,localSnapshotandpowerSyncSourceinpermdock/react-nativenow fillsnapshot.assignablefor the active tenant, soassignableRoles(),assignablePermissions()andassignableLevels()answer on the device as the server does. Regenerate the manifest withlocalSnapshotManifest(policy)(orpermdock powersync generate) to get its newassignablesection; an older manifest still yields no assignable permissions.permdock rls verify --introspectmatches eachsecurity definerhelper by its full signature, so an overloaded helper such aspermdock_permission_keys()andpermdock_permission_keys(text)no longer reports a random overload. Breaking forrls.verify.ignoreand--ignore: helper finding ids now carry the signature,helper-definer:permdock.permdock_has(text):helperinstead ofhelper-definer:permdock.permdock_has:helper.permdock/better-supabaseworks with better-supabase 0.14.subjectFromShareLinkreads the share-link row'ssubject: { type, id }that better-supabase 0.14 returns, as well assubjectTypeandsubjectIdfrom 0.13, andShareLinkRowaccepts both shapes.authorizationProviderleaves the newportalSubjectsandportalPartiestemplates unset, so its functions type check against 0.14. The peer range stays>=0.13.0with no upper bound.resource(…, { orderedLevels: true })marks levels declared from narrowest to widest: a holder of a level may hand out every earlier level inassignableLevels,assignableRoles, the snapshot and the SQL custom-role write functions. Decisions are unchanged, and the catalog marks such permissions withorderedLevels: true.permdock_custom_role_guardandpermdock_custom_role_beyondare now documented as stable for an app's ownsecurity definerwrite path.
0.7.0 (2026-10-21)
-
A custom-role grant with a
levelits resource does not declare still allows nothing. It now reportsschemawith anunknown-levelcause onon('auth'), andexplain()lists it intrace.skippedwithwhy: "unknown-level"and thelevel. -
A stale token no longer keeps a revoked platform role.
claimsFirst(source, { onStale: 'reread' })now also replacesprincipal.rolesthrough the new optionalMembershipSource.globalRolesFor, whichpostgrestSources().membershipsimplements, andpostgrestSources().refresh(subject)rereads the principal while keepingactor,delegation,sessionand 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 withno-membership. PermDock Cloud and other consumers that switch on the closed reason list handleno-tenant. -
Breaking default:
permdock/cloudandpermdock cloud pushno longer readVERCEL_ENVor fall back toproduction. The environment isenvironment(or--project), thenPERMDOCK_CLOUD_ENV, then the one the newGET /v1/environmentroute names for the key. Without a configured environment,cloud().issuerandcloud().jwksare unset untilcloud().endpoints()resolves,cloudEndpoints()throws, andresolveCloudEndpoints()asks the Cloud.cloud({ verifier })also accepts(endpoints) => TokenVerifier. SetPERMDOCK_CLOUD_ENVto 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.skipand the backfill skip tenant rows only, so a global or shared role markedis_systemis copied and cascaded (only a declared name excludes it) and stores noscope_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-supabasepeer 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_permissionsrows from the same contextpermdock rls generatebuilds, so a levelled resource no longer reports the rows generate writes as missing or stale. It also reads the rows of anrls.seeds: 'view'view. -
Doctor
PD074warns whensupabase.hookis set andsupabase/config.tomldoes not enable[auth.hook.custom_access_token]with the generated function'suri.permdock supabase inspectaddsmanagementApi(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/schemasis served at its$id,https://permdock.com/schemas/<name>.json, withAccess-Control-Allow-Origin: *. -
Every scope-key read in
can,where()and snapshots goes through therelations.selflookup, so a resource that declares onlyselfis checked on its own id at a nested scope too. -
Fix two
permdock rls generateholes in database mode: the membership source helpers (permitted_<scope>_ids,permdock_permission_keysand their_forforms) now read a custom role's stored level, sojob.read@ownno longer widens to every row; and a tenant row ofrls.customRoleWrites.rolesnamed like a declared role (owner) reads as no role, with apermdock_custom_role_name_guardtrigger that refuses it (declared-role,name-taken). New doctor checkPD072. -
New
claim(path)frompermdockreturns the condition refprincipal.claims.<path>typedSubjectRef, sowhere: { teamId: { in: claim("team_ids") } }compiles undernoUncheckedIndexedAccessandnoPropertyAccessFromIndexSignature.principal.claimsis now a declared ref field. -
New doctor check PD075 warns when
rls.tablesmaps two resources to one table, as withfileandfileNodeonfile_nodes, and links to the merge guide. List a table that is split on purpose, with each resource covering disjoint rows, in the newdoctor.sharedTablesoption. -
New entry
permdock/testing/coreexportspolicyMatrix(policy, config),testRlsParityandtestOrmParitywithout importing a test runner, sonode:test, Bun, Deno or Jest can run a policy matrix.policyMatrixreturns{ cells, missing }with thefailuresof each cell;describePolicynow asserts that report under Vitest, andpermdock/testingre-exports the core. -
The Supabase page documents the OIDC-only OAuth pattern: one policy delegation from
authenticated()toactor("oauth-client")with permission subtrees, and which stale-token path keeps the ceiling. -
The better-supabase adapter page documents how
act.read_only,act.toolsandteam_idsare read by each library, and that an agent token needs a policy delegation toactor("agent"). Thenext-better-supabaseexample addsquotes.readandquotes.updateagent tools and a stack test foragent-tool-not-delegatedand read-only write refusal. -
The connector-v1
siemkind takes an optionalconfig.headersmap for the collector credential (Splunk HECAuthorization, DatadogDD-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 earlierconnector-v1.jsonrejectsheaders. 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, authenticatedbefore granting eachsupabase.hook.claimsandsupabase.hook.beforefunction tosupabase_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.managegrant gating Stripe Checkout and Billing Portal sessions; thepermdock/testingSaaS preset already models it. -
The webhook receiver examples on the Cloud integrations and Standard Webhooks pages answer
403,503,204and400for theverifyWebhookfailure causes, ascloudApprovalWaiterdoes. -
RUN_TICKET_CLAIMSfrompermdock/serverlists thevnd.permdock.run+jwtclaim namesparseRunTicketkeeps, the properties ofrun-v1.json. -
cloud-api-v1.jsonand the Cloud adapter page list theevidence:readandapprovals:readOAuth scopes and thereadkey kind (PERMDOCK_CLOUD_TOKEN), and the project item carries optionalslugandupdatedAt. -
parseCatalognow rejects a roleonan undeclared scope, an operation, grant, delegation or OAuth scope that names an undeclared permission key, and duplicate keys, with every issue'spath.parseCatalog(json, { requireMeta: ['title', 'risk', 'effects'] })also requires those permissionmetafields. -
permdock cloud push, with or without--dry-run, checks the built catalog before it sends anything and prints every issue aspath: message. With--jsonthe error is acatalog_invalidProblem withissues; the exit code is 1. -
permdock collect --checkandpermdock catalog --checkno longer fail when onlyusages[].linechanged. They exit 0 with the noticecatalog usages moved (lines only), and--jsonreportspositionsMoved: true. -
permdock doctorfindings can beinfo, a hint that--fail-on warningnever fails on (::noticeon GitHub, a SARIFnote). The new PD076 hint listsrls.actionsentries that change nothing:'none'on a verb that already compiles to no policy, and entries for a verb no permission uses. -
permdock powersync generateno longer fails on a membership table whose role column is a{ column, map }. -
permdock powersync generatereadsrls.membershipSourcesfor a scoperls.membershipsdoes not map, and syncs tenant custom roles per level, withsqlFunctionconditions compiled through theirtwin. The stream for a deciding column's role is the union of every source that holds the role. Tables outsidepublicare 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 newrowssection.powersync verifynow fails on a granted row that no stream syncs unlessgeneratewarned for it. With a database, it also fails with PD058 when a synced table is missing from thepowersyncpublication.permdock doctorreports PD058 for each membership source with no stream form. -
permdock rls generate --fields mask(rls.fields: 'mask') writes the--fields viewsoutput plus<schema>.<table>_mask(p_row)per field view: asecurity invokerfunction that returns the row with each restricted column the caller may not read set tonull, so asecurity definerRPC can return what<table>_visiblewould.--fields viewsoutput is unchanged. -
permdock rls generate --no-seedsskips theseedspart under--split, and any command that writes a file writes a character device such as/dev/nullin place instead of failing withEPERM. -
permdock rls generatewarns whenrls.approvals.delegationsis set with--authorize jwt:permdock_is_approvercannot read a delegator's permissions from the caller's token, so a cover never satisfies aholder()approver in SQL. -
permdock rls generatewithrls.capabilitiesgrantsanonusage on a non-publichelper schema. Without it the<table>_select_anonpolicies could not callpermdock_capability_ids, and a share-link capability read no rows. -
permdock rls verifygives every finding a stable id,<code>:<table>:<key>, printed at the end of its line, in GitHub annotations and as the SARIFpermdockId/v1fingerprint.rls.verify.ignore: [{ id, reason }]and--ignore <id>accept a finding without failing the run, an entry that matches no finding warns, and--jsondata is{ findings, ignored, stale }. -
permdock rls verifywith thegucdialect now sets each fixtureclaimsentry asapp.<name>, aswithSubjectdoes, 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 explainshows 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 pgtapwritessupabase/tests/permdock_rls.test.sql(or--out) and seeds fixture memberships;rls migrateandrls importrequirepgsql-parser18.supabase.hook.teamsadds ateam_idsclaim, andparseCustomRoleEntrychecks one stored custom-role entry. -
permdock scim generatewrites the tenant-keyed Postgres tables for a SCIM directory (scim_users,scim_groups,scim_group_members), revoked from the data API's client roles, andpermdock/scimexportspostgresDirectoryStore(query, { schema }), theDirectoryStoreover them, so onescimHandlerbehind the Cloud relay serves every tenant.SqlQuerymoves to core and is exported frompermdock/scimas well aspermdock/supabase. -
permdock skillsfinds the project's installedpermdockwith ESM resolution, so a hoisted or workspace-linked install supplies the skills, andNODE_PATHno longer does. -
permdock supabase inspect --outwrites the manifest inrls.authorize: 'database'mode withoutsupabase.hook, leaving outhook,budget,claims,authzVersionandmemberships;parseSupabaseManifestreturnsSupabaseManifest, andauthorizationProviderleavestokenHookunset for it. -
permdock.canAll(checks)andpermdock.decideAll(checks)check several permissions on one instance, where a check is a permission or a[permission, row]pair;canAll([])isfalse.isRoleName(policy, value)narrows a role string to the policy's declared roles (RoleNameOf<typeof policy>).allowanddenyalso take a resource, a list of resources or the whole tree without a condition, sorole("owner", [allow(permissions)])grants every action. -
permdock.decideIds(permission, ids, { data })decides ids the server loads throughdata(ids), each row in the tenant its own scope field names, and returns aDecision[]in id order. An id with no row denies withvalidation; a snapshot instance denies withunsupported. -
permdock/ai-sdktakesstepUp: { at? }. With it,toolApprovalanswers aninsufficient-user-authenticationdenial, or a denial that an eligible role activation would lift, with{ type: 'user-approval', reason, stepUp }, and its re-check runs the tool only whendecidegrants it. Type change:ToolApprovalStatusgains thisuser-approvalmember, which carriesstepUpinstead oftoken, so narrow with'token' in statusbefore readingtoken. -
permdock/approvalsexportsapprovalEntityTag(request)andapprovalView(request), theETagapprovalsHandlerserves and the view it hashes (the request withouttoken).permdockexportscanonicalJson(RFC 8785) andsha256Digest, the two steps behind everysha-256:digest. -
permdock/approvalsexports theIdempotencyRecordandIdempotentCalltypes withidempotencyRecord,idempotencyRecordKeyandmatchesIdempotencyRecord, which build and compareIdempotency-Keyrecords exactly asapprovalsHandlerstores them. -
permdock/authzenexports the rules its handler applies, so a hosted PDP answers the same:parseAuthzenRequest(kind, body)andreadAuthzenRequest(kind, request)return the handler's 400 and 413 Problem Details in its order and wording;readAuthzenPageandauthzenPagepage search results;searchActions(policy, user, resource)decides every catalog permission of a resource type; andsearchSubjects(policy, lister, request)filters the candidates anAuthzenSubjectListeranswers. Thesubjectsoption is now typedAuthzenSubjectLister, andlistreceives{ type, action, resource, context? }; alist()that takes no argument still fits. -
permdock/better-supabaseexportsroleOrderFromCatalog(catalog, { scope?, owner? }), which orders the catalog's roles highest first byassignsfor better-supabase's SSOroleOrder. -
permdock/catalogexportscheckHostedGrant(policy, grant), which answers{ ok: true }or theHostedGrantDropReasonmergeHostedGrantswould report for one candidate hosted grant, without aPolicyDocument. -
permdock/catalogexportshostedGrantOptions(policy): perhostablepermission, 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/cloudaddscloudOAuth({ clientId, redirectUri }), an OAuth client of the PermDock Cloud platform issuer withauthorizeUrl,exchangeCode,refreshand a typedlistProjects. It throwsCloudAuthError, whosecodetellsinvalid-tokenfrominsufficient-scopeby the RFC 6750WWW-Authenticatechallenge.CLOUD_BASE_URLexportshttps://permdock.com/api.cloud()andcloudEndpoints()now defaulturlto it instead of throwing without one, so a missing key is the only setup error (cloud() requires a key).cloud-api-v1.jsondocuments theinvalid_tokenandinsufficient_scopechallenges on the projects read API, thecursorquery ofGET /v1/projectsandGET /openapi.json;testCloudApichecks all three, and theinsufficient_scopecheck runs whenplatform.projectsOnlynames a token withprojects:readonly. -
permdock/deliveryexportsparseConnector(input), which checks a PermDock Cloud connector body againstconnector-v1.jsonand answers a frozenConnectoror a list of issues, each with a JSON pointerpath.CONNECTOR_KINDSandCONNECTOR_SCHEMAare exported too. -
permdock/jwtaddsverifySubjectToken(token, { verifiers, audience, replay, maxLifetime }), which accepts anat+jwtfrom the first matching verifier, at most 300 seconds long by default and with ajtiused once (causeslifetime-exceededandreplayed), andverifyIdToken(token, { issuer, clientId, nonce, verifier }), the relying party's ID token check withnonce-mismatch. -
permdock/mcpaddsmcpResourceGuard, which verifies the bearer token for an MCP resource and answersMcpAuthInfoor a401/403response with an RFC 9728 challenge, andprotectedResourceMetadata, which serves the RFC 9728 document. -
permdock/package.jsonresolves through the exports map, so a tool can read the installed version withoutERR_PACKAGE_PATH_NOT_EXPORTED. -
permdock/ssfserves 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 anSsfStreamStore(memorySsfStreamStore(),testSsfStreamStoreinpermdock/testing), andfanOutSet(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.pollnow uses it and reports a failed poll request as apoll-failedevent instead of rejecting. -
permdock/testing/fixturesexportsbetterSupabaseCatalogandbetterSupabaseManifest, the parsed catalog and Supabase manifest of thenext-better-supabaseexample, for testing code that consumes PermDock's files. -
permdock/testing/fixturesfollows the next-better-supabase example:betterSupabaseCataloghas the link-onlyguestrole onquotes, andbetterSupabaseManifestlists the four-argumentpermdock_is_approverthat approval covers need. -
permdockdeclares three dependencies instead of eight:@standard-schema/spec,oxc-parserandjiti. The CLI's@clack/prompts,diff,smol-toml,package-manager-detectorandfastest-levenshteinare inlined into the CLI build, so an app that importspermdockno longer installs them. -
permdockexportsPermissionsOf<Spec>, the typedefinePermissionsreturns, so a package built withisolatedDeclarationscan annotate its exported tree. -
permdockexportscheckRoleChange(role, { change, holders, roles, actorRoles }), theassigns,for,exclusiveWith,min,maxandtransferOnlyrules of a role change from aCatalogRoleand holder counts alone.decideRoleChangenow runs the same function. -
permdockexportsnormalizeMembership,normalizeMembershipsandresolveScope, the membership normaliser and scope-alias lookup evaluation uses. Each takescatalog.scopesor a policy's scope list; absent means the implicittenantandteampair. -
principalFromMemberships(userId, rows, { scope?, tenant? })inpermdock/better-supabasebuilds aPrincipalfrom rows of themembershipsblock's table (its own block since better-supabase 0.15), one membership perorganization_id, and drops other users' rows and disabled rows. -
protectServerfrompermdock/mcpaccepts an MCP Appsui://view registered without apermission: the view takes the permission of the tool whose_meta.ui.resourceUrinames it, forresources/listandresources/read, and a view no tool links is hidden and refused.McpUiResourceConfigtypes it. -
rls generate --splitandsupabase hook generateunder pg-delta write nodrop triggerordrop policystatement in a declarative file: triggers arecreate or replace trigger, policies a plaincreate policy. -
rls generatekeepscreate constraint triggerin pg-delta declarative files, because pg-delta has nocreate or replace constraint trigger. -
rls verify --introspect --helpers-onlyaccepts a<permission>@<level>key the resource declares instead of reporting it as undeclared. A conditioned level such asjob.create@ownpassed topermitted_<scope>_idsis aninfoline namingpermitted_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, notnew. -
rls.customRoleWrites.roles.primaryKeymakespermdock rls generatewritepermdock_replace_custom_role_grants_by_id(role_id, permissions), its trusted variant andpermdock_trusted_role_permissions_by_id(role_ids): the role row supplies the tenant, scope and name, the existing caller and definition checks apply, andrls.customRoleWrites.auditnames the function that records each save.rls.trustedReadersroles now also getusageon the helper schema, without which their execute grants could not be used. -
rls.seeds: 'view'writes<schema>.role_permissionsas asecurity_invokerview over the compiled rows, so a declarative schema carries the rows and needs no seeds migration orseed()call. -
rls.tables.<resource>: falsemarks a resource with no table:permdock rls generatewrites no policies or SELECT coverage for it and still seeds its role grants, andrls verifyskips its fixtures. Without--db-url-stdin,rls generatealso warns for each bound table that nocreate tablein the project's migration or schema folders creates. -
rls.tablesentries accept{ table?, via: { table, column, key?, id?, type?, scope? } }:rls generatewrites thepermitted_<parent>_ids(p_grant)security definer helper and policies that filter the child's parent id through it, andrls explainlists the binding. -
rls.tokenScopes: truemakesrls generatewritepermdock_token_scope_allows(p_grant)and narrowpermdock_has, everypermitted_<scope>_idsand the helper-free allows for a delegated token (aclient_id, or anactthat is not a support or impersonation session) to the permissions itsscopeclaim reaches. The Supabase manifest lists the helper andrls.tokenScopes.authorizationProvider'sdelegation.scopesfrompermdock/better-supabasenow also maps a renamed permission's former scope to its current key, as the in-process check does. -
securityFor(permission, { security: false })frompermdock/openapireturns onlyx-permdock-permissions, for an API whosesecurityis declared elsewhere. -
snapshotClaims(snapshot)frompermdockanswers the claimssignSnapshotsigns (snapshot,sub,iat,exp), for a signer that takes a claim set. -
subject_fornow returns aclaimsobject withteam_idsand eachsupabase.hook.claimsentry, andpostgrestSources().subject()and.refresh()put them onprincipal.claims, so a stale-token reread keeps team-scoped levels. Re-runpermdock supabase hook generate. -
subject_for,members_ofand the hook's memberships no longer emitroles: [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-runpermdock supabase hook generate. -
supabase.hook.apinow writes thepermdock_subject_for,permdock_members_ofandpermdock_authz_version_forwrappers assecurity invokerfunctions, so the Data API schema holds nosecurity definerfunction.service_rolegetsusageon the hook schema andexecuteon the three readers there. Re-runpermdock supabase hook generateand apply the migration. -
testApprovalStoretakescapabilities: { expire }and then checks that a new ask replaces an expired request. The docs now say thatreopenopens a second client over the same backend, and that a store replaces only anexpiredor past-deadline record.
0.6.0 (2026-10-20)
- Add shared custom roles: a
CustomRolewithshared: trueand no tenant, returned byCustomRoleSource.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 })reportsname-taken). Generated RLS resolves them from rows with a nulltenant_idbelow the global scope, andpermdock_replace_custom_role_grantswrites them only for a caller holdingmeta.manageRolesthrough a global role. - The
better-supabasepeer range is>=0.9.0instead of>=0.9.0 <0.10.0, sopermdock/better-supabaseinstalls next to better-supabase 0.10 and later without a peer warning.
0.5.0 (2026-10-19)
-
A
denynow 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 byfromSnapshotwhile 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, andfromSnapshotnow also checks an update allow'swhereagainst the next row when the grant has nocheck, ascandoes. -
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 sessionTimeZoneno longer shifts it. -
A decision made under a support session carries
subject.supportSession: { id }, the id itsaccessevents carry assession.id, andpermdock/otelmaps it topermdock.support_session.id.decision-event-v1.jsonaccepts the new optional field. -
A deny whose wire validity window is malformed now stays in force in
fromSnapshotand in clientwhere(). 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 thefeedkind andon. An older parser that rejects a feed record fails closed. -
A membership whose
expiresAtis not Unix seconds no longer lives forever. An RFC 3339 string (how atimestamptzarrives as JSON), aDateor anInstantis now converted to seconds,nullstill never expires, and any other value,NaNandInfinityincluded, fails closed: a membership from a subject or aMembershipSourceis dropped, and one from a token'smembershipsclaim is treated as expired. -
A verb missing from
rls.actionscompiles to'none'without a warning, sorls.actionslists only the verbs that map to a SQL command; the generated SQL is unchanged. Newpermdock doctorcheck 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
dataloader decided with no data, so its approval token held key, subject and actor only, and approvingsend_email({ to: 'boss@corp' })also approvedsend_email({ to: 'attacker@evil' }). The agent kernel (AI SDK, OpenAI Agents, Claude Agent SDK, Eve, A2A) andpermdock/mcpnow pass the tool arguments as the newargsdecide 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.
approvalsHandlertakesdelegationsandsubjectFor. The signature records the delegate asbyand the delegator asonBehalfOfanddelegation. Those fields are optional on approval request v1. -
Breaking:
authorizationProviderfrompermdock/better-supabasenever setscanApprove;approverbecomes the'ai-tool'entry ofisApprover, which better-supabase 0.9 reads.holdersOfandactorMayWriteare set whenever the manifest lists their helpers. The provider addsfunctions.permitted,operationsanddelegation.scopes, and the newauthorizationHooksfills better-supabase'sAuthorizationHooks.subjectFromShareLinkrefuses a share link pinned to a version.Before (0.4) After authorizationProvider({ manifest, catalog, approver })fillscanApproveThe same call fills isApproverfor the'ai-tool'kind. Setrls.approvals, runpermdock rls generateandpermdock supabase inspect --out, so the manifest listspermdock_is_approver; without itisApproveris unset andproblemsnames the helperbetter-supabase 0.8 read canApprovefor AI tool approvalsbetter-supabase 0.9 calls isApproverfor every request kind; passapprovers: { "ai-tool": holder(p), … }to name approvers for other kinds -
Breaking:
subjectFrom*resolvers take the input first and returnSubject<<Source>Principal>. In-process defaults arememory<Interface>, conformance runnerstest<Interface>, adapted sources<origin><Interface>, options take their interface's name, and failure results carry acause. Runpermdock codemod 0.5for the renames below; the call-shape changes in the second table need a manual edit.Old New subjectFromSessionsubjectFromEveactorFromSessionactorFromEveCredentialPrincipalApiKeyPrincipalLinkPrincipalCapabilityPrincipalSsfSubjectMapperSsfSubjectResolvermemorySettingsmemorySettingsSourcememoryRelationsmemoryRelationSourceMemoryRelationsDataMemoryRelationSourceDatamemorySinkmemoryDecisionSinkMemorySinkMemoryDecisionSinkMemorySinkOptionsMemoryDecisionSinkOptionsmemoryApprovalPoliciesmemoryApprovalPolicySourcememoryApprovalDelegationsmemoryApprovalDelegationSourcememoryAccessReviewsmemoryAccessReviewStoreMemoryAccessReviewsMemoryAccessReviewStorememoryCredentialsmemoryCredentialStoreMemoryCredentialsMemoryCredentialStorememoryStoragememorySnapshotStorageRoleSourceCustomRoleSourceRoleSourceFactoryCustomRoleSourceFactorymemoryRoleSourcememoryCustomRoleSourcetestRoleSourcetestCustomRoleSourcebetterAuthRoleSourcebetterAuthCustomRoleSourceBetterAuthRoleSourceOptionsBetterAuthCustomRoleSourceOptionsPermDockStorageSnapshotStoragerlsParitytestRlsParityormParitytestOrmParityfromStripeEntitlementsstripeEntitlementSourcefromTabletableMembershipSourcefromJunctionjunctionMembershipSourcefromSupabasePostgressupabasePostgresQueryverifyWebBotAuthwebBotAuthVerifierscimHandleroptionstoredirectorystartAccessReviewoptionstorereviewsapprovalsHandlerandmatchDelegationoptiondelegationsapprovalDelegationsdecide,canandexplainoptionsourcecallLimitDetailfieldwindowpertestAuthZentestAuthzenTestAuthZenOptionsTestAuthzenOptionsAuthZenVectorsAuthzenVectorsAuthZenEvaluationVectorAuthzenEvaluationVectorAuthZenEvaluationsVectorAuthzenEvaluationsVectorAuthZenSearchVectorAuthzenSearchVectorpowersyncSourcepowerSyncSourcesummariseSubjectsummarizeSubjectWebhookFailureReasonWebhookFailureCauseApprovalResumeFailureApprovalResumeFailureCauseBefore After subjectFromApiKey(options)(key, { tenant })subjectFromApiKey(key, { ...options, tenant })subjectFromBetterAuth(auth, session, options)subjectFromBetterAuth(session, { auth, ...options })capabilitySubject(capability)frompermdocksubjectFromCapability(token, options)frompermdock/jwtcredentialSubject(credential, options)frompermdocksubjectFromApiKey(key, options)frompermdock/serverMappedSubjectfrompermdock/jwtSubject<JwtPrincipal>;subjectFromIntrospectionreturnsSubject<IntrospectionPrincipal>verifyWebBotAuth(request, options)webBotAuthVerifier(options)(request), orwebBotAuth: webBotAuthVerifier(options)verifyWebhookfailure{ ok: false, reason, cause? }{ ok: false, cause }, wherecauseis aWebhookFailureCauseinspectApprovalandconsumeApprovalfailure{ ok: false, detail }{ ok: false, cause } -
Breaking:
subjectFromApiKeyloads a user key's owner through aPrincipalSourcepassed asprincipals, asked with the key's tenant, instead of anowner(id)callback.Before After subjectFromApiKey({ owner })subjectFromApiKey({ principals }) -
Breaking: adapters use one name per meaning.
permdock/serverexportscreatePermDock; server adapters takedeniedResponse; agent adapters takedeniedTextandoperations; adapter type names start with the adapter. Runpermdock codemod 0.5for the renames below. The call-shape changes in the second table need a manual edit, exceptpermittedIdsandmayUse, which the codemod rewrites.Old New Entries createServerKernelcreatePermDockpermdock/serverServerKernelServerPermDockpermdock/serverServerKernelOptionsServerPermDockOptionspermdock/servercreateEvaluationsHandlerevaluationsHandlerpermdock/servercreateNativeStorenativeStorepermdock/react-nativepermdockgetPermDockpermdock/server,node,terminal,openai,claude-agent,evepermdockmiddlewarepermdock/hono,express,elysia,trpc,orpcloaddatapermdock/authzenloadDatadatapermdock/nestonDenieddeniedResponsepermdock/server,hono,express,fastify,elysia,nest,node,trpc,orpc,supabase/middlewareonDenieddeniedTextpermdock/ai-sdk,mcptoolsoperationspermdock/ai-sdk,openai,claude-agent,eveOnDeniedDeniedResponsepermdock/serverOnDeniedEventDeniedResponseEventpermdock/serverOnDeniedTextDeniedTextpermdock/ai-sdk,mcpPermDockRequestExpressPermDockRequestpermdock/expressPermDockRequestFastifyPermDockRequestpermdock/fastifyPermDockEnvHonoPermDockEnvpermdock/honoElysiaContextElysiaPermDockContextpermdock/elysiaElysiaCtxElysiaRequestContextpermdock/elysiaConvexPermDockCtxConvexPermDockContextpermdock/convexServerPermDockProviderPropsNextPermDockProviderPropspermdock/nextNativePermDockProviderPropsReactNativePermDockProviderPropspermdock/react-nativePermDockSvelteOptionsSveltePermDockOptionspermdock/svelteBefore After app.register(permdock)onpermdock/fastifyapp.register(middleware())app.register(permdockHandler, opts)onpermdock/fastifyapp.register(permdockHandler(), opts)permdockHandler(request)onpermdock/trpc,orpc,authzenpermdockHandler()(request)permittedIds(permdock, permission, scope)frompermdockpermdock.permittedIds(permission, scope)mayUse(permdock, permission)frompermdockpermdock.mayUse(permission) -
Breaking: core and
permdock/pdpbuild an instance withgetPermDock(async) orgetPermDockSync, socreate*means a module-scope factory,get*a per-request server read anduse*a client read.permdock/nextrenamesrequireAccesstorequirePermission, which takesgetPermission's arguments. Runpermdock codemod 0.5for the renames below; the call-shape change in the second table needs a manual edit.Old New Entry createPermDockgetPermDockSyncpermdockcreatePermDockgetPermDockpermdock/pdploadRelationsprefetchRelationsthe PermDockmethod, frompermdockandpermdock/pdpBefore After requireAccess({ permission, data, tenant, onDenied })requirePermission(permission, data, { tenant, onDenied })RequireAccessInputPermissionRequirementOptionsawait createPermDock(…)frompermdockbecomesawait 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 byid. Every format keepsv: 1because nothing outside the PermDock repositories reads these formats yet.CloudEvents types:
Before After dev.permdock.decisioncom.permdock.decisiondev.permdock.approvalwithdata.phasecom.permdock.approval.requested,.resolved,.expired,.cancelleddev.permdock.directorycom.permdock.directory.created,.replaced,.patched,.deleteddev.permdock.membershipcom.permdock.membership.added,.removed,.changeddev.permdock.credentialcom.permdock.credential.created,.used,.rotated,.revokeddev.permdock.catalogcom.permdock.catalog.published,.drifteddev.permdock.access.started,.ended,.revokedcom.permdock.support-session.started,.ended(revokedisendedwithdata.operation: 'revoked')none com.permdock.automation.*andcom.permdock.delivery.*, inRESERVED_CLOUD_EVENT_TYPES; parsers refuse themEvents and the envelope:
Before After toCloudEvent(event, { source? }), anysourcesourcerequired and an absolute URI;dataschema,traceparentandtracestateaddedDecision event source;DecideOptions.sourcecall;DecideOptions.callEvent expiresAtin Unix secondsRFC 3339 date-times Event delegation: { scopes, authorizationDetails }delegation: { scope, authorization_details }Event membershipin the internal shapeThe canonical membership { scope, id, roles, … }parseSinkEvent,parseSinkEvents,parseCloudEventBatch,cloudEventType,CLOUDEVENTS_CONTENT_TYPE,CLOUDEVENTS_BATCH_CONTENT_TYPE,EVENT_SCHEMA_IDS,SINK_EVENT_SCHEMASand the<FAMILY>_EVENT_SCHEMAconstants are new onpermdock, with the schemas published athttps://permdock.com/schemas/<family>-event-v1.json.Webhooks:
Before After A vnd.permdock.evidence+jwtJWS with aneventsclaim, posted asapplication/jwtwebhook-id,webhook-timestampandwebhook-signature(v1aEd25519,v1HMAC) over anapplication/cloudevents-batch+jsonbodyverifyWebhook(request, { jwks, audience, replay })verifyWebhook(request, { verifier })or{ jwks, secret, replay }verifyWebhookreasonsunsigned,invalid-token,invalid-events,replayedunsigned,invalid-signature(withcause),invalid-events,replayedwebhookSignerandwebhookVerifieronpermdock/serversign and verify any body.signDecisionBatchkeeps the JWS for offline evidence exports.Approvals HTTP API and the Cloud store:
Before After GET /:tokenGET /:idwith a strongETagandIf-None-Match; no response carriestokenPOST /:token/approve,POST /:token/rejectPOST /:id/approve,POST /:id/rejectwithIf-Match(412) andIdempotency-Key(422on reuse)signedin the approve responseGET /:id/signatureasapplication/jwt, linked withLink: rel="alternate"Lists with nextonlynextandLink: rel="next"Cloud GET /approvals/{token}GET /approvals/by-tokenwith thePermDock-Approvalheader;GET /approvals/{id}is newCloud POST /approvals/{token}/resolve,/consumePOST /approvals/by-token/resolve,/by-token/consumewith thePermDock-ApprovalheaderPermDock-Approval: <any string>One RFC 9651 sf-token; anything else reads as no token, and approvalHeadersthrows on itmemoryIdempotencyStore,IdempotencyStoreandApprovalVieware new onpermdock/approvals.testIdempotencyStoreinpermdock/testingis the store's conformance runner.Problem Details, AuthZEN, SCIM, SSF, OpenTelemetry, OCSF and Web Bot Auth:
Before After type…/unauthenticated,…/not-found,…/method-not-allowed,…/conflict,…/payload-too-large,…/internalabout:blankwith the HTTP status title;PROBLEM_EXAMPLESonpermdock/testingholds one body per remaining type…/step-up-requiredwithout atitletitle: "Step-up required"AuthZEN context.delegation: { scopes, authorizationDetails }{ scope, authorization_details }AuthZEN resource.idalways a row"*"names the collectionAuthZEN results without reasons; evaluations_semanticandX-Request-IDonpermdock/authzenonlycontext.reason_adminandcontext.reason_user;evaluations_semanticand theX-Request-IDecho onpermdockHandlertooSCIM extension urn:permdock:scim:schemas:extension:roles:1.0urn:ietf:params:scim:schemas:extension:permdock:2.0:GroupSCIM without versioning; scimTypeon any errormeta.versionandETag,If-Match(412),If-None-Match(304);scimTypeon400and409onlySSF handler failure 400with anerrbody500with an empty body; CAEP 1.0's eight events, RISCaccount-disabled,account-purged,credential-compromiseand streamverificationOTel permdock.*attributes only; lists comma-joineduser.id,user.roles,gen_ai.agent.id,gen_ai.request.model,error.type; lists as arraysOCSF 1.3.0; time: 0for a badat; statusOtherforapproval-requiredOCSF 1.9.0; the event projects to undefined; statusApproval RequiredaccessToOcsfAccount Change (3001),OcsfAccountChangeUser Management (3007), OcsfUserManagementWeb Bot Auth accepted any RFC 9421 signature tag="web-bot-auth", a covered@authority, and a coveredsignature-agentwhen the header is sent -
Breaking: every signed output is now a
vnd.permdock.<format>+jwtwith requirediss,aud,iat,expandjti, and the payload no longer repeats them.joseTokenSignerrequiresissuer, digests aresha-256:over RFC 8785 JSON, and every format keepsv: 1because nothing outside the PermDock repositories reads these formats yet.Before After 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+jwtandvnd.permdock.support-session+jwtare newjoseTokenSigner({ key, alg, kid })joseTokenSigner({ key, alg, kid, issuer, audience? });signtakesaudience,expiresAt,issuedAtandjtiSnapshot issuedAt,expiresAtin Unix secondsRFC 3339 date-times Snapshot and approval delegation.scopes: ["a", "b"]delegation.scope: "a b", plusauthorization_detailsPolicy document id,issuedAtinside thepolicyclaimjtiandiatCapability id,expiresAtinside thecapabilityclaimsubandexp; optionalcnf.jktbinds the link to a DPoP keyApproval JWS { token, permission, resource, status }jti(the requestid),act,token,resolved_by,approvalsand oneauthorization_detailsentryApproval token, catalog fingerprint,payloadDigest:pd1.<hex>or bare base64urlsha-256:<base64url>over RFC 8785 JSONSupabase membership claims expiresAt,grantedBy,managedBy; break-glassexpiresAtexpires_at,granted_by,managed_by;expires_atJSON 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,
Ctxis spelledContext, the JWT and Clerk resolver factories losecreatebecause they return a function, andpermdock/nodedrops thefromResponsealias ofsendResponse. Runpermdock codemod 0.5to apply them.Old New DefinePermissionsOptionsPermissionsOptionsSignCapabilityOptionsCapabilityOptionsSignRunTicketOptionsRunTicketOptionsStartAccessReviewOptionsAccessReviewOptionsStartAutomationOptionsAutomationOptionsVerifyWebhookOptionsWebhookOptionsUseRolesOptionsRolesOptionsConvexCtxLikeConvexContextLikecreateJwtSubjectResolverjwtSubjectResolvercreateClerkSubjectResolverclerkSubjectResolverfromResponsesendResponsefromResponsesend -
Breaking: the
better-supabasepeer range is>=0.9.0 <0.10.0, becauseauthorizationHooksand the provider'spermitted,operationsanddelegationfields exist only from 0.9. Upgrade better-supabase withpermdock. -
Breaking: the
permdock/cloudclient follows the settled Cloud contract (schemas/cloud-api-v1.json). For the PermDock-Cloud repository: the newPermDock-Subjectheader onGET /v1/environments/:env/snapshot, thepushed-policy-v1,connector-v1,run-v1andsupport-session-v1formats, and the approver token claims below.Before After cloud().snapshotscloud().snapshotsFor(token): aSnapshotSourcefor the subject anat+jwtproves, sent asPermDock-Subjectcloud().catalog.push(catalog)resolves to{ fingerprint }CloudCatalogPush:{ version, fingerprint, findings }, or{ version, fingerprint, unchanged: true }when the fingerprint is already publishedThe policy permdock cloud pushsends:{ fingerprint, scopes?, grants }PushedPolicywithv: 1, frompermdock/catalog, validated byschemas/pushed-policy-v1.jsonApprover token: suband apermdock_approvaldetail withid,status,etag?Also roles,membershipsandtenant; the detail addspermissions,relationsandvouched.cloud({ approver: { permissions?, relations? } })reads them, typically fromapproverPermissionsandapproverRelations -
Breaking: the
permdockCLI 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.5rewrites the old spellings inpackage.jsonscripts and CI workflows. Until 1.0, an old spelling exits2withflag_renamedorcommand_movedand names the new one.CLI before CLI after Commands permdock openapipermdock openapi emitpermdock skillspermdock skills installpermdock arazzopermdock arazzo check--db,--db-url--db-url-stdinorDATABASE_URLrls generate,rls import,rls verify,supabase hook generate,powersync verify--force--force-rlsrls generate--format,--emit--kindrls verify,catalog(jsoniscatalog,schemaisjson-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-outonlywrites by default; --dry-runpreviewsrls migrate--environment--project <id>cloud push--legacyremoved scan--json, and agent mode by default, now print onecli-result-v1envelope for every command: the report moves intodata, and a failure is inerroras Problem Details with a snake_casecode. Exit3means the run needs input, a login or the person's consent, andnextlists the commands that continue it.--help --jsonprints the command tree ascli-commands-v1.New:
--agent auto|yes|noandPERMDOCK_AGENT;--confirm <token>for commands that rewrite project files, publish to the Cloud or overwrite with--forcein agent mode;--format github|sariffor findings;--debug;--dry-runand--checkon every command that writes files;--db-url-stdin,--key-stdinand--token-stdin;permdock whoami; andpermdock completion bash|zsh|fish. The CLI no longer depends on citty. -
Breaking: the
permdockCLI now uses better-supabase's problem codes, exit codes and help document. An internal error exits1, a missing positional exits3withmissing_input, and every problemtypelinks to its row on the new CLI errors page.--help --jsonreturnscli-commands-v1in the shared shape (name,version,options,commandswithpath,effectsandarguments), 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-urlis gone: pipe the connection string to--db-url-stdin, or setDATABASE_URLorSUPABASE_DB_URL, the order better-supabase reads them.skills install --clientis--for.permdock codemod 0.5rewrites--clientand lists each--db-urlcall 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 aTemporal.Instant) for every runtimenow. A duration that is not a positive integer throws at definition time, and anowthat is not anInstantdenies withvalidation.Before After Credential createdAt,expiresAt: Unix secondsRFC 3339 apiKeyVerifiertouch(id, at):atin Unix secondsat: Instant;lastUsedAt(id)is RFC 3339approval.ttl,escalation.after:"30m"1800(seconds)memoryApprovalStore({ ttl }),requestApprovalttl: millisecondsseconds DEFAULT_APPROVAL_TTL_MS(3 600 000)DEFAULT_APPROVAL_TTL(3600)limit: { per: "1h" }limit: { per: 3600 }breakGlass/supportAccessmaxDuration,consent.durations,activate({ duration }):"4h"14_400(seconds)remotePdp/ Clerk resolvercache.ttl:"5s"or milliseconds5(seconds, at most 30)Connection revalidate: millisecondsseconds validFrom,validUntil: RFC 3339 or Unix secondsRFC 3339 or an InstantSnapshot and catalog grant validity,inactive-grantdetail: Unix secondsRFC 3339 ( WireValidity)LimitDetail:{ count, window, resetsAt: number }{ count, per, resetsAt: string }quota.resetsAt: Unix secondsRFC 3339 nowondecide,can,simulate,compileWhere, ORMtoWhere,rateLimitHeaders, limit stores: Unix secondsInstantnowon approval helpers, stores,approverRelations, access reviews:DateInstantTerminal runtime nowandWebBotAuthOptions.now:() => number() => InstantbuildLocalSnapshot(manifest, data, now),signSaasToken({ now }),verifySaasToken(token, now): Unix secondsInstantparseDurationRemoved -
Core
getPermDock(policy, user)always runs the policy'ssubjectmapper onuser. Before, a user object with anidand arolesormembershipsarray 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 resolvedSubject({ principal, context }, assubjectFrom*helpers return) is still taken as is.To migrate, pass an already-mapped principal as a
Subject:getPermDock(policy, { principal, context: {} })instead ofgetPermDock(policy, principal). Otherwise make thesubjectmapper accept the principal shape it now receives. -
Core and
permdock/pdpreplacecreatePermDockwithgetPermDock, which takes the same arguments and returnsPromise<PermDock>, andgetPermDockSync, which returns aPermDockand never a Promise. Passing a Promise-returning mapper or source togetPermDockSyncthrows and namesgetPermDock, instead of handing back a value that might be a Promise. Adapters keepcreatePermDock.Before After const permdock = await createPermDock(policy, user)frompermdockconst permdock = await getPermDock(policy, user)createPermDock(policy, user)with synchronous inputs, where a Promise hurtsgetPermDockSync(policy, user)createPermDockfrompermdock/pdp(always async)getPermDock(async) orgetPermDockSync(sync) frompermdock/pdpAdapter option pdp: createPermDockfrompermdock/pdppdp: getPermDockfrompermdock/pdppermdock.derive(options)returnedPermDock | Promise<PermDock>permdock.derive(options)always returnsPromise<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 newDecideOptions.model.permdock/otelsetsgen_ai.request.modelfrom it. Thepermdockentry now also exportsparseCloudEventandparseCatalogEventDatanext toparseSinkEventsand the event schemas, so a receiver validates events without its own schema. -
Every subject provider takes one
claimsoption, aClaimsMap, 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.Before After 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" } })ClerkGlobalRolesClaimPathsubjectFromBetterSupabasetakesclaimsfor roles, tenant and memberships and keeps itsplansoption, which decodes better-supabase's feature codes.scimHandlertakesclaims: { tenant }for a JWT that names its tenant elsewhere; the default is stilltenant, thentid. 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, whichon('auth')reports when that source throws ({ reason: 'source-threw', source: 'memberships', name }). EveryDirectoryStoremethod may now answer with a value or a Promise, like the other interfaces.webBotAuthVerifier(options)returns an object, like every other verifier:Before After webBotAuthVerifier(options)(request)webBotAuthVerifier(options).verify(request)a hand-written webBotAuth: async (request) => actorwebBotAuth: { verify: async (request) => actor }DirectoryStoremethods returnedPromise<T>T | Promise<T>; a caller that chains.thenawaits instead -
Feature requests are free functions that take the instance first, so
getPermDockno longer references their modules and an app that does not call them does not ship them. A plaindefinePolicy+getPermDockbundle drops from 54.3 KB to 46.7 KB gzip, andpermdock/reactfrom 21.8 KB to 19.4 KB (measured with esbuild, minified, tree-shaken).Before After 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 withunsupported(whoCanlists nothing), as the methods did; on aPdpPermDockthey use its local instance.simulateArazzoemits onesimulateevent per plan on a server instance.Hosted grants are an opt-in feature too:
policiestakeshostedPolicies(source)instead of a barePolicySource, so the merge code ships only with apps that import it.Before After createPermDock(policy, user, { policies: source })getPermDock(policy, user, { policies: hostedPolicies(source) })Approval policies follow the same pattern:
approvalPoliciestakesapprovalPolicies(source).memoryApprovalPolicySource([...])already is that feature, so it needs no wrapper.Before After { 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
inlist tofalseand an emptynotIntois not null, the same answers ascan(). Before, an empty list produced invalid SQL. -
Grant limits are an opt-in feature:
limitstakeslimits(store)instead of a bareLimitStore. The counting code ships only with apps that importlimits, so a plaindefinePolicy+getPermDockbundle drops from 40.1 KB to 39.6 KB gzip, andpermdock/serverfrom 42.1 KB to 41.7 KB.Before After createPermDock(policy, user, { limits: store })createPermDock(policy, user, { limits: limits(store) })defineApp(policy, { limits: memoryLimitStore() })defineApp(policy, { limits: limits(memoryLimitStore()) })A grant with a
limitand nolimitsstill denies withlimit-unavailable,devstill fills inlimits(memoryLimitStore()), andprodstill 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.
Type Where Known values ActorKindActor.kind, a policy delegation'sto.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.sourcescimdirectory-event-v1.jsonnow accepts any stringsource, 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-sdkentry, withchat4 as an optional peer.chatSdkAuthorturns a Chat SDKAuthorinto aChatAuthor, and isnullfor bots.chatSdkTransportis the chat channel ofpermdock/deliveryand posts direct messages.approvalCardrenders an approval prompt with a link to the approval page.approvalActionsapplies its approve and reject buttons as the clicking user throughChatPermDock.resolveAction. -
New
permdock/chatentry.subjectFromChatresolves a verifiedChatAuthorthroughprincipalByIdentity, and an unlinked author is anonymous.createPermDockreturnsChatPermDock:protect(operation, handler)decides each command as that principal and opens one approval request per command, andresolveActionapplies an approve or reject verdict by request id. The requester never approves their own request. -
New
permdock/deliveryentry. ItscreatePermDockreturns aDeliveryPermDockwhosedeliverchecks every recipient withdecideFor, routes it to the email, chat or webhook transport, and writes onecom.permdock.delivery.*event per recipient. It also addsaudience,subscribersFor,approvalPrompt(ApprovalPrompt v1, with no token),webhookTransport(Standard Webhooks, CloudEvents) andmemoryDeliveryTransport;permdock/testingaddstestDeliveryTransport. -
New
permdock/h3,permdock/sveltekit,permdock/astro,permdock/solid-startandpermdock/tanstack-startentries. EachcreatePermDockreturnsmiddleware(),protect(permission | operation, data),getPermDock,getSnapshot,connectionandpermdockHandler(); the h3, SvelteKit, Astro and SolidStart adapters addwithPermDock(handler). A refusal or a thrown PermDock error is RFC 9457 Problem Details. h3,@sveltejs/kit,astro,@solidjs/startand@tanstack/react-startare optional peers. -
New
permdock/resendentry, withresend6 as an optional peer.resendTransportis the email transport ofpermdock/delivery: it maps Resend errors to retryable or final failures and fans out throughbatch.send.approvalEmailrenders an approval prompt that only links to the approval page.resendWebhookturns delivered, bounced, complained, failed and suppressed events into delivery events. -
New
policyFromCatalog(catalog, pushed)onpermdock/catalogrebuilds an evaluable policy frompermissions.catalog.jsonand the pushed policy, for a service with no application code; what only code can answer denies.catalogDriftandhostedGrantFindingscompute the findings ofcom.permdock.catalog.drifted. The catalog now carries each resource'sparent, itslinksand the vocabulary roles. -
Option names match across adapters.
Before After permdock/workflowcreatePermDock(policy, { approvals: store })createPermDock(policy, { store })permdock/chatcreatePermDock(policy, { approvals: store })createPermDock(policy, { store })customRoleSource({ rolesOf: (tenant) => … })customRoleSource({ rolesFor: (tenant) => … })storeis the approval store option on every adapter, and the reader's method has the same name asCustomRoleSource.rolesFor. -
Presets.
permdock/presetresolves 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, adefineAppinpermdock.ts, auth, backend, framework and agent wiring, andpermdock.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 andshadcncommands;permdock preset decode|url <code>reads a code. -
Request bodies are read up to a byte cap and answered with
413past it, whateverContent-Lengthsays: 1 MiB for the AuthZEN endpoints,evaluationsHandler,scimHandler, the SSF receiver fromcreateReceiverandwebhookVerifier, 16 KiB for approval and access-review notes, 1,000,000 bytes forresendWebhook. 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-requiredwithout atokennow denies withpdp-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.decideSupportSessionrequires a reason and, by default, an approval by someone else, andsignSupportSessionandsubjectFromSupportSessionfrompermdock/servercarry the session with the staff member as asupportactor. A support actor can never approve a request, and the tenant settingsupportSessionsonly tightens. -
The CLI signs in to PermDock Cloud and reads what was published.
permdock loginruns the RFC 8628 device flow againsthttps://permdock.com/api(--loopbackfor the RFC 8252 browser redirect with PKCE,--writeto addcatalog:write,--urlfor another issuer) and stores the credential outside the repository throughpermdock/terminal;permdock logoutrevokes and deletes it.permdock cloud pull --project <id>writespermdock.manifest.jsonandpermissions.catalog.jsonassupabase inspect --outandcollectwrite them, checks the fingerprint, and restores the previous files on a mismatch.permdock rls generate --project <id>builds its policy from the project withpolicyFromCatalog.PERMDOCK_CLOUD_TOKEN, a read-only key pinned to one environment, authenticatespullandrls generate --projectin CI.permdock cloud pushalso sendsmanifest(--manifest) andpermdockVersion, and accepts a login withcatalog:writewhenPERMDOCK_CLOUD_KEYis unset.@napi-rs/keyringis an optional peer for the OS keychain.The docs MCP server moved from
https://permdock.com/mcptohttps://permdock.com/docs/mcp; thepermdockskill names the new URL.https://permdock.com/mcpis now the PermDock Cloud MCP server. -
The Resend and PermDock Cloud webhook receivers answer
400for missing or malformed signature headers and403for a signature that does not verify. They answered401without theWWW-Authenticateheader 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
POSTwith405 Method Not AllowedandAllow: POST, instead of400 invalid_request. -
The SSF receiver refuses a SET without
exponce itsiatis older thanmaxTokenAge(default 86400 seconds), and keeps each replay key until the SET would no longer verify. Before, with aclockToleranceabove zero, a captured SET withoutexpcould be delivered again after its replay key expired. -
The
@permdockshadcn registry athttps://permdock.com/r:gated-button,approval-request-dialog,tenant-switcher,role-picker,custom-role-editor,upgrade-prompt, andgated-button-nativeandupgrade-prompt-nativefor React Native Reusables. Each is markup overuseGateand the other hooks, installed as your own code withnpx shadcn add./r/preset-<code>.jsoninstalls a preset's files and recipes in one command. -
The
PermDock-Approvertokencloud().approvals.resolvesends is now bound to one verdict: it carries apermdock_approvalauthorization_detailsentry with the requestid, the verdictstatusand, when the Cloud sends one, the requestetag, plus a freshjti.resolvereads the request throughGET /approvals/by-tokenbefore it signs, and throws the Cloud's code (approval-not-foundby default) when that read fails. -
The
permdock-wireskill now starts a new app from a preset withpermdock init, adopts an existing app beside its own checks withshadowModeandpermdock scan, and points to the@permdockrecipes for gated UI. Its newreferences/presets-and-recipes.mdsets out what the package owns and what the app owns. -
The
subjectoption ofcreatePermDockinpermdock/next, the HTTP adapters and the agent adapters now types a fullSubjectas a valid return, as it already worked at runtime, sosubject: () => subjectFromClerk(await auth())compiles against an app whose policy has a typedUser. -
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 asApprovalRequest.x, andapproval-request-v1.jsonlists it.decide(permission, row, { x })puts it on the decision event. The other event builders (membershipEvent,credentialEvent,accessEvent,automationEvent,supportSessionEvent,deliveryEvent) takextoo and throw when it is not plain JSON. A decision drops an invalidxinstead of throwing.- SCIM Users and Groups carry it in the
urn:ietf:params:scim:schemas:extension:permdock:2.0:AppDataextension (DirectoryUser.x,DirectoryGroup.x,APP_DATA_EXTENSION).
The formats stay
v1:xis optional. The event schemas setadditionalProperties: false, so each now listsx. A consumer that validates events against a copy of an older schema must refresh that copy before events withxarrive. -
The approval store reaches an adapter only through the app or the adapter's own
storeoption. Adapters no longer import a memory store for thedevprofile, so every server, agent and UI adapter bundle is about 2.2 KB gzip smaller (permdock/server41.7 KB to 39.5 KB,permdock/ai-sdk38.6 KB to 36.4 KB,permdock/next45.9 KB to 43.5 KB).Under
profile: "dev",defineAppnow fills in one memoryApprovalStorethat 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.prodis unchanged. -
The catalog lists a policy's
oauthScopesasoauthScopes: [{ scope, permissions }], andauthorizationProviderfrompermdock/better-supabasemerges them intodelegation.scopes, so better-supabase's SQL checks accept a token whosescopeismcp:read. New doctor check PD070 warns when the catalog on disk lacks them; runpermdock collect. -
Tools to adopt PermDock in an existing app.
shadowMode({ legacy, enforce, onMismatch })is awrapthat asks the application's legacy check and PermDock on every check, returns the legacy answer unless the permission is inenforce, and reports each disagreement.testLegacyParity(policy, legacy, cases)inpermdock/testingpins the intended answers.permdock scanlists the role comparisons,hasRole/hasPermissionhelpers, CASL abilities, Clerkhas()calls and role claims left in the code.wrapPermDocknow keeps the instance's internals, so feature functions (whoCan,decideCredential) work on an instance wrapped by an adapter'swraporwithOtel. -
With
rls.readOnlyActors,rls generatenow writespermdock_actor_may_write(), which is false for a read-only support or impersonation token, so hand-written write policies in--helpers-onlymode can call it.rls verify --introspect --helpers-onlyreports each insert, update or delete thatauthenticatedreaches without calling it. The Supabase manifest lists the function inrls.helpers. -
With a
verifierconfigured, the client store refuses an unsigned snapshot fromrefreshand turnsstale. Before, a plain JSON body fromsnapshotUrlwas applied without verification, which let a network attacker downgrade a signed endpoint. -
<Protected>'s denied slot isdeniedin every UI kit, matching<PermissionBoundary>. In React, Vue and Solid,fallbackmeans a loading or error state, so it read as the wrong thing.Before After <Protected permission={…} fallback={<Locked />}>(React, React Native, Next.js, Solid)<Protected permission={…} denied={<Locked />}>Vue #fallbackslot, or{ fallback: () => … }#deniedslot, 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"approvalstill falls back todenied.pending,deniedResponse,deniedTextandonDeniedkeep their names. -
ApprovalPolicySourceentries can match an operation's risk and effects from itsmetaas well as a permission key.permdock rls generatewithrls.approvalsemitspermdock_is_approver(p_approvers jsonb, p_tenant text)for row-level policies on approval views. -
CatalogFindingCodeaddsoperation-risk-raisedandoperation-approval-removed, andCatalogFindinggainsoperation,previousandrisk.operationFindings(previous, next)inpermdock/catalogcomputes them,permdock difflists them underoperationswithout marking them breaking, andcatalog-event-v1.jsonaccepts them. -
accessReviewAppliercounts a permission the member still reaches behind an approval as held. Before, anapproval-requiredre-check marked the revoked item applied while the member could still use the permission after an approval. -
assignableRoles,oauthScopespermission lists andpermdock importoutput sort keys by code point instead oflocaleCompare, so the order no longer depends on the ICU locale; mixed-case keys now list upper case first. -
authorizationProviderfrompermdock/better-supabasereadsvarcharandcharacter varyingscope ids astext, the same aliases better-supabase accepts. -
authorizationProviderfrompermdock/better-supabasetakesapprovers, keyed by request kind, and fills better-supabase'sisApproverthroughpermdock_is_approver. NewaccessReviewApplierapplies an access review's revoked items through the organizations and invitations blocks, then marks each item applied. -
cloud({ approver: { signer, audience? } })signs aPermDock-Approverheader for eachapprovals.resolve: an RFC 9068at+jwtwithsubset to the approver's principal id,audset to<environment URL>/approvalsand a 60-second lifetime.resolvenow throwsapprover-unauthenticatedwithout a signer andapprover-not-eligiblefor a verdict with an actor; a system rejection needs no signer.TokenSigneracceptstyp: "at+jwt", whichcloudSignerrefuses. -
com.permdock.automation.published,.changed,.revokedand.runare no longer reserved:automationEventbuilds the newautomationsink event, published asautomation-event-v1.json, andWorkflowPermDock.startwrites arunevent tosink.supportSessionEventbuilds theaccessevent of a support session, which gains optionalsessionandpermissionsfields. -
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. CoregetPermDockand 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/eveandpermdock/openaino longer fall back to a memory approval store on their own: passstore, or usedefineAppwithprofile: "dev". -
defineOperationsbinds named actions to permissions with typeddata, aresultsfilter andmeta, andpermdock collectwrites them to the catalog asoperations(doctor PD067).PrincipalSourcewithmemoryPrincipalSourceandtestPrincipalSourceloads principals by id or identity link.permdock.decideEachdecides a list of rows in order, andpermdock.decideFordecides for another principal from the newprincipalsoption without widening the caller or consuming a limit. Akind: 'contact'principal keeps only itsonmemberships, reads by default and writes only through a role withfor: ['contact']; it never approves or creates keys.permdock/serveraddssignRunTicket,parseRunTicketandsubjectFromRunTicketforvnd.permdock.run+jwtrun tickets, which re-read the principal and the automation on every use.getPermDockand every adaptercreatePermDocktake asettingsoption (SettingsSource) thatpermdock.decideCredentialreads when a call passes none. -
definePolicytakes one mapper name,subject, as AuthZEN, JWT (sub) and thesubjectFrom*helpers do. Theprincipalalias is removed, andsubjectis required by the type.Before After definePolicy(permissions, { principal: (user) => … })definePolicy(permissions, { subject: (user) => … }) -
memoryApprovalStore({ now })takes a clock returning anInstant;create,cancel, andconsumeorexpirewithout anatread it instead of the system clock. -
permdock casl importandpermdock casbin importturn rules kept in another library into a generated module withpermissionsand apolicyof roles.casl import --rules <file> --out <file>reads each role'sability.rulesorpackRulesoutput. Inverted rules become denies,manageandallexpand,fieldscarry over, and the Mongo-query condition subset becomeswhere.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 anassignmentsexport.
Both report every rule they cannot translate. A deny is never dropped silently: a CASL deny keeps its effect without the condition, and
casbin importexits 1 when a deny line did not import.scan --legacypoints atcasl importwhen it finds CASL abilities. -
permdock catalog --out -prints the catalog instead of writing a file named-, andrls generate --out -keeps stdout to the SQL. Commands that only write a file refuse--out -withinvalid_value. A bare group or root under--jsonlists its subcommands aschoices["<command>"], the shape the shared result schema defines. -
permdock codemod 0.5renamesfallbacktodeniedon<Protected>, in a Vueh(Protected, props, slots)call and inPermDockProviderdefaults, and lists Vue#fallbackslots and Sveltefallbacksnippets as manual follow-ups. -
permdock codemod 0.5renames therolesOfkey of a reader passed straight tocustomRoleSourcetorolesFor. -
permdock codemod 0.5reportssubjectFromApiKeyonly in the old curried shape,subjectFromApiKey(options)(key), and leavessubjectFromApiKey(key, options)alone. It reports asourceoption key only on an object passed to a PermDock call, not on every object literal in a file that importspermdock. -
permdock codemod 0.5rewritesawait createPermDock(…)frompermdocktoawait getPermDock(…), any other corecreatePermDocktogetPermDockSync, andcreatePermDockfrompermdock/pdptogetPermDock. A corecreatePermDock(…)that is returned or chained with.thenis also listed as a manual follow-up. -
permdock codemod 0.5rewritespermdock.decideRoleChange(…),decideCredential,decideAutomation,decideSupportSession,whoCan,activateand the Arazzo form ofsimulateinto the free functions that take the instance first, and imports them frompermdock. -
permdock codemod 0.5rewritespermittedIds(permdock, …)andmayUse(permdock, …)to the instance methodspermdock.permittedIds(…)andpermdock.mayUse(…)and drops the import once nothing reads it. It no longer listsdecideCredential(permdock, request)as a call to change: it stays a function that takes the instance first. -
permdock codemod 0.5turns duration strings such asttl: "30m",escalation.after,limit.per,maxDuration,durationandconsent.durationsinto whole seconds inside a call to a PermDock import, and lists the same keys elsewhere as manual follow-ups. -
permdock codemod 0.5wraps anapprovalPoliciessource inapprovalPolicies(…)and apoliciessource inhostedPolicies(…)where the options object goes straight tocreatePermDock,getPermDockorgetPermDockSync, and lists otherapprovalPolicieskeys as manual follow-ups. -
permdock doctorPD014 no longer reports thejwksoption ofcloudApprovalWaiter,verifyWebhookandwebhookVerifier: it holds Standard Webhooks keys, not a token issuer's. -
permdock rls generateindatabasemode writespermitted_<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 aspermitted_<scope>_ids_by_permission_forapplies them. No client role may execute it; grantexecuteto the backend role that calls it. The Supabase manifest lists it inrls.helpers, andsupabase-manifest-v1.jsonaccepts the name, so a reader validating against the previous schema rejects a manifest that lists it. -
permdock rls generatewith--seeds-outand--backfill-outnaming 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 importreads thewhereof a membership subquery instead of dropping it. A subquery over a mapped membership table imports asmemberOfonly when it binds the user and the policy row, and its role literals becomeroles, soexists (select 1 from org_members m where … and m.role = 'owner')imports as owners, not as every member. A subquery with any other predicate staysopaque. -
permdock/a2aanswers a token that lacks a skill's scope with403andWWW-Authenticate: Bearer error="insufficient_scope", as RFC 6750 section 3.1 requires. It answered401, which tells a client its token is missing or invalid. -
permdock/agentaddscreatePermDock, which returns the agent contract the AI SDK, OpenAI Agents, Claude Agent SDK and Eve adapters now share:decideOperation,allowedOperations,decideModelandpermittedModelsover a newmodelsoption,filterResultsby an operation'sresultspermission, andgatewayOptionsfor AI Gateway attribution.testAgentRuntimefrompermdock/testingruns that contract against any implementation. -
permdock/authzenanswers400for a request withoutContent-Type: application/jsonand for a missing required entity or field, as AuthZEN 1.0 sections 10.1 and 10.1.1 require. Before, an evaluation withoutsubject,actionorresourceanswered200withdecision: false, and an action search without aresourcelisted actions across every resource type. A numericresource.idis now refused: the specification types it as a string. -
permdock/authzenexports its batch helpers,EVALUATIONS_SEMANTICS,evaluationsSemantic,evaluateBatchandmergeEvaluationItem, with theEvaluationsSemantic,AuthzenItemandAuthzenEntitytypes.permdockexportsOPERATION_RISKS, the risk levels lowest first, andisOperationRisk. -
permdock/better-supabaseaddshookCanandhandlerCanforbetter-supabase/workflow-sdk,supportPolicyforsupportSessions,subscriberPolicyfor per-subscriber fan-out andprincipalSourcefor principals and identity links.authorizationProviderfillsholdersOfwithpermitted_<scope>_usersandactorMayWritewithpermdock_actor_may_write()when the manifest lists those helpers. -
permdock/cloudaddscloudApprovalWaiter, anApprovalWaiterwhosewebhook(request)wakes parked runs on verifiedcom.permdock.approval.resolved,.expiredand.cancelledevents. It also addscloudDeliveryTransport(channel)for the Cloud's hosted sender,cloudSigner(), aTokenSignerover the environment key for run tickets and other app-issued tokens, andcloud().catalog.push(catalog);PermDockCloudEventnow includes the automation and delivery families. -
permdock/hono,express,fastify,elysiaandnestreturngetPermDock(request), andpermdock/trpcandorpcreturngetPermDock(opts): thePermDockfor one request outside the middleware, as onpermdock/serverandpermdock/node. -
permdock/openai,permdock/claude-agentandpermdock/evetakeunmapped,context,otel,wrapanddeniedTextaspermdock/ai-sdkdoes, andpermdock/ai-sdktakesotel;operationsaccepts the mapdefineOperationsreturns.permdock/mcptakesactoranddelegation, which replace the actor and delegation built from the verifiedauthInfo. -
permdock/scimexportsisDirectoryUniquenessErrorandisDirectoryNotFoundError. Both match bynameandcode, so a customDirectoryStorethat throws the error from another copy of the module still maps to409or404. -
permdock/ssftransmits as well as receives:signSetsigns a Security Event Token,pushSetdelivers it over RFC 8935 push, andsetPollHandlerserves RFC 8936 poll from aSetQueue(memorySetQueuein process).caepEventsandriscEventsbuild the CAEP and RISC events, and the stream configuration types are exported.testSetQueueinpermdock/testingis the queue's conformance runner. -
permdock/supabasereads an agentactlevel as better-supabase does:act.read_onlybecomesreadOnly(defaultfalse). A level withsession_id,toolsthat are not non-empty strings or a non-booleanread_onlyisinvalid-chain. An actor withreadOnly: trueis denied every permission withoutreadOnlyHint(not-delegated), with or without a policy delegation.permdock_actor_may_write()and therls.readOnlyActorspolicies refuse a write by an agent withread_only: true.Breaking: an
agentactor'stoolslist is enforced.permdock/agent, the agent adapters andpermdock/mcpdeny any tool it does not name with the new denial reasonagent-tool-not-delegatedand hide it from tool lists. better-supabase'sagentClaimswritestools: []unless given a list, so mint agent tokens withtoolsset to the tools the run may call. -
permdock/terminalfinds the RFC 8414 metadata of an issuer with a path at the path-inserted URL (https://permdock.com/.well-known/oauth-authorization-server/apiforhttps://permdock.com/api), then at the appended one, and refuses metadata whoseissuerdiffers fromdevice.issuer. A token response'sscopeis stored with the credential. -
permdock/terminalreads 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/testingaddstestApprovalWaiter,testAutomationSourceandtestSupportSessionSource, the conformance runners for anApprovalWaiter, anAutomationSourceand aSupportSessionSource. -
permdock/testingaddstestDecisionProviderandtestSnapshotStorage, so every interface on the extension interfaces page has atest<Interface>runner.testDecisionProvideralso checks that a provider denies when its transport fails. -
permdock/workflow-sdkruns automations on the Workflow SDK:workflowSdkWaiterparks a run on a hook while an approval is pending,startAutomationstarts a Workflow SDK run only after PermDock grants the start, andauthorizeHookresumes a hook only for a caller with the permission. -
permdock/workflowadds automations.permdock.decideAutomationchecks a publisher may hand out an automation's operations and returns anAutomationrecord;createPermDockfrompermdock/workflowstarts runs as run tickets, rebuilds each step with the publisher's live rights narrowed to the automation, and waits on approvals through anApprovalWaitersuch aspollingApprovalWaiter.openApprovalandresumeApprovalsplit that wait into two steps for runners that park a run themselves. -
presetMatrix(preset)inpermdock/presetlists, per role and action, whether a preset's policy allows it (allow,own,proornone) 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 --splitandsupabase hook generatenow write for Declarative Schemas 2.0 (pg-delta,supabase db schema declarative sync) unlesssupabase/config.tomlsets[experimental.pgdelta] enabled = falseor the project setssupabase.schemas: 'migra' | 'migrations'or--schemas.--grants-outis refused outsidemigra, andhelperswithoutseedsand--seeds-outis refused undermigra. Doctor PD068 fails whenconfig.tomldoes not turn pg-delta on. PD069 warns about migra leftovers. The manifest's newhook.schemasfield picks the better-supabasegrantsCommand. -
rls generateno longer lets a member of one organization read another organization's rows. AmemberOfcheck over a membership table comparedm.<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 iscoalesce(<id> in (select s.<id> from <table> s where …), false). Regenerate and apply your RLS. -
rls migrateandrls importread role checks, not only permission checks.rls.roleValuesmaps 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.helperstakes aroleform:has_org_role(org_id, 'org_admin')becomes(org_id in (select permdock.member_organization_ids(array['owner']))).rls generatewrites the overloadmember_<scope>_ids(p_roles text[])for each scope arolehelper names, and a shim keeps unrewritten callers working. A role argument that is not a literal is skipped withdynamic-role; an unmapped, undeclared role withunknown-role.rls importreadsrole = any(array[…])and enum casts in membership subqueries, and writes the PermDock name for each mapped role value inmemberOfconditions and the importedrole_permissionsrows.
-
schemas/cloud-api-v1.jsonadds the platform issuer and the projects read API athttps://permdock.com/api, andtestCloudApi(url, keys, { platform })checks them. For the PermDock-Cloud repository:Route or field Contract GET /.well-known/oauth-authorization-server, also athttps://permdock.com/.well-known/oauth-authorization-server/apiRFC 8414 metadata with issuer: "https://permdock.com/api",S256onlyGET /oauth/authorize,POST /oauth/device_authorization,POST /oauth/tokenAuthorization code with PKCE (loopback redirects for permdock-cli), RFC 8628 device flow, refresh rotation; scopesprojects:read,policy:read,catalog:writePOST /oauth/revoke,POST /oauth/registerRFC 7009 ( 200for an unknown token); RFC 7591 for MCP clients,400invalid_redirect_urifor a plainhttpredirectGET /v1/projects,GET /v1/projects/:id,GET /v1/projects/:id/policyA login with the scope or PERMDOCK_CLOUD_TOKEN;RateLimitandRateLimit-Policyon every200,Retry-Afteron429;404policy-not-publishedbefore the first pushPOST /v1/environments/:env/catalogBody adds manifest(supabase-manifest-v1) andpermdockVersion; a login withcatalog:writemay push;PERMDOCK_CLOUD_TOKENanswers403policyFromCatalogkeeps the pushed grants' role order, sorls generate --projectwrites the same SQL asrls generatefrom the code policy. -
schemas/cloud-api-v1.jsonis the OpenAPI document of the PermDock Cloud API, including theclient_credentialsgrant for callers of the hosted decision service, andschemas/connector-v1.jsondescribes a connector.testCloudApi(baseUrl, keys, options)inpermdock/testingruns the conformance runners and the HTTP contract checks against one Cloud environment and validates every response body againstcloud-api-v1.json. -
signSnapshot(snapshot, signer, { audience? }),snapshotFromClaimsandsignPolicyDocument(document, signer, { audience, expiresAt? })are exported frompermdock, andsignApproval(request, signer, { audience? }),approvalSignatureClaims,parseApprovalRequestandAPPROVAL_REQUEST_SCHEMAfrompermdock/approvals.schemas/run-v1.jsonandschemas/support-session-v1.jsondescribe the run ticket and support-session tokens. -
startAccessReviewlists 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. -
subjectFromJwtandjwtSubjectResolverrequireaudiencewhen noverifieris passed. Without it, a token minted for another resource server at the same issuer was accepted. Passaudience: falseto accept any audience on purpose.Before After subjectFromJwt(token, { discovery })subjectFromJwt(token, { discovery, audience: "https://api.example.com" })no audience check audience: false -
subjectFromJwtno longer accepts a sender-constrained token as a bearer token. Withoutsender, a token whosecnfcarriesjktneeds a valid DPoP proof, and one whosecnfcarriesx5t#S256needs a matchingcertificateThumbprint. An explicitsender: "none"keeps the old behaviour for a gateway that verified the binding upstream. -
subjectFromSupabase,actorOfandsupabaseClaims()frompermdock/supabaseread theact.kind: "agent"claim better-supabase'sagentClaimsmints: the actor is{ id, kind: "agent", tools }and the token'sscopebecomes its delegation. Before, such a token was an invalid chain and mapped to the anonymous subject. -
useGate(permission, data?, { mode })inpermdock/reactandpermdock/react-nativereturns what a permission-gated control renders:allowed,pending,hidden,disabled,needsApproval,upgrade(the plans that would grant it) and a localisedreason.gateViewinpermdock/clientis the same computation without React. -
better-supabase share links and approval covers, both needing better-supabase 0.9.0. The
better-supabasepeer range is now>=0.6.0 <0.10.0.subjectFromShareLink(token, { shareLinks, links })inpermdock/better-supabaseresolves a better-supabase share-link token into a link subject forexchangeCapability, so guest pages read under RLS. The link'sexpiresAtcaps the capability, and amaxLifetimein the link policy fails closed for a share link without one.rls.approvals: { delegations: true }generates theapproval_delegationstable with owner-only policies, and a four-argumentpermdock_is_approver(approvers, tenant, requester, resource)that also passes for an active, one-hop cover.rls.approvals.tableis now optional: without it, only the delegations are generated.authorizationProviderpasses better-supabase's{requester}to the four-argument helper when the manifest lists it.tableApprovalDelegationSource({ query })inpermdock/supabasereads the same table forapprovalsHandler.
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
onDeniedto replace a refusal's Problem Details orResponse,contextto merge server-derived values intosubject.context, andwrapwith the newwrapPermDockhelper; MCP and the AI SDK take the samecontextandwrap, and anonDeniedthat replaces the refusal text only. Behaviour changes: aprotectloader that throws now answers403with reasonvalidationinstead of throwing, and Next.jsrequireAccessnow runs the factory'sonDeniedunless 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.
Connectiongainssettled(), which resolves once queued revalidations finish. PermDockProvider(and the Vue plugin, SveltesetPermDockand Solid provider) takesdefaultsfor the<Protected>slots,messagesfor the newuseDescribe()(getDescribe()in Svelte), andonSnapshot,onClearandapprovalInterval.<Protected approval>renders an approval-required decision and falls back tofallback.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 grantnameand the obligation names. A denied decision now carriespermission,DenialDetailstypes each reason'sdetail, anddescribe(decision, { permission })uses the leaf'smeta.title.approvalsHandlershowsGET /:tokenfor a request without a tenant only to its requester, who answered it and who may answer it; other principals get404. A note over 2000 characters is a400and a body over 16 KiB a413; the request stays pending.createPermDockfrompermdock/nexttakeswrap, aPermDockWrapapplied to each instance afteroteland before the factoryonDenied, as the HTTP adapters do.definePermissions,defineRoles,definePlansanddefinePolicytake anxoption with one Standard Schema per kind of app data, which checks and typesmeta.xon permissions, resources, roles, plans and grants andMembership.xon memberships.resource({ meta }),allow(p, { meta }),Membership.xand custom-rolemeta.xare carried to decisions, events, snapshots andcatalog-v1(optionalmetaon resources and grants), and PermDock never reads them; the Supabase sources readMembership.xfrom ajsonbcolumn set withx.joseTokenVerifierdecrypts a nested JWE with any key indecryptionKeys, not only the firstoctkey. It acceptsRSA,ECandOKPprivate JWKs, skips keys whoseuse,algorkiddo not fit the header, and tries the rest in order, so key rotation works.permdock rls generate --dbexits1(unavailable) when the database cannot be reached, instead of2(usage).permdock/better-supabaseaddsauthorizer({ policy }), better-supabase 0.8'sAuthorizerfor PermDock: it decides eachpermissionof a resource, action, route guard or MCP tool from the verified claims. Thebetter-supabasepeer range is now>=0.6.0 <0.9.0.permdock/webmcpdenial text names the resource id (Denied: post.update on p1.), aspermdock/mcpdoes.permdock/a2areads RFC 9396 entries fromextra.authorization_detailswhenextra.authorizationDetailsis absent.protect(null)inpermdock/servernow refuses a delegated token (one with an actor or a delegation) that carries no scopes, with the403insufficient_scopechallenge. It passed before, whilepermdock/mcprefused the same token. First-party sessions are unchanged.rls generate --backfill-outcopies existing custom roles named inrls.customRoles.frominto the custom-role tables, andrls.triggersandrls.auditdeclare app-owned and audit triggers on generated tables, which now carry an identityidprimary key.rls migrate --retire-outdrops eachrls.migrate.tablestable with its refresh triggers once nothing reads it, anddoctorreports such a table as PD066 until then.subjectFromClerkreads theglobalRolesclaim path through the shared path reader, so a__proto__,constructororprototypesegment yields no roles.subjectFromJwtandcreateJwtSubjectResolverreport a throwingmembershipssource throughonAuthas{ reason: 'source-threw', source: 'memberships' }. The subject still resolves without the extra memberships.withOtelkeeps instrumenting the instancederive()returns.
0.3.1 (2026-10-11)
permdock rls generateandpermdock supabase hook generateread global roles only from the rows without a tenant whenrls.rolesreferences a roles table throughthroughandrls.customRoleWrites.rolesnames that table with atenantcolumn.permdock_replace_global_rolesresolved keys over every row, so replacing a user's roles with['dispatcher']inserted one row per tenant role nameddispatcherand kept rows that referenced a tenant role. It now resolves, keeps and inserts only global rows, and a key only tenant roles have raisesunknown-role.permdock_hasand 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)
decideRoleChangechecks a change to a global role. Passscope: 'global'and noidfor a role declared withouton;RoleChangeis now a union in whichidis required for a named scope and absent for'global', so a helper typedPartial<RoleChange>needsExtract<RoleChange, { id: string }>. The authority is the oneassignableRoles({ 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 withscope, and anidon a global change is denied withvalidation. The snapshot-backed client answersassignableRoles({ 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--checknames 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 createrole_permissions, and an unchanged policy still writes nothing.permdock rls generatewritespermdock_replace_global_roles(p_user, p_roles text[])whenrls.rolesnames 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 therls.assignmentstrigger judge each row, andexecutegoes toauthenticated. A role column that references a roles table (through) refuses an unknown key withunknown-role. Regenerate the helpers.permdock/better-supabaseaccepts 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:bucketPolicyandtopicPolicyaccept{ policy, schema?, scope, segment? }besides{ manifest, catalog, scope, segment? }. With thedefinePolicyresult 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, andschemanames the helper schema (defaultpermdock). The same keys are refused as before.supabase.hook.api: { schema?, prefix? }makespermdock supabase hook generatewritepublic.permdock_subject_for,permdock_members_ofandpermdock_authz_version_for(schemapublicand prefixpermdock_by default), so a backend can call the hook's readers through the Data API without hand-written wrappers. Each issecurity definer, revoked frompublic,anonandauthenticated, and granted toservice_role: the only grant the hook makes to it, and only withapi.postgrestSources(client, { api })takes the same setting and derivesschema,fn,membersFnandversionFnfrom it; the four options still override.
0.2.0 (2026-10-10)
-
A
createPermDockinstance 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, soprotect(),can(),where(), snapshots andtenants()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 throughcreatePermDock. -
A
usercredential may name atenant, which holds a personal key to one tenant of its owner.parseCredentialaccepts it (it was rejected before),decideCredentialtakestenanton a user request and refuses one the creator is not a member of withexceeds-creator, and the tenant'scredentialssettings govern the key.createPermDockmakes 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 fromowner, the token or amembershipssource, socan(),decide(),where(), snapshots andtenants()answer for that tenant only.rls.apiKeysalready holds a key whose claim names a tenant to it in SQL; a verifier copies the credential'stenantinto that claim.idsstill holds resource ids only. -
A credential may list any number of permissions.
parseCredentialanddecideCredentialno longer cappermissionsat 64 entries, so a verified key that delegates a read-and-write set over a catalog of 100 or more permissions resolves throughsubjectFromApiKeyinstead of failing asinvalid-claimsand becoming anonymous. The cap guarded self-contained tokens; a credential always comes from the application's own store through a verifier.idsper entry keeps its limit of 64. -
A membership role column that stores a role id is read as a key through a roles table:
fromTablecolumns.role,fromJunctionroles, anrls.membershipstable'sroleandauthorizeSql'stenant.roletake{ through, on, column }, the shaperls.rolesalready takes. The token hook, in-processmembershipsForandlist, thedatabasemode helpers, the custom-role match, the ownership triggers,permdock_can_assignandmemberOfall join the roles table,supabase_auth_admingets read access to it,permdock_bump_authz_version_role_keysbumps every global and membership holder of a renamed key, the manifest's membershiprolecarriesthrough, and doctor PD028 counts the roles table's id and key columns.permdock_can_assignnow also answers from membership sources indatabasemode. -
A membership row can hold roles in several columns:
roleinrls.membershipsandfromTablecolumns.roleaccept an array of columns and{ through, on, column }references, andfromJunctionacceptsroles: { 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:
fromJunctionuserandfromTablecolumns.usertake{ through, on, column }, the shape a role column already takes, so portal contacts incustomer_contacts (contact_profile_id)whose login iscontact_profiles.user_idneed no copieduser_id. The token hook, in-processmembershipsForandlist, thedatabasemode helpers andpermdock_can_assignjoin that table and filter on its user column, withsuspensionapplied 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_admingets read access to the table,rls generate --indexesindexes its user column,permdock_bump_authz_version_member_usersbumps the users a membership row references, andpermdock_bump_authz_version_linked_usersbumps both the old and the new user when the referenced row is re-linked, skipping a login that was deleted. The manifest's membershipusercarriesthrough, and doctor PD028 counts the referenced table'sidand user columns. User and rolethroughcombine 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(createPermDockandsubjectFromMcp) andsubjectFromJwt'sactoroption takeclients(ClientNames: a record from name to id, or a function from a verified id to a name) and setactor.client. An id the mapping does not name, or names twice, leavesclientunset and the delegation does not apply. The catalog's delegationtogainsclient. -
A policy's
MapandSetmembers (rolesByName,resources,index.grantsByKey) now throw aTypeErroronset,add,deleteandclear, as the rest of the frozen policy does on assignment.memoryRoleSourcereturns a copy of its role list on each call. -
A resource whose rows are the scope's instances, such as an
organizationstable whose ownidis the organization id, can take scoped roles: its onememberOfrelation to the scope ({ self: { field: "id", memberOf: "organization" } }) names the field when it is not the scope'skey.can,where(),whoCan, snapshots andrls generateread that field; a snapshot'sscopes[]entry carries it in the new optionalfieldsmap.definePolicythrows when a resource has severalmemberOfrelations to a scope and none on its key. -
A route that checks no permission can now require OAuth scopes.
protect(null, loadData?, { oauthScopes })inpermdock/serverand the Hono, Express, Fastify, Elysia and Node adapters,withPermDock({ oauthScopes })withoutprotectin the Supabase middleware, and anoperationPermissionsentry with onlyoauthScopes(read throughoperationsonpermdock/server) gate a route such as a chat endpoint: an anonymous caller gets401, a delegated token holding none of the scopes gets the same403insufficient_scopechallenge as a permission route, and a first-party session passes. The guard is aScopeGuard, with nodecision. 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.
disabledAtnames a nullable timestamp column on anrls.membershipstable, onfromTable(columns.disabledAt) and onfromJunction; a row with a value keeps its role, and only its permissions drop.rls.suspension.memberships.keeplists what a suspended membership still holds, as a scope'skeepdoes. Thedatabasemode helpers, the inlinememberOfchecks,authorize(), the token hook,subject_for,members_ofand the in-process sources honour the column, thejwtmode helpers andauthorize()honour thekeepof a claim membership, and the holder-count triggers andpermdock_can_assigncount no suspended membership. The manifest carriesmemberships[].disabledAtandrls.suspension.memberships.keep, and PD061 lists the kept keys. -
A snapshot check reads the clock only when a grant needs it. A
usePermissionhook under aPermDockProviderthat is still awaiting itssnapshotPromiseno longer callsDate.now(), so it renders in a Next.js Cache Components static shell without a Suspense boundary. -
A snapshot instance's
can(),filter()andpick()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,useAssignablePermissionsanduseSubjectreturn the same object until the store changes. -
A snapshot now carries
ids, the row id field of each resource whoseidoption is notid. A clientcanon a membership held on one row then answers as the server does, where it used to deny. The clientcan()returnsfalseinstead 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 instanceteam(id)selected. It used to deny every such check on a partitioned resource withtenant-mismatchorscope, 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 onSupabaseSuspensionforfromTable,fromJunctionandauthorizeSql) 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 generatedpermitted_<scope>_idshelpers and their_forforms 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_forandmembers_ofkeep the rows of a suspended instance with akeeplist.Membership.keepcarries it in process: such a membership counts only for the kept permissions, never for role listings or assignment checks, and a malformedkeepdrops the membership.subjectFromSupabase, the JWT claim mapping, the claims schema and the hook manifest read the new field.permdock doctorPD061 lists each scope's kept keys and warns on a key the definitions do not declare. Withoutkeep, 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, andrls generatecompiles it topermdock.permdock_session_live(), which readsauth.sessions(Supabase dialect only). -
An
ApprovalPolicyentry withwhereon a collection permission no longer loads silently and never matches: it is refused like any other invalid entry, so the source denies withapproval-policy-unavailableuntil the entry usescheck. The newvalidateApprovalPolicy(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.membershipstable mapping takes a constant membership kind:via: { value: 'staff' }gives every row that kind, the wayfromJunction'sviadoes, so a staff table needs no kind column (or a generated column) for roles withfor: ['staff']to grant anything. The helpers, theexistschecks ofmemberOf, the ownership triggers andpermdock_can_assignread the constant, and the hook manifest describes it asvia: { 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'scustomermembership inside an organization, applies only when the row carries that scope's key or whenteam(id)selected its instance; otherwise the check isdeniedwithscope. 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 withteam(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 throughverdict.permissionsthatapprovalsHandlerreads with the newpermdockForoption andapproverPermissions.anyOf(...)lets any one of several approvers sign (a list, orallOf(...), stays all-of). A stage can carry its ownescalation, and anApprovalPolicyentry may now setescalation, which widens only that entry's stages. -
Breaking:
PermDockProviderfrompermdock/react-nativerequiressubjectId, the signed-in user's id ornullwhen signed out. A stored snapshot is used only when its principal matchessubjectId;nullclears the storage. With averifier, the provider stores the signed JWS and verifies it again at launch instead of storing the decoded snapshot. A stored copy starts withstatus: 'stale'until the first refresh. Storage that throws or rejects no longer breaks the provider. Newheadersno longer rebuild the store; the next refresh sends them. The interval pauses in the background, a return to the foreground refreshes, and the newsubscribeOnlineprop skips refreshes while offline. -
Breaking:
PermDockProviderfrompermdock/reactno longer suspends its readers on asnapshotPromise. Until the promise resolves,usePermission,usePermissions,usePermDockand the other hooks answer from the current snapshot withstatus: 'pending'(an empty snapshot denies),<Protected>renders itspendingslot, 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 withstatus: 'server-only'instead of reaching an error boundary. To keep the previous behavior, passsuspendtoPermDockProviderfrompermdock/reactorpermdock/next. -
Breaking:
subjectFromBetterAuthfrompermdock/better-authno longer copies the user's additional fields intoprincipal.claimswithoutoptions.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
assertnow answers with the statusprotectsends for the same decision.toProblemDetails()andproblemFromError()return 401 for no subject or a missing step-up, 404 for a row of adisclosure: 'hide'resource, 429 with theRateLimitfields for an exhausted limit and 503 for an unavailable limit store, where they returned 403.problemFromError(error, { credentials })picks the401challenge. The AuthZEN and approvals 401s carryWWW-Authenticate, Nest's missing-row 404 and the Supabase middleware's 405 carry Problem Details, and Convex mapsPermDockValidationError. -
Breaking: every URL PermDock emits moves from
permdock.devtopermdock.com: Problem Detailstypevalues (https://permdock.com/problems/<slug>), the$idand$schemaofcatalog-v1.json,supabase-claims-v1.jsonandsupabase-manifest-v1.json, and the docs links in errors and CLI output. A client that matches on atypeURI or a schema$idupdates the host. -
Breaking: two fixtures in
permdock/testingdrop the better-supabase name, with the same contents.Before After supabaseClaimFixtures.betterSupabasesupabaseClaimFixtures.tenantPlansbetter_supabase.feature_claimsinsupabaseHookManifestFixturepublic.feature_claims -
Deleting an
auth.usersrow no longer fails when its memberships cascade. The generatedpermdock_bump_authz_version_forandpermdock_bump_authz_version_role_keysnow skip a user that is no longer inauth.users, so the version trigger on a membership table cannot insert apermdock_authz_versionrow that violates its foreign key. Regenerate the hook SQL and apply the changed function body in a migration. -
Doctor PD039 and
supabase hook generatenow find helpers written withrls generate --split. They read thehelperspart of anrls.outpath with a{part}placeholder, and the SQL files in the hook file's folder, besidesrls.outand 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
groupsaccept 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. Withoutcolumn, a row names the principal when the edge'ssubjectis not null and a group when that group's column is not null.memoryRelations, thewhere()compilers andpermdock rls generateall read the new form, and theEdgeGrouptype is exported. A plain relation name per group still works and still needscolumn. -
Every
customRolesoption, oncreatePermDockand on each adapter (permdock/server,permdock/mcp,permdock/next, the agent adapters and the rest), also takes aRoleSourceFactory,(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 reportssource-threw.RoleSourceFactoryis exported frompermdock. -
Every adapter's options type now extends the exported
InstanceOptions, soapprovalPolicies,relations,entitlementsandpoliciesreach the instance from every adapter; before, only the core factory readapprovalPolicies, so approval rules kept as data never applied to adapter decisions andtoolApprovalcould not returnuser-approvalfor them. The Hono, Express, Fastify, Elysia, Nest, Node, tRPC and oRPC adapters acceptactor, and tRPC and oRPC acceptotel.Breaking: the
snapshotsoption is removed from every server and agent adapter factory, which never read it. Delete it from the options object; aSnapshotSourcesuch ascloud().snapshotsgoes to thesourceoption ofpermdock/react-native. -
Generated RLS renders
notand deny policies as(…) is not true, so a row whose deny condition is NULL stays visible, ascan()allows it. Runpermdock rls generateagain 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 keyquote.read#sentinstead of a positionalquote.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 generaterefuses one name on two conditions of a permission and two names on one condition, anddefinePolicyrefuses a name that is not lower case letters, digits,_and-starting with a letter, or isbreak-glass. The option is ignored in process. Without it nothing changes. -
New
permdock/better-supabaseentry for better-supabase 0.6, which is an optional peer.authorizationProvider({ manifest, catalog, scope?, approver? })builds itsauthorizationconfig frompermdock.manifest.jsonandpermissions.catalog.json. Withrls.customRolesat a root tenant scope,canAssignandcanAssignForcallpermdock_can_assign_anyand its_forform, so better-supabase'scan_assignaccepts custom roles.permissionsForcalls the newpermitted_<scope>_permission_keys_forhelper thatrls.mode: 'database'writes.approversetscanApprovewithapprovals.distinctApprover. Scopes carry a normalisedidType, and a missing catalog is reported inproblems.bucketPolicyandtopicPolicybuild its storage and realtime access policies fromPermissionreferences.- The SQL templates call
permitted_<scope>_ids_by_permission,permdock_has_permissionand their_forforms, so a deny of the permission is subtracted and a permission split into#ngrant keys still matches. apiKeyVerifier({ keys, manifest?, serviceRoles?, allPermissions? })turns its API keys block into aCredentialVerifier;serviceRolesdefaults to the manifest'srls.apiKeys.serviceRoles. Keys needcreateApiKeys({ prefix: "pdk" }). A rotated key's credential expires when its grace period ends.apiKeyClaimOptionsreads itsapi_keyclaim settings fromrls.apiKeys.subjectFromBetterSupabase(session, options?)reads its sessions with thefeaturesclaim as plans;plans: { claim, keys }decodesentitlements.claim.keysshort codes, andapiKeysmaps anapiKeysession to the key's credential subject.toolPolicy({ permdock, data? })returns theauthorizeandvisiblehooks ofcreateMcpfor tools whosemetais a permission.credentialGuard(provider, { permdock, use, revoke? })wraps aCredentialProviderso PermDock decides each token use.
The Supabase manifest's helper names may now end in
_permission_keysand_permission_keys_for. Regeneratepermdock.manifest.jsonwithpermdock supabase inspect --out. -
New command
permdock configwarns on config keys PermDock does not read, and--printprints the effective config with every default. Every command now exits2when a module path or a config section has the wrong type. Under--json, a non-zero exit always prints JSON: a text failure such ascollect --checkdrift becomes Problem Details withtypehttps://permdock.com/problems/cli-failed.doctorloads the policy and scans the sources once per run. It reports a policy module that fails to load asPD059and a source file that does not parse asPD060. -
New entry
permdock/compileexportscompileWhereand theCompiledWheretree that the Drizzle, Prisma and Kysely compilers render.testWhereCompilertakes an optionalmatches(compiled, row)and then checks that a compiler selects the rows the in-memory evaluator keeps. -
On Supabase,
permdock rls generatewritespermdock_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 thesubofrequest.jwt.claimsand returns null for a token whosesubis an empty string, such as a tenant service key, whereauth.uid()fails the uuid cast.executeon the function follows the helpers' grants, and ananonpolicy that reads the subject now grantsanonthe helper schema asrls.anonExecutedoes. The Supabase manifest lists it inrls.helpers, andrls importreads it asprincipal.id. Regenerate and apply the migration.Breaking:
withSubjectinpermdock/drizzle,permdock/kyselyandpermdock/prismaandpermdock rls verifyno longer setrequest.jwt.claim.sub. A test or job that sets onlyrequest.jwt.claim.subsetsrequest.jwt.claimswith asubinstead. Doctor check PD062 reports migrations that still read or set arequest.jwt.claim.<name>setting. -
REST routes can now require the OAuth scopes an operation declares, as
permdock/mcptools can.protect(permission, loadData, { oauthScopes })in every HTTP adapter, oroperationsonpermdock/server(the result ofoperationPermissions), 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 with403andWWW-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.operationPermissionsentries takeoauthScopes, read byoauthScopesForRequest(method, path)for REST andoauthScopesForOperation(id)forpermdock/mcp'soauthScopesFor, 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
bigintid read through supabase-js) now matches a membership whose id is that number's text, incan, snapshots,heldRoles({ id }), custom-role matching,decideRoleChange,activateand capabilities; before, the check denied withscope. A membership whoseid,withinoron.idis 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
protectloaded; Nest rules sharing aloadDatarun it once; Fastify routes opt out withconfig: { permdock: false }.withSubject(Drizzle, Kysely, Prisma) sets the role and claims in oneselect set_config(…)statement.subjectFromBetterAuthreads every member row in one adapter query, andcreateClerkSubjectResolver({ cache: { ttl } })caches each user'smemberships: 'all'list for up to 30 seconds. -
Snapshots carry the roles and plans in
vocabularyand the permissions inassignableas plain objects, withkindas an ordinary field. They held the policy's own leaves, whosekindis 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 droppedkind, so a clientisRoleorisPlancheck failed on a parsed snapshot. -
The React, Vue, Svelte and Solid providers take
snapshotUrl, whererefresh()fetches a fresh snapshot; it defaults toendpoint. They used to drop it. -
The Supabase hook file now defines
authz_version_for(p_user uuid) returns bigint, the authorization versionsubject_forreports without reading roles or memberships, under the same grants.postgrestSourcestakesversionFn(defaultauthz_version_for) andmemberships.versioncalls it, soclaimsFirst(sources.memberships, { onStale: 'reread' })costs one cheap call per request and readssubject_foronly when the token is behind. Regenerate the hook file and, whenpermdockis not an exposed schema, add a wrapper for the new function; until thenversionfalls back tosubject_foras before. -
The Supabase manifest gains
requires, thesupabase/sdkcapability-matrix feature ids the setup depends on.permdock/testingexportssupabaseClaimVectors, the claim fixtures as a conformance vector file forauth.session.get_claims. -
The
permdock-wireskill now wires@supabase/serverinto Hono, H3, Elysia and NestJS through a pipeline bridge (toHono([withClaims(), withPermDock()]), thenc.var.permdock) instead of the deprecated@supabase/server/adapters/*, which are removed on 1 December 2026. -
The agent adapters keep every field of the
Actorthey resolve, as the HTTP adapters do. Before,permdock/ai-sdk,permdock/claude-agent,permdock/eve,permdock/openai,permdock/mcpandpermdock/a2akept onlyidandkind. Anactoroption that returnedreadOnly: truetherefore lost its read-only narrowing, and theclientnamepermdock/mcpreads fromclientsnever matched ato: { kind, client }delegation. -
The hook file defines
members_of(p_scope text, p_id text) returns jsonbnext tosubject_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 formemberships.list, once per instance, socountHoldersandwhoCanwork over PostgREST. Regenerate the hook and grant the new function to your backend role the way you grantedsubject_for. -
The hook file now defines
subject_for(p_user uuid) returns jsonb: the global roles, memberships, authorization version and, indatabasemode withrls.customRoles, the held custom roles the hook would put in a token forp_user, or{ id, active: false }for a suspended user. No client role may execute it.postgrestSources(client, { schema?, fn? })inpermdock/supabasereads it through supabase-js once per user and returnsmemberships(withversion, forclaimsFirst),customRoles(principal)andsubject(userId), so a backend without aSqlQueryno longer re-implements the membership sources, the suspension filter and a custom-role reader with the admin client. -
The optional
@nestjs/common,@nestjs/coreand@nestjs/platform-expresspeers now accept Nest 11 (>=11).permdock/nestuses 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 getsERR_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
idsfield, so two such rows no longer share one answer.useApprovalpolling resumes when a component subscribes again after a StrictMode or remount unsubscribe.<Protected tenant>renderspendingwhile the provider's snapshot is on its way.PermDockProviderkeeps its store in state, so React never rebuilds it for unchanged props. -
Under pg-delta,
rls generate --splitno longer writes therls.realtimeandrls.storagepolicies into the declarativepoliciespart. The Realtime and Storage services createrealtime.messagesandstorage.objects, so pg-delta's shadow database, and a local stack with either service off, has neither table andsupabase db schema declarative syncfailed withrelation "realtime.messages" does not exist. The policies now go in the--seeds-outmigration, each in adoblock that creates it only whereto_regclassfinds its table. With those policies, thepoliciespart under pg-delta needs theseedspart with--seeds-out. Other layouts are unchanged. -
PermDockProviderfrompermdock/reactandpermdock/react-nativekeeps its store when a re-render passes an inlineheadersobject,fetchfunction orverifier. Before, every parent render rebuilt the store, dropped the refreshed snapshot and cached answers, and on React Native refetched the snapshot.headerscompare by value;fetchandverifiercall 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 holdsfile.read, andrequires: [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 forcan,where()and snapshots, andpermdock rls generateANDs onepermdock_has_permissionorpermitted_<scope>_ids_by_permissioncheck per key.Grant.requireson a normalised grant is areadonly string[]; the catalog lists one key as a string and several as an array.definePolicyrejectsrequireson 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
requiresonly when its scopes cover every required permission and, unless the granted permission is read-only (meta.readOnly, or thereadandlistactions) and the allow is not a role grant, the granted permission as well.can(),decide(),where(), snapshots and therls.apiKeyschecks in the generated SQL apply the same rule. A key stored withfile:readkeeps reading the drives arequires: file.readshare reaches after an app movesdrive.readto 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), anddecideRoleChangedenies assigning one withnot-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 theRoleSourcethat the subject may hand out, anddecideRoleChangeassigns and revokes them instead of denying withunknown-role. A custom role qualifies when the subject may assign a declared role at its scope (or holdsmeta.manageRoles) and may hand out every permission and level it allows; it has no holder count and inheritsforandexclusiveWithfrom its included roles. Declared roles behave as before. -
can,decide,assertandexplainaccept a permission typed as plainPermission, such as one fromlistPermissionsorfindPermission, when the call passesdata(undefinedfor 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'sauthzVersionis behind the source'sversion, or absent, instead of keeping the token's memberships and denyingfreshpermissions. 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 oneversionread and no membership read; aversionthat throws keeps the token's memberships and marks the subject stale. The default,onStale: 'deny', keeps today's behaviour. -
cloud().approvals.resolvethrows theApprovalErrorcode and message the Cloud sends, such asapprover-not-eligible. It used to report every refusal other than409and410asapproval-not-found. -
countHolders(memberships, { scope, id, role })counts the principals holding a role in one scope instance from theMembershipSource'slist, live memberships only and each principal once, for theholdersthatdecideRoleChangeneeds withmin,maxortransferOnly. It answersundefinedwhen the source cannot list or the read fails, which the role change check denies. -
createPermDock({ secretKeys })inpermdock/supabase/middlewareturns a Supabase secret key thatwithSupabasematched by name into a tenantserviceprincipal capped at the declared permissions, andwithSubjectnow writes therls.apiKeysclaim (sub: ''for a service key) for any principal that acts through a credential.fromSupabasePostgres(ctx.postgres)inpermdock/supabaseadaptswithPostgresClient's client to theSqlQuerythatfromTable,fromJunctionandsupabaseApprovalStoretake. -
createPermDockfrompermdock/serverreturnsgetSnapshot(request, { tenant, include, tenants })for React Router, TanStack Start, SvelteKit and Nuxt loaders, reusing the request's cached subject.snapshotHeaders(snapshot, { tags })returns a privateCache-Controlcapped atexpiresAt,Vary, anETagandCache-Tag.cacheLifeForandsnapshotTagare now exported frompermdock/serveras well aspermdock/next. -
createPermDocknow callsRoleSource.globalRoleswith{ held }, the global role names the subject holds, andcustomRoleSource(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. -
createPermDocknow passesRoleSource.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 aRoleSourcefrom a read of every custom role of a tenant, soassignableRoles,assignablePermissionsanddecideRoleChangesee roles the subject does not hold. It keeps only the requested tenant's roles;read: 'held'with apolicyskips the read when the subject holds only declared roles.testRoleSourcetakesevery, the custom role names a tenant has, and fails a source that returns fewer with nothing held. -
databasemode addspermdock_can_assign_for(p_user, p_role, p_scope_id), theassignscheck ofpermdock_can_assignfor a user the caller names, and, withrls.assignmentsand custom roles,permdock_can_assign_custom_role_for(p_user, p_tenant, p_scope, p_scope_id, p_role)over the new internalpermdock_custom_role_guard_forandpermdock_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 hasmember_<scope>_ids_for(Supabase). -
decide,can,assertandfiltertake ascopeoption naming a declared scope: only memberships of that scope answer the check, global roles still apply, and any other membership is skipped withscope. 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/mcpandpermdock/a2aaccept it in their scope pre-checks, andinsufficient_scopechallenges (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 })acceptsmessages.reasonsas a function(reason, decision) => string | undefinedas well as a record, so a translation layer can read the denied decision.undefinedkeeps the reason code. -
doctor.srcPathsets the directories or globspermdock doctorreads for its source checks (PD001, PD002, PD007 to PD015, PD044 and the others over code), so client components outsidecollect.srcPathare checked without changing the catalog. It defaults tocollect.srcPath; PD003 and PD004 still follow the catalog. -
inherit(permission, { through })is a grantee that holds on a row when the subject holdspermissionon 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 ofdrive.read. In process the instance reads the target row through the new optionalRelationSource.row(implemented bymemoryRelations) and decides it with the full policy; a source withoutrowdenies withrelation-unavailable.permdock rls generatecompiles it to a check against the target'spermitted_<resource>_rows, which it now writes for every targeted resource.definePolicyrejects it on a deny, on a collection action, for an unreachable or undeclared target and for a cycle.testRelationSourcechecksrowwhen a source has it. -
localSnapshot({ manifest, read, subscribe })inpermdock/react-nativebuilds the snapshot from the device's own membership and custom-role rows, and the provider takes it assource.localSnapshotManifest(policy)frompermdockwrites the JSON manifest at build time, so the policy never ships to the app. -
operationPermissionsmatches aHEADrequest to theGETentry of its path when noHEADentry matches, soprotect(null)and a permission gate no longer fail on theHEADrequests a framework such as Next.js serves with theGEThandler. A declaredHEADentry still wins. -
permdock collect --watchcollects again when a source folder, the config file or the configuredpermissionsorpolicymodule changes. The Next.js plugin andpermdock/unpluginnow pick up an editedpermissions.tsinstead of reusing its first import, ignore the catalog and barrel they wrote, and debounce reruns to one at a time. -
permdock doctorPD001 now flags a client file importing any server-only entry, includingpermdock/express,permdock/drizzleandpermdock/otel. PD007 now counts every HTTP, MCP and agent adapter entry, includingpermdock/trpc,permdock/a2aandpermdock/webmcp. -
permdock doctorPD001 now reports a client entry that imports the configuredpolicymodule, resolving each import from the importing file: relative paths, tsconfigpaths, and package names throughnode_modulesand the package'sexports, 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 doctorPD002,collectandusagenow resolve a reference's root identifier to its binding. A parameter, local variable or module variable namedpermissions(an array of strings, for example) is no longer read as a permission tree, sopermissions.lengthis not reported as an unknown permission; an import ofpermissionsor of anydefinePermissionsexport, and adefinePermissionsdeclaration, still are, in any file order. -
permdock doctorPD004 now compares the catalog on disk with the catalogpermdock collectwould write fromcollect.srcPath. Before, it built the comparison fromdoctor.srcPath, so adoctor.srcPathwider thancollect.srcPathreported catalog drift thatpermdock collectcould never clear. PD002 and PD003 still count the references underdoctor.srcPath. -
permdock doctorPD005 looks for the skills and their lock in the working directory and every directory above it up to the workspace root, and accepts theskillsCLI'sskills-lock.jsonwhen it lists thepermdockskill, so a package in a monorepo whose skills are installed at the root no longer reports them missing. -
permdock doctorPD014 now reads only the options of PermDock calls: object literals passed to a function imported from apermdockentry, the object literals nested in them, and aconstobject such a call names. An object with ajwkskey that never reaches PermDock, such as another library's environment object, is no longer reported. Within PermDock options,discoverynext toissueris now reported as the docs describe, asdiscoverynext tojwksalready was. -
permdock doctoradds PD065: it warns when a file that importspermdock/react-nativereads a permission whose grant needs the server, because the device denies it offline. -
permdock doctorreports PD063, an error, for a migration that alters or drops a reserved Supabase role or grants a reserved membership, which supautils rejects.permdock rls generaterefuses to write such a statement. -
permdock doctor,collectandusageno longer throw on aforloop with an empty initialiser (for (;;),for (; test; )) or on an array hole in asnapshot({ include })list. The PD002 scanner reads everyfor,for...in,for...ofandfor awaitform. -
permdock powersync generatewrites PowerSync Sync Streams (sync-config.yaml, edition 3) from the policy andrls.memberships, andpermdock powersync verify --dbfails when a stream syncs a fixture row the policy denies. A resource with a deny grant gets no stream. Thepermdock_*streams sync the signed-in user's own membership and global-role rows, the roles tables they reference and, withrls.customRoles, the custom roles of the user's tenants: the rowslocalSnapshotneeds.powersync verifypasses a fixture'ssubject.claimstoauth.parameter()and fails when an own-rows stream syncs another user's rows.With
powersync.manifestset, generate writeslocalSnapshotManifest(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 })inpermdock/react-nativebuilds the local snapshot from PowerSyncdb.watchqueries. -
permdock rls generate --custom-rolesindatabasemode emitspermdock_replace_custom_role_grants,permdock_rename_custom_role_grantsandpermdock_delete_custom_role_grants. They save, rename and delete a custom role's rows with the rules ofvalidateCustomRoleandassignablePermissions, checked against the signed-in caller, so an application no longer hand-writes asecurity definerfunction for it. A null tenant with scopeglobalwrites a platform custom role, checked against the global ceiling and global grants, and a caller holding ameta.manageRolespermission through a global role passes the membership check for any tenant.The
permdock_trusted_replace_custom_role_grants,permdock_trusted_rename_custom_role_grantsandpermdock_trusted_delete_custom_role_grantsvariants 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 generateaddspermdock_permission_keys(p_scope)next topermdock_permission_keys(): the declared keys some declared role is allowed on that scope (globalor 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 generatefolds a constant membership kind (rls.membershipsvia: { value }, or a table with novia) at generation time instead of emitting a per-rowcaseover every role withfor: a role the kind allows gets no filter, and one it excludes is filtered out by name. Access is unchanged. -
permdock rls generatenames graph helpers after the resource's snake_case name, so a camelCase resource such aschatThreadgetspermitted_chat_thread_ids,permdock_link_chat_thread_<link>andpermdock_closure_chat_threadinstead 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 generatenow emitspermdock_role_permissions(p_role, p_scope, p_tenant, p_scope_id)andpermdock_permission_keys(), so role editors and admin screens no longer hand-write the join overrole_permissionsand the custom-role tables. The first returns the permission keys a role holds on a scope withallowordeny: a declared role fromrole_permissions, and withrls.customRolesindatabasemode a custom role of the caller's tenant, resolved through the ceiling asresolveCustomRoledoes. Only a member of the tenant (or ameta.manageRolesholder for a platform role) may read a custom role. The second lists every declared permission key. Both are executable byauthenticatedand not byanon. The change adds two functions to the helpers file and breaks nothing. -
permdock rls generateputs themin,maxandtransferOnlytriggers on the tables offromTableandfromJunctionmembership sources when a scope has norls.membershipstable, so a policy with ownership rules can keep its memberships in sources. Onepermdock_holders_<scope>and onepermdock_transfer_only_<scope>function count holders over every source of the scope, andMembershipSql.holders(typedMembershipHolders) describes the rows they count. A source withoutholdersstill leaves the counts todecideRoleChange. -
permdock rls generatesuggests 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 asstatus: 'sent', so theindexespart andrls verify --introspectwarnings lose those entries. With the new--db $DATABASE_URLflag,generatealso leaves out an index an existing index already leads with, and one whose table or column the database lacks, with a warning. -
permdock rls generatewritespermdock_can_assign_any(p_role, p_tenant, p_scope, p_scope_id)and, indatabasemode,permdock_can_assign_any_for(p_user, ...)whenever a role declaresassigns: one check for a declared or a custom role.permdock_can_assign_custom_roleis now written with custom roles indatabasemode whether or notrls.assignmentsis set. Thepermdock.manifest.jsonwritten bypermdock supabase inspectlists the_forhelpers and the assignment checks inrls.helpers, and addsrls.customRoles,rls.roles,rls.suspensionandrls.assignments, so a package writing SQL next to the helpers can call them without reading PermDock's config. Regenerate the manifest withpermdock supabase inspect --out. -
permdock rls generatewritespermdock_trusted_role_permissions(p_role, p_scope, p_tenant, p_scope_id)next to the member-facingpermdock_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 newrls.trustedReaderslists the Postgres roles it is granted to, such as['service_role', 'support_reader']. -
permdock rls generatewritespermitted_<scope>_permission_keys(p_id)for each scope: every permission key the caller holds on one instance, aspermdock_has_permissionorpermitted_<scope>_ids_by_permissionwould 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 overloadpermitted_<scope>_permission_keys(p_id, p_keys)answers for the listed keys only. Indatabasemode 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 --advisorsrunssupabase db advisors --type securityon--dbor the local stack, names the doctor check for each lint and exits 1 on aWARNorERRORrow. With--revoke-columns, the<table>_visible_fieldscompanion now lives in the helper schema (rls.schema) instead ofpublic, so Supabase'ssecurity_definer_viewlint no longer flags it; regenerate to move it. -
permdock rls verify --treeno 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'orin (...)check, the bound of a> nor>= ncheck), before falling back to a placeholder of its type. The newrls.treeValuessets column values for every row seeded into a table, keyed by table name, for constraints the generator cannot read. -
permdock skills installfollows a symlinked agent or skill folder (.claude/skills/permdocklinked to.agents/skills/permdock) and writes the files once at the target, where it failed with "Cannot overwrite non-directory" before.permdock skills install --checkcompares the installed skills with the package version, writes nothing, and exits1listing 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 fromcreatePermDockto add a tenant's approval policies or every custom role of a tenant. It returns a promise only when a named source is asynchronous; afromSnapshotinstance returns itself, andpermdock/pdpkeeps 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 asignerit returnsSnapshot, with onePromise<string>, and only an options value whosesignerthe compiler cannot see returns either. Callers drop theinstanceof Promisecheck or theparseSnapshotround trip they needed before. The options type is exported asSnapshotOptions. An instance fromfromSnapshotnow signs when given asigner, as the overloads say, instead of returning the plain snapshot. -
permdock/a2aandpermdock/mcpnow decide through the shared agent kernel. An A2A task failure'sstatusfollows the Problem Details matrix:401with awwwAuthenticatechallenge for an anonymous caller,429and503for limits,403otherwise.permdock/terminalprotectexits withEX_NOPERMwhenloadthrows or returns nothing for an instance permission.permdock/convexaccepts the instance options (memberships,sink,limitsand the rest).permdock/testingaddstestAgentAdapter. -
permdock/ai-sdktakesunmapped: 'deny' | 'allow'and returnscomposeToolApproval(app). With'allow', tools thetoolsmap does not bind to a permission stay incapabilityMiddleware's list and passtoolApproval; 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:undefinedleaves the decision to the tool's ownneedsApprovalor the SDK default, and an answer that is not a tool approval result denies. -
permdock/approvalsexportsstoredApprovalToken(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 toresumeDecisioninstead of reimplementing it. -
permdock/approvalsexports the list-paging helpers the built-in stores use, so a customApprovalStoreno longer copies them:pageApprovals(matching, query)pages requests filtered in memory,approvalPageSize,encodeApprovalCursoranddecodeApprovalCursor(with theApprovalCursorPositiontype) serve a store that pages in its own query, andlistAllApprovals(store, filter)followsnextto the last page. -
permdock/fastify: thepermdockHandlerdecision endpoint reuses the subject thepermdockplugin resolved for the request, sosubjectruns once per request, as it does in Express, Node and Nest. -
permdock/mcpaddscacheScope: 'private'to a filteredtools/list,prompts/list,resources/listorresources/templates/listresult 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/mcptakesactorKindoncreatePermDockandsubjectFromMcp, thekindof the actor built fromauthInfo.clientId(default'mcp-client'). Set it to'oauth-client'so an OAuth token is the same actor kind inpermdock/mcpas inpermdock/supabase,permdock/jwtandpermdock/a2a, and one policy delegation covers it on both surfaces. -
permdock/mcptools takeoauthScopes, the OAuth scopes that reach the tool in place of those derived from its permission (the permission's own scope and the coarse scopes ofoauthScopesin the policy). Any one of them reaches the tool and the first is the one aninsufficient_scopechallenge 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 withmcp:readand creating one withmcp:write. Underenforce: 'procedure',oauthScopesFor(name)supplies them for the listing. An empty list throws at registration. Tools without the option behave as before. -
permdock/nestaddsPermDockModule.forRoot({ guard: 'global' }), which registersPermDockGuardasAPP_GUARD, anddecorateMethod(cls, key, ...decorators)for code without decorator syntax. Gateway messages run the same OAuth scope check, loader, decision and approval resume as HTTP routes, andPermDockExceptionFilterhandlesPermDockRevokedError.Protect(null)in Nest, andprotect(null)inpermdock/trpcandpermdock/orpc, need a principal and the declared OAuth scopes but no permission.permdock/expressanswers a PermDock error frompermdock(),protector the decision endpoint with Problem Details instead of passing it tonext(err).permdock()inpermdock/orpcreusescontext.permdockonly when it built that instance for the same tenant.permdock/convextakestenantandactoroptions, and itsConvexErrorcarries the marker Convex needs to senddatato the client.joseTokenVerifierkeys cached JWKS byjwks_uri, so keys from an old URI never answer after discovery moves it. -
permdock/nextandpermdock/next/clientnow load in plain Node ESM, such as Vitest withpermdockexternal or a Node script, instead of failing withERR_MODULE_NOT_FOUNDfornext/cache. The entries import Next.js modules by file and routenext/navigationthrough the package import#next/navigation, so Next.js still resolves its server build underreact-server. -
permdock/next:getPermissionlets Next.js interrupts (redirect(),notFound(), request-time bailouts) fromsubjectortenantpass through instead of turning them into a denial, and takes{ tenant }as a third argument. The serverPermDockProviderno longer replaces a failed snapshot with an empty one: hooks answerserver-only, and withsuspendthe error reaches the nearest error boundary. Instances with a factoryonDeniedare frozen, and theirtenant(),team()andderive()keep the handler. -
permdock/next: the factory returnsgetSnapshot({ tenant?, include?, tenants?, tags? }). Call it inside your own'use cache: private'function: it builds the session's snapshot and callscacheLife(cacheLifeFor(snapshot))andcacheTag(snapshotTag(sub), ...tags)in that scope.PermissionBoundarydeniedandapprovalalso accept a function of the boundary state. -
permdock/openapiexportsoperationPermissions(operations, { base? }), one declaration of each API operation's permission as"METHOD /path/{param}"to a permission (or{ permission, operationId }), withforRequest(method, path)for an HTTP gate andforOperation(id)forpermdock/mcp'spermissionFor, andoperationPermissionsFromOpenApi(document, permissions), which builds it from thex-permdock-permissionsa description carries. REST routes and the MCP tools over them no longer need separate route tables that can drift apart. -
permdock/react-nativeaddssecureStoreStorage(SecureStore), which splits values into 2048-byte chunks, and the synchronousmmkvStorage(mmkv). It also addsappStateForeground(AppState)andnetInfoOnline(NetInfo)for the provider'ssubscribeForegroundandsubscribeOnline.useSnapshotReady()is for the splash screen,usePermissionGuard(permission | permission[], data?)is forStack.ProtectedandTabs.Protected, and the type guardparseLocalSnapshotManifest(value)is also exported frompermdock. Asourceis read again on each return to the foreground. -
permdock/serverexportscreateServerKernelwith theServerKernelandServerKernelOptionstypes, the kernel every bundled HTTP adapter is built on.memoryMembershipSourceandmemorySnapshotSourcejoinmemoryRoleSourceas in-process defaults, andtestMembershipSourcetakes atenantto pass to everymembershipsFor. -
permdock/supabaseaddsparseSupabaseManifest, which reads apermdock.manifest.jsondocument (parsed, or the JSON text), validates it againstschemas/supabase-manifest-v1.jsonand returns a frozenSupabaseHookManifest. It throwsPermDockValidationErrorwith every issue, so a manifest of another major is refused.SupabaseManifestActiveRowis now exported. -
permdock/vue,permdock/svelteandpermdock/solidexportPermissionBoundary, which rendersdeniedorapprovalfor a thrownPermDockDeniedErrororPermDockApprovalRequiredError(Svelte 5.3 or later). Their providers acceptendpoint: false, read aheadersgetter on every request, and callrefresh({ tenant })when atenantref, getter or prop changes.useAssignablePermissionsandassignablePermissionstake a getter, Vue exportsProtectedProps, andpermdock/svelteexportsrequiredPlansunder thesveltecondition.Breaking: Vue composables and Solid hooks throw when called outside
setup(), aneffectScopeor a reactive owner, because their store subscription could never be removed there. -
permdock/vue,permdock/svelteandpermdock/solidre-run a check when a reactive row changes in place again; onlypermdock/reactreuses 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. -
permdockExtensionfrompermdock/prismanow scopesfindFirstOrThrowandgroupBy.verifyDpopProoffrompermdock/jwtcompareshtuwithout the request's query and fragment, per RFC 9449 section 4.3. A newreplayoption oncreateJwtSubjectResolverwithsender: "dpop"rejects a reused proofjti, andmemoryReplayStoreis exported frompermdock/jwt. -
permdock_can_assignnow answers for global roles. A global role whoseassignslists another global role may assign it, and the check takes a nullp_scope_idfor that assignment. A scoped role is never assignable with a null instance, by a global assigner or anyone else. Therls.assignmentstriggers treat a row whose instance column is null as a global assignment: a declared role goes throughpermdock_can_assign(role, null)and a custom role throughpermdock_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 ofscopein which the subject holdspermissionwith no row condition, minus the instances a deny reaches, within its delegation: the in-process mirror ofpermitted_<scope>_ids_by_permission. Apps no longer loop over memberships callingcanwith 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 afieldslist as none. Withconditioned: true, and the SQL overloadpermitted_<scope>_ids_by_permission(p_permission, p_conditioned boolean)and its_forform, the list includes the instances a conditioned allow reaches and subtracts only unconditional denies, leaving the row condition to the caller.grant_keystakesp_effect'conditioned-allow'and'conditioned-deny'for the keys that carry a row condition. -
postgrestSourcesandsupabaseApprovalStorenow take their client asSupabaseRpcCaller, which a supabase-js client typed with a generatedDatabase(SupabaseClient<Database>) satisfies. Before, itsrpctyped the arguments asneverfor a function name theDatabasedid not declare, so the call needed a cast to an untyped client.SupabaseRpcClientstays the type to implement a fake against; it satisfiesSupabaseRpcCallertoo. -
postgrestSourcestakespolicy. With it,customRolesreads nothing while every role the subject holds is declared, andmemberships.versioncallssubject_forinstead ofauthz_version_forwhen 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.versionnow receives therolesandmembershipsthe token claims next toid. -
problemDetailsinpermdock/openapiis a Standard Schema, with a JSON Schema, for the Problem Details body of a denial. When an oRPC contract declaresoc.errors({ FORBIDDEN: { data: problemDetails } }),protectfrompermdock/orpcthrows through that constructor, so clients receive a defined, typed error. -
protectServer(server, { enforce: 'procedure', permissionFor })inpermdock/mcplists and annotates tools by permission but leaves the call to the procedure the tool runs, so each call decides once.permissionOf(procedure)inpermdock/orpcreturns the permission of a procedure'sprotect. -
resource({ restricted })takes{ field, stops }besides a column name.stopslists 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 throughinherit(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 withrelation-depthwhen the chain goes on past that.can,where()(Drizzle, Kysely andresolveRelated, with a closure mapping or a recursive walk) andpermdock rls generateagree; RLS reads the newpermdock_restricted_<resource>()helper, and the closure keeps 32 levels for such a resource.definePermissionsrejects an emptystops, an undeclared link and'parent'without aparent. The catalog carriesrestrictedStops, andRelatedConditiongainsrestrictedAncestorsandpassRestricted.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.memoryRelationskeeps walking past a restricted row when itsrestricteddoes not close'parent', flags the start row inrestrictedeither way, and setstruncatedonly when the next row exists. Regenerate the RLS SQL. -
resource(…, { levels })declares named conditions such asown,teamandall, and a custom-role grant picks one with{ permission, level }. The level is ANDed into the ceiling grant inresolveCustomRole, snapshots,customRoleClaim(key@level) andrls generatein both modes; an undeclared level is dropped asunknown-leveland denies.assignableLevels(permission)lists the levels a subject may hand out, the catalog listslevelsper permission,permdock diffreportslevel-removedas breaking, and a snapshot binds every principal attribute it does not carry, such asteamIds, sofromSnapshotagrees withdecide. -
resumeDecisiontakes attlin milliseconds for the request it opens, and a request opened byrequestApprovalor any adapter without one now stays open for the store'sttl(memoryApprovalStore({ ttl }), or the new optionalApprovalStore.ttl) instead of always one hour. A grant'sapproval.ttlstill caps the window, and attlthat is not a positive whole number of milliseconds throws aRangeError. -
rls generate --custom-rolesindatabasemode now works with membership sources (fromTable,fromJunction,rls.membershipSourcesorsupabase.hook.memberships) instead of failing with--custom-roles in database mode needs rls.memberships.scopes.<scope>. Eachpermitted_<scope>_idsunions a custom-role branch over the source rows, matchingcustom_role_permissionsandcustom_role_includeson the row's first-scope instance astenant_idand its id asscope_id, through the samepermdock_ceilingview as a membership table. -
rls generate --grants-outandsupabase hook generate --grants-outmove only whatsupabase db diffdrops 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 thepermdock_ceilingview and itssecurity_invokeroption.rls generate --grants-outworks with thehelperspart, and with thehookpart as well the file holds the helpers' statements first and the hook's after them. Table grants, such as theselectgrants tosupabase_auth_admin, and thepermdock_auth_admin_read_*policies stay in the hook and helpers parts, becausedb diffdropped 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 nextdb difffinds nothing to change. -
rls generate --helpers-onlycombines with--fields views(rls.helpersOnlywithrls.fields: 'views'): it writes the field views next to the helpers, so a role at one scope whose grants listfields(a portal contact) reads masked columns through<table>_visiblewhile the row policies stay hand-written.--revoke-columnsis still refused with--helpers-only, because the table grants are the application's. Before,--helpers-onlyrefused--fields, and an application with hand-written policies needed security definer functions to return field-safe rows per scope. -
rls generate --seeds-outtakes 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 v1and writes a new<version>_permdock_seeds.sqlonly when they changed, so declarative-schema projects no longer rewrite an applied seeds migration in place.--checkfails while that newest seeds migration is missing or out of date. -
rls generate --shimswrappers 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 asquote.read#1andquote.read#2answered 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 nowsecurity definer(stillsearch_path = '', reading no table), so a caller needsexecuteon the wrapper only, notusageon the helper schema. -
rls generateadds helpers that take a permission key instead of a grant key:permdock_has_permission(p_permission), onepermitted_<scope>_ids_by_permission(p_permission)per scope, andgrant_keys(p_permission, p_scope, p_effect), plus_for(p_user, p_permission)forms indatabasemode. 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#ngrant 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 --shimsno longer answers from a break-glass grant key, which only the break-glass read may use. -
rls generateindatabasemode addspermdock_has_for(p_user, p_grant)and onepermitted_<scope>_ids_for(p_user, p_grant)per scope: the answers ofpermdock_hasandpermitted_<scope>_idsfor 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 rewriterequest.jwt.claimsto ask the helpers.executeis revoked frompublic,anonandauthenticated; grant it to a backend role yourself when it calls them directly. -
rls generateno longer invents a table for a resource thatrls.tablesdoes not name. Withrls.tablesset and--helpers-only, such a resource gets no index in theindexespart or theindex suggestionwarnings, andrls verify --introspectno longer warns about a missing index on it;generatenames the skipped resources once. Without--helpers-only, its policies still targetpublic.<resource>, andgeneratenow warns that they do. A config withoutrls.tableskeeps mapping every resource to the table of the same name. -
rls verify --format pgtapnow asserts each fixture against the database instead of writingselect ok(true, ...). The script createspg_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--dbruns and checksis(..., 'granted' | 'denied', ...)against the outcomecan()gave; an opaque grant becomesskip(). A fixture that disagrees with itsexpectedor names an unknown permission now exits1without a script.rls verify --dbkeeps custom-role rows that already exist (on conflict do nothing) instead of failing on them, and its success line readsin-process and against the databasewhen it checked the database. -
rls verify --treealso seeds distinct values in a column that a unique expression index reads, such asnamein(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 --treeseeds 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: truegrantsanonusage on the helper schema andexecuteon every generated helper, for hand-written policies that apply topublicoranonand call them. Without it only field views thatanonreads get that grant, and a statementanonruns 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 sayto authenticated. -
rls.apiKeysholds a user key whose claim names atenantto that tenant. The generatedpermitted_<scope>_idsandmember_<scope>_idskeep only the key's tenant and the instances inside it, whateverrls.tenantssays, so withrls.tenants: 'all'a user in two tenants whose key names one reads only that one. A scopememberOfcheck compares its tenant column with the key's tenant, a scope outside the first scope's chain admits nothing for such a key, andpermdock_hasreturns false for it, since a global role reaches every tenant. A key without atenant, a tenant service key and the_forhelpers are unchanged. -
rls.apiKeyslets the database narrow an API key request the waysubjectFromApiKeydoes in process. A backend that verified a key passes it in a claim (api_keyby default, withscopes,tenantandroles), andpermdock rls generatewritespermdock_api_key_allows(p_grant):permdock_hasand everypermitted_<scope>_idsreturn nothing for a permission the key'sscopesdo 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 atenantand an empty or missingsubis a service principal of that tenant:permitted_<first scope>_idsandmember_<first scope>_idsanswer for it with the claim'sroles, orrls.apiKeys.serviceRoleswhen the claim lists none.claim,scopes,tenantandrolesrename the claim and its fields. The Supabase manifest lists the settings asrls.apiKeysand the helper inrls.helpers. Off by default; nothing changes without it. -
rls.approvals: truemakesrls generateadd an approval store to the helpers: anapproval_requeststable and onesecurity definerfunction perApprovalStoremethod (permdock_approval_open,_get,_resolve,_consume,_list,_expire,_cancel), each one atomic statement and closed to client roles.supabaseApprovalStore(client, { schema?, ttl?, onOpen? })inpermdock/supabaseimplementsApprovalStoreover them through supabase-js and passestestApprovalStore;onOpenruns after a request is stored, for notifications and superseding older requests.APPROVAL_POLICY_UNAVAILABLEis exported for the detail of a denial caused by a failingApprovalPolicySource. -
rls.approvalsaccepts{ table, token?, body?, mirror? }to put the generated approval store on a table the app already has.rls generateadds the token and body columns when missing, indexes them and writes the samepermdock_approval_*functions, sosupabaseApprovalStoreworks unchanged. The functions read every field from the body, skip the app's rows that have none, and copy the fieldsmirrornames into the app's columns on each write, converted to their types. The table's grants and policies stay the app's. -
rls.approvalson an adopted table takesopen: 'attach'andschema. Withopen: 'attach',permdock_approval_openattaches the request to the row the app inserted with the decision's token, so tables with required columns only the app can fill work withsupabaseApprovalStore; with no such row it raisesP0002and the open fails.schemawrites the store functions into another schema, such aspublicwhen the helper schema is not exposed, sosupabaseApprovalStore(client, { schema })reaches them without wrapper functions. -
rls.assignmentsadds assignment triggers indatabasemode: each scope'srls.membershipstable, and each table inrls.assignments.tablessuch as invitations, gets abefore insert or update or deletetrigger that refuses a client role's write of a role the caller may not assign at that instance (SQLSTATE42501, hintnot-assignable-by). Declared roles follow theassignsgraph throughpermdock_can_assign; custom roles go through the newpermdock_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, asecurity definerfunction, a backend role) are trusted, which covers bootstrap paths without a bypass setting. -
rls.assignmentsnow guards the global-roles table. Whenrls.roles(elsesupabase.hook.roles) names the application's table,rls generateputs apermdock_assignmenttrigger 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 throughpermdock_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 whoseassignslists the role can no longer give itself or anyone else a global role through the Data API. The generateduser_rolestable is unchanged, since no client role may write it. The hook manifest lists the table inrls.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 newuserfield. The refusal raises SQLSTATE42501with hintself-demotionfor the old row andnot-assignable-byfor the new one.permdock doctorPD064 warns on a tablerls.assignmentsguards that no migration orrls.outfile creates thepermdock_assignmenttrigger on.An application that sets both
rls.assignmentsandrls.rolesand lets clients write its global-roles table directly gets those writes checked after regenerating; move such writes into asecurity definerfunction or a backend role, which stay trusted. -
rls.customRoleWrites.requiresmakes 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 withmeta.manageRoles. A caller holding none of them in the tenant, or through a global role, gets42501with hintmanage-rolesfrompermdock_replace_custom_role_grants,permdock_rename_custom_role_grantsandpermdock_delete_custom_role_grants. -
rls.customRoleWrites.rolesnames the application's own table of custom roles (table,key,tenant, and optionallyscope,idand askipcolumn for declared or system rows).rls generatethen addspermdock_cascade_custom_role()and anafter update or deletetrigger 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 storebodymatches the newschemas/approval-request-v1.json.supabase.hook.validate: truemakes the token hook check its claims againstsupabase-claims-v1.jsonand drop them all on a mismatch instead of failing sign-in. -
rls.ownershipTriggers: falseleaves out the holder-count and transfer-only triggers thatmin,maxandtransferOnlyput on the membership tables, andrls.ownershipTriggers: { <scope>: false }leaves them out for the named scopes, for an application that enforces those counts its own way.decideRoleChangekeeps checking the rules andpermdock_can_assignis still written. -
rls.readOnlyActorsadds a restrictive policy per table and write command that refuses writes from support and impersonation sessions (the token'sactclaim) unlessact.read_onlyisfalse, replacing the hand-written policy the support access guide showed. -
rls.realtimeandrls.storage(andsupabaseRls({ realtime, storage })) makepermdock rls generatewrite policies onrealtime.messagesfor private channels and onstorage.objectsfor buckets. A topic segment or a folder of the object name selects the scope instance, and the policies callpermitted_<scope>_ids_by_permission('<key>'), so they count only the allows without a row condition, minus any deny, and a permission split into#ngrant keys still matches. For a permission that also has a relationship grant or awhere,rls generatewarns that its topic or folder admits only the instances its role allows reach. Doctor check PD037,rls verify --dbandrls verify --introspectno 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) makespermdock rls generatewritepermitted_<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 andrequiresapply 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; theneondialect gets no_forform. It works withrls.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 ownselectpolicy written asusing (permdock.permitted_doc_row(doc, 'doc.read'))admits a row the same statement inserts, soinsert ... returningpasses row-level security. -
rls.tablesaccepts schema-qualified names such asintegrations.webhook_endpointsend to end.permdock rls verify(with--dband in the pgTAP output), its field view reads andrlsParityfrompermdock/testingnow quoteschema.tableas 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 inpublic. With--target drizzleor--target prisma, the default export or model name of a schema-qualified table is the table name without its schema;rls.drizzle.exportsandrls.prisma.modelsstill 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 rootmemberOf(nowin (select member_<scope>_ids())) and the nested membershipexistsadmit 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.trustedReadersacceptsservice_role.rls generatethrew "generated RLS must never emit service_role" when the list named it, althoughservice_roleis the trusted server role in a Supabase app. The execute grant onpermdock_trusted_role_permissionsmay now name it, and the generator still refusesservice_roleon every other line. -
securityFor(permission)andpermissionsExtension(permissions)inpermdock/openapireturn an operation'ssecurityandx-permdock-permissionsfrom permission references alone, so a contract package can write them without importing the policy.protectfrompermdock/orpcnow attaches to contract procedures that declare anoutput. -
subjectFromSupabaseandactorOfinpermdock/supabaseread a supportactlevel withoutread_onlyas read-only (Actor.readOnly: true), as better-supabase does. Before, such a token could reach every delegated write. -
subjectFromSupabaseanddelegationOfleave the OpenID Connect identity scopes (openid,profile,email,address,phone,offline_access) out ofdelegation.scopes. A Supabase OAuth server token that carries only those scopes is now anoauth-clientactor with no delegation: it is still denied every check withno-delegationby default, and a policydelegationsentry 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 withnot-delegatedeven when the policy delegated to it. -
supabase.hook.beforenames schema-qualified functions(event jsonb) returns jsonbthat the generatedcustom_access_token_hookcalls first, in order. A result with anerrorkey is returned as the hook's answer, so Supabase Auth refuses the token, and anullor 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 grantssupabase_auth_adminusageon each function's schema andexecuteon the function, and the Supabase manifest lists them ashook.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'sonOpennow runs once per stored request. A repeated ask whose token finds the request still open keeps the stored request, as before, but no longer runsonOpenagain, 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 noonOpeneither. -
usePermission,usePermissionsanduseApprovalfrompermdock/reactandpermdock/react-nativenow update after a snapshot change when the React Compiler compiles them. Before, a compiled hook kept its first answer, such aspending. -
vouchApproval(store, token, { status, by, rule, note? })inpermdock/approvalsrecords 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 recordsvouched: ruleon the request and on the approval, so the audit trail says which rule decided. The eligibility checks ofapprovers, the tenant membership and the quorum are skipped; the actor, the principal (unlessdistinct: false), a repeated approver, an unauthenticated subject and a closed or expired request are still refused.ApprovalVerdict.vouchedis server-side input thatapprovalsHandlernever reads from a body.applyApprovalVerdicthandles it, so the memory store, the generated Supabase store and custom stores built on it support it, andtestApprovalStorechecks it. The approval request wire format (v: 1) gains the optionalvouchedfield.
0.1.0 (2026-10-04)
-
A
401to a request without anAuthorizationheader now carries a bareBearerchallenge instead oferror="invalid_token"(RFC 6750 section 3.1), and a rejected token gets a fixederror_description. The/unauthenticatedbody no longer carriesdenialsoralternatives, so nothing explains the failure to an unauthenticated caller.problemFromDecisiontakes acredentialsoption 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 undernot,ororandnow fails its grant withopaque-conditionon the server and infromSnapshot, sonot(opaque)no longer matches.coveredByDelegationtreats an RFC 9396 or GNAP entry whoseidentifieris not a string or whoseactionsis not an array as covering nothing, instead of ignoring the field. -
A dotted condition field, relation or identifier with a
__proto__,constructororprototypesegment (a.__proto__) is now rejected at definition time like the bare key, as the threat model states.permdock/testingrenames theClientStoreDocktype toClientStorePermDock. -
A grant whose roles the subject holds but whose
plangrantee it lacks now denies with the new reasonnot-entitledinstead ofno-grant, with the grantee into; a plan grant whose roles are not held adds no denial. When every denial isnot-entitled, HTTP adapters answer403/not-entitledwithplans(the plan keys that would grant),describe(decision)returnskind: 'upgrade'withplans, and the newrequiredPlans(decision)returns the list. Snapshots carry these grants asnotEntitledentries, which grant nothing, sousePermissionin every UI adapter gets the same reason and plans asdecideon the server. -
API keys end in a 6-character base62 CRC-32 checksum:
pdk_<id>_<secret><checksum>.generateApiKeyappends it andparseApiKeyrejects a key whose checksum does not match, so secret scanners can matchpdk_[A-Za-z0-9_-]{1,128}_[A-Za-z0-9]{49}and discard lookalikes offline; keys generated before this change no longer parse.CredentialVerifiergains an optionaltouch(id, at)thatsubjectFromApiKeycalls, without awaiting, after a key resolves, for alastUsedAtcolumn;apiKeyVerifier({ find, touch })passes it through,memoryCredentials()records it (lastUsedAt(id)), andtestCredentialVerifierchecks that a touch never changes what a key verifies to. -
Add
toCsvRow(event)andCSV_COLUMNS: the pinned CSV export row for decision and approval events, shared by the Cloud export and self-hosted sinks. -
Approval grants take
quorum,ttlandescalation.quorum(default 1) is the number of distinct approvers a request needs:ApprovalStore.resolveappends each approval to the request's newapprovals: { by, at }[], keeps the requestpendinguntil the quorum is met, and refuses a repeat approver with the newapprover-repeatedcode (409fromapprovalsHandler); one rejection ends the request.ttl(a duration such as'30m') caps the store's window whenrequestApprovalsetsexpiresAt.escalation: { after, to }letstoapprove onceafterhas passed sincecreatedAt. The request'sapproverscarriesquorumandescalation;applyApprovalVerdict,approvalQuorumandescalationOpenAtare exported frompermdock/approvalsfor custom stores, and the Drizzle recipe uses them.definePolicyrejects a quorum below 1, a malformed duration or a relation inescalation.to; hosted grants with a smaller quorum or a longer ttl than a code allow are dropped asweaker-approval. The catalogapprovalcarries the three fields, sopermdock diffreports 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
idfield,Decision.tokenincludes a SHA-256 of the canonical JSON of the validated data, so an approved call no longer covers a retry with different arguments.approval.byrefusesrelation()atdefinePolicy, and an approval store refuses every approver for a stored request whose approvers include a relation.permdock/terminalprompts y/N only for a grant withapproval: { distinct: false }and no actor; any other approval is recorded in thestoreand the command exits75until someone else approves it, or exits77when nostoreis configured.storedApprovalTokenmoved 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, andapproval: { staleOn: 'resource-change' }hashes its value into the decision token (the prefix stayspd1.; tokens of grants withoutstaleOnare unchanged). Resuming with a token that approved an earlier version of the same row denies with the new reasonstale-approvaland leaves the old record unconsumed; the next call without it is a newapproval-required.definePolicythrows forstaleOnon a collection action or on a resource withoutversion. Approval requests carryapprovers.staleOn, the catalog carries resourceversionandstaleOninapprovals, and a hosted approval withoutstaleOnisweaker-approvalagainst a code allow that sets it. -
Approvals refuse the requester by default.
approval: 'human'andapproval: { by }now refuse the request's principal as approver as well as its actor (approver-is-principal), inassertApprover,ApprovalStore.resolve,resolveApprovalandapprovalsHandler. A grant that wants the user to confirm their own agent's call opts out withapproval: { distinct: false }, andpermdock doctorPD024 (--only self-approval) warns on each opt-out.requireDistinctApproverstays as a handler-wide floor that refuses the principal even on an opted-out grant. A hosted grant that setsdistinct: falseon a permission a code allow guards with an approval is dropped asweaker-approval.testApprovalStorechecks that a custom store refuses the principal on every approval shape and accepts it only withdistinct: false.Behaviour change: an approval request without
approvers.distinctnow refuses its principal. Setdistinct: falseon the grant to keep the old behaviour. -
Approvals take
mode: 'all' | 'sequential'withstages: [{ by, quorum? }],user(id)approvers, andrelation()approvers checked at verdict time throughapprovalsHandler's newrelationsoption (approverRelationsinpermdock/approvals). The approval request carriesmodeandstages, each signature itsstage, and the verdictrelations.createPermDocktakesapprovalPolicies, anApprovalPolicySource(memoryApprovalPolicies) whose entries add approval stages to matching allows and deny withapproval-policy-unavailablewhen they fail to load;testApprovalPolicySourcechecks a source. -
Arazzo
simulateandpermdock arazzo checkfollow the 1.0 and 1.1 specs more closely:- Documents are validated against the required fields.
- Patch versions are accepted.
$sourceDescriptionsforms ofoperationIdandoperationPathselect their source.$inputs.*and$components.parametersreferences 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.
simulatenow emits the onesimulateaudit 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.decideRoleChangereads a nested change's tenant from the subject's membership and denies a disagreeingwithinwithno-membership; pass{ trusted: true }when the application loadedwithinfrom its own store.activatecopieswithinfrom the eligible membership, and the approval token covers it. -
Bound the work one request can cause.
canandwhoCanwalk 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(andpermdockHandler) answers a batch overmaxEvaluations(256 by default, the AuthZEN limit) with a 413 Problem Details before resolving the subject. A denial'salternativespeek a quota grant'sremainingwithout spending it, andcanskips 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.tsimported./src/permissions.js, which does not resolve. collect,usageanddoctorskip a broken symlink in a source folder instead of crashing.permdock usageexits2with "policy export is not a Policy" when the policy module exports something else, instead of throwing (which crasheddoctorat PD003).- A computed identifier key such as
defineRoles({ [name]: … })no longer counts as a role namedname, which madeusagereport a false "granted by no role". - PD009 names the duplicate
permdockpackage folders, not their parentnode_modules.
- The generated barrel imports the permissions module relative to its own folder; before, the default
-
Catalog permissions carry
rowConditionswhenpermdock.config.tsnames a policy:truewhen a code grant for the key has awhere,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 doctorPD037 errors on a migration'sstorage.objectsorrealtime.messagespolicy that calls a helper for such a key, andpermdock rls verify --dbreports the same frompg_policies, so a Storage or Realtime policy written outside PermDock (better-supabasepermdockmode) cannot grant more than the application does. -
Catalog v1 carries a top-level
fingerprintand per-permissionapprovals.catalogFingerprint(catalog)is exported frompermdock: base64url SHA-256 over canonical JSON withoutgeneratedAt,generator,fingerprintandusages, so the CLI version and call sites no longer change it.permdock collect --checkignoresgenerator. -
Composed membership sources and
permdock supabase hook generate.membershipson everycreatePermDockaccepts an array of sources, merged and de-duplicated bycomposeMemberships, andMembershipSourcegains optionallist({ scope, id })(a scope's members),version(principal)andclaimsFirst.claimsFirst(sources, { version })keeps the verified token's memberships and reads the sources only when the token was truncated. Permissions listed indefinePolicy({ fresh })deny with the new reasonstale-credentialswhen token memberships are behind the source version; a stale subject's snapshot drops those allows.permdock/supabaseadds the SQL sourcesfromTableandfromJunction(fixed roles,via,within, expiry,managedBy, seats, suspension),authzVersion,supabaseMembershipsBudget, andsubjectFromSupabasereadsmemberships_truncatedandauthz_verintoprincipal.membershipsTruncatedandprincipal.authzVersion.permdock supabase hook generatecompiles the same sources intocustom_access_token_hook:user_roleandroles, a union over every source with the active scope first (--active-from), anattrsclaim from allow-listed server-owned columns andapp_metadata.<key>entries for attribute conditions (user_metadatais refused, and the migration refuses to install while clients can write a listed column), a byte budget overattrsandmemberships(--budget, default 1024) withmemberships_truncated,authz_verwith its version table and triggers, a trigger that refuses client writes to IdP-owned rows, thesupabase_auth_admingrants and revokes, and the printedconfig.tomlblock withjwt_expiry = 900.Memberships carry
managedBy: 'idp'(set bydirectoryMembershipSource;decideRoleChangerefuses with the new reasonexternally-managed,isExternallyManagedtells a UI) andentitlements(seats thatplan()grantees match inside the active tenant).EntitlementSource(entitlementsoption,memoryEntitlementSource,testEntitlementSource) adds plan names for the active tenant, andfromStripeEntitlementsreads Stripe Entitlements through a structural client.permdock doctorPD028 (--only attrs) flagsattrsentries a user could set. -
Custom roles in generated RLS.
permdock rls generate --custom-roles(orrls.customRoles: true) makespermitted_tenant_idsandpermitted_team_idsresolve tenant-defined custom roles as well: from the newcustom_role_permissionsandcustom_role_includestables indatabasemode, or from a compactmemberships[].grantsclaim injwtmode (off unless the flag is set). Both go throughpermdock_custom_keysand a generatedpermdock_ceilingview of the assignable declared roles, so a row or claim entry outside the ceiling never widens access, and the database agrees withresolveCustomRole.authorizeSql({ customRoles: { declared } })answers tenant requests from custom roles, and--rbac supabase --custom-rolespasses it through.customRoleClaim(roles)builds the claim map for a token hook.rls verifyfixture files acceptcustomRoles(resolved in-process, sent in the claim, and seeded into the tables indatabasemode), andrlsParityacceptscustomRoles. 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-rolesis unchanged. -
Custom roles with
scope: 'global'are platform roles held throughprincipal.roles, capped by the allows of assignable global roles and returned by the newRoleSource.globalRoles(). Withrls generate --custom-rolesthey are rows with a nulltenant_id, or the top-levelrole_grantsclaim injwtmode, andpermdock_hasanswers from them. The--rbac supabasescaffold typesuser_roles.roleastextwhen--custom-rolesis on. -
Decision data is untrusted unless the caller marks it. With
validate: 'boundary',decide,can,filter,protect,conn.checkand the Nest guard validate a row against the resource schema unless the call passestrusted: true; pass it for rows your server loaded itself. The agent kernel labels tool databoundary: 'tool-args'. The AuthZEN handler forwards the loader'strustedflag and answersdecision: 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? }), andDecisionEvent.denialsandProblemDetails.denialsare typed that way. This covers decision events, Problem Details bodies, MCP and WebMCP refusals and the decision endpoint.detailis kept only as a JSON value: what a closure threw (closure-error), a validation error and anyErroror non-JSON detail are dropped, so they no longer reach a sink or a response body.WireDenialandWireDecisionare exported frompermdock. -
Doctor PD028 now also warns when the migrations let
anonorauthenticatedinsert or update a column that decides a membership: the user, scope, id,within, role,viaand expiry columns of everyfromTable/fromJunctionsource. A contact who can edit their own row could otherwise setuser_idorcustomer_idand give themselves a membership. The grant model matches Postgres, where a column-levelrevokeleaves a table-level grant in place.MembershipSqlgainscolumns, the list the check reads. -
Document that scope and tenant ids compare as exact text in
decideand the SQL helpers, never lower-cased, and that producers emituuid::text; the policy matrix and an RLS parity suite over auuidcolumn cover it. -
Document the PermDock Cloud contract v1:
client,adminandexportkey kinds, the authoring routes (/hosted-grants,/directory/*,/connectors,/export), the environment's JWKS and OIDC Discovery, RFC 8693 token exchange at<env URL>/oauth/tokenminting RFC 9068 access tokens, the raw sink body the Cloud envelopes as CloudEvents, andmembershipevents withsource: 'cloud'. -
Drizzle
toWherereturnsSQL, andcolumnsaccepts only columns of the given table.permdock/prismaaddsprismaModelFields, which reads required and list fields fromschema.prismaor a DMMF datamodel for the newmodeloption, andtoPredicate, 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
suband asidmaps to an opaque session subject, not aniss_subsubject with an emptysub. PermDockCloudEventincludesdev.permdock.credential, whichverifyWebhookalready accepted.
- 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
-
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) andreason(free text); both round-trip through the Supabase custom access token hook claim, the snapshot and every event.Membershipalso gainseligible(roles a holder may activate but does not hold) andmember: { 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 undereligible, andpermdock.activate({ role, scope, id, duration, reason })returns aDecision. It isapproval-requiredwhenactivation.approvalis set; once granted it carries the membership to write underelevation(via: 'elevated', withexpiresAt,grantedByandreason). PermDock never writes the membership; the app does. Expiry uses the existingexpiresAtcheck plus C3's revocation counter, and the Supabase hook already includes elevated rows.permdock doctorPD033 warns on anactivationwithoutmaxDurationand 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 whosenameit lists and nothing else, so deny-overrides-allow holds everywhere else. A satisfied break-glass grant isgrantedwithmatched.breakGlass: trueandobligations: [{ kind: 'notify' }, { kind: 'review' }, { kind: 'justify', reason }]; a break-glass grant is engaged bycontext.purpose, and a missing purpose, reason or assurance denies with the new reasonspurpose,reason-requiredorinsufficient-user-authentication.DecisionEventrecordspurposeandreason, andtoOcsfraises break-glass to high severity. RLS never compiles a break-glass grant (it stays non-portable); insteadpermdock rls generateemits apermdock_break_glass_audittable and onesecurity definerpermdock_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 doctorPD034 flags a break-glass grant under anrlsconfig.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-boundvia: 'support'membership. A tenant owner consents through anApprovalRequestwhosemembershipis{ scope, id, via: 'support', roles: ['support'], member: { group: 'vendor-support' }, expiresAt, grantedBy }; group members ride C3'sfromJunctiongroupoption. WithactorRequired: true, every decision under a support membership denies with the new reasonactor-requiredunless the subject carries anact.forbidcompiles to deny grants scoped tovia: 'support'. The lifecycle emits the newaccess.started,access.endedandaccess.revokedevents (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 doctorPD035 warns on a support role withoutactorRequired.Purpose of use.
context.purposeis 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
activationandsupportAccessentries and break-glass entries per permission. -
Every
DecideOptionsfield has JSDoc, so editors describetrusted,boundary,now,source,adapter,onDeniedandfieldon hover. The same text is the options table on the decisions page. -
Export
coveredByDelegation(permission, delegation, resourceId?, hasActor?)frompermdock: the delegation coverage checkdecideuses for OAuthscopes, RFC 9396authorizationDetailsand GNAPaccess. It returnsundefinedwhen covered, otherwiseno-delegationornot-delegated, andpermissionneeds onlyscope,resourceandaction, 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
fromSnapshotand for approvers. - A deny naming one now applies to everyone.
- A hosted grant naming one is dropped as
unknown-grantee, and an approverbynaming one is invalid. whoCanreportscomplete: falsewhen it meets one.toOcsfmaps an outcome this build does not know tostatus_id0Unknowninstead of leavingstatus_idandstatusundefined.
- An allow naming one matched every caller, anonymous included; it now matches nobody, on the server, in
-
Fail-closed fixes found by the coverage suite:
subjectFromJwtwithactor: { kind }and nofromnow reads the RFC 8693actclaim. Before, a delegated token under that config resolved as the user acting directly, with no actor and so no delegation check.- A custom
verifier.verifythat throws insubjectFromJwt,subjectFromCapabilityorsubjectFromCiOidcresolves the anonymous subject with causemalformedinstead of rejecting. permdock/pdp: aprovider.decidethat throws or rejects isdeniedwithpdp-unavailable, and apermittedcallback that throws makesfilterandwherekeep no rows.
-
Field views.
permdock rls generate --fields views(rls.fields: 'views') emits, after the policies, onesecurity_invokerview<table>_visibleper table whose read grants setfields: a column some read allow leaves out or some read deny lists iscase when <permitted> then col end, where<permitted>iscan(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 withfields, an allow with an empty list) leave the row policy and live in the masks, as they never decide the row incan. Whenanonreads a view, the helpers are executable byanontoo; 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:anonandauthenticatedgetselecton only the unrestricted columns and the key, and the restricted columns are read through<table>_visible_fields, asecurity_barriercompanion that runs as its owner, masks every column with the full field decision and keeps only rows with a readable column, left-joined onpermdock_key. It breaksselect *andreturning *on the table. Drizzle and Prisma targets put the views and column statements in the migration comment.permdock rls verifywithrls.fields: 'views'andrlsParity({ fieldViews: true })compare each read fixture's row in<table>_visiblewith the columnspickkeeps (reported asfields: { app, database }, typeRlsFieldsOutcome), and read back only the key so a closed table does not reject them;rls verifystatements now alwaysreturning "id".permdock rls importreads the generated views back as afieldViewsexport of per-column grants, from a dump or with--db.permdock doctorPD030 (--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
permdockcore and adapters, thepermdockCLI and thepermdock/testingrunners. -
Generated RLS keeps parity with
decide.containsescapes\,%and_beforeLIKE.rls.suspensionnow also applies to the inline membershipexists, the root-scope tenant-claim check and the graph helpers.rls migratecounts 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.roleand the newrls.rolesaccept{ through: 'roles', on: { role_id: 'id' }, column: 'key' }. It ships because CentraKit, like most apps that manage roles in a UI, keepsuser_roles (user_id, role_id references roles(id)), and copying keys intouser_roleswould turn every rename into a data migration.permdock_has,permdock_can_assignand the token hook join through the table, the hook grantssupabase_auth_admina read on it, andpermdock_bump_authz_version_role_keysbumps every holder'sauthz_verwhen a key changes.rls.rolesdefaults tosupabase.hook.rolesand the hook's roles torls.roles; with it set,rls generateno longer createsuser_roles, and--rbac supabaserefuses it. -
Grants take
validFromandvalidUntil(RFC 3339 or Unix seconds), normalised toGrant.validity{ from?, until? }. Outside the window an allow denies with the newinactive-grantreason anddetail: { from, until }; a deny does not apply andexplainrecords it as skipped withwhy: 'validity'.where()andfilterdrop inactive grants, snapshot grants carryvalidityfor the client evaluator,permdock rls generateANDsnow() >= to_timestamp(from) and now() < to_timestamp(until)into the access check, andsimulate(checks, { now })previews a batch as of one instant. The window is part of the policy fingerprint, and the catalog marks such a permissionrowConditions: true. -
Graph grants reach the ORMs.
toWhereinpermdock/drizzleandpermdock/kyselycompiles arelatednode to one subquery when givenrelations: { tables?, closure? }, andresolveRelatedinpermdock/prismareplaces each node with the ids it reads through a raw query. All three adapters exportcheckRow, which tells a missing row from a denied one in one query, andwithSubject, which runs a transaction with the role and claims the generated RLS policies read. -
HTTP adapters answer an exhausted
limitwith429,Retry-Afterand theRateLimit/RateLimit-Policyfields ofdraft-ietf-httpapi-ratelimit-headers-11, andlimit-unavailablewith503; tRPC and oRPC map them toTOO_MANY_REQUESTSandSERVICE_UNAVAILABLE. Alimitdenial now carriesdetail: { count, window, resetsAt }(LimitDetail).resource()takesdisclosure: 'hide', which makes a denied row answer the same404/not-foundproblem a missing row gets; a missing row is now that problem instead of an empty404. A step-up challenge namesacr_valuesandmax_ageinWWW-AuthenticateandacrValues/maxAgein the body, including the requirements of break-glass grants and role activations, whose denials now carry theassurancegrantee into.permdock doctorPD036 warns on aprotect(permission)with no row loader on a route whose path names an id. -
Link capabilities. A share link is a signed
permdock-capability+jwtwhosecapabilityclaim (v1) holds roles on one resource instance (on), optionally narrowed topermissions, with a requiredexpiresAt, an optionalredeemer('anyone','signed-in',{ user },{ scope, id }) and optional one-time use.signCapability(input, signer, { audience })issues one from permission and resource references, andcapabilitySubjectandparseCapabilitybuild the subject and validate the claim.subjectFromCapability(token, { issuer, audience, revoked?, replay?, viewer? })inpermdock/jwtverifies it and returns akind: 'link'principal whose only membership is{ on, roles, via: 'link' }, withdelegation.scopesfrompermissions; a revoked link id, a replayed one-timejti, a redeemer the viewer does not satisfy or a throwing store resolves to the anonymous subject, reported onon('auth')with the new causescapability-revoked,capability-replayedandredeemer-mismatch. A tenant can tighten links on its resources with aLinkPolicy(maxLifetime, allowedredeemers, requiredonce):subjectFromCapability({ linkPolicy })refuses a violating link with causelink-policy,signCapability({ linkPolicy })refuses to sign one, andlinkPolicyViolationnames the broken rule.subjectFromJwtnever accepts the capabilitytyp.For RLS,
exchangeCapability(subject, { key, alg, kid?, ttl? })inpermdock/supabaseexchanges a verified link for a short-lived Supabase access token withrole: 'anon'and the capability in acapabilityclaim, andpermdock rls generate --capabilities(rls.capabilities) emitspermdock_capability_ids(p_resource, p_role, p_permission)and oneanonpolicy per resource-scoped grant; a resource role without a memberships table is then reached by links only instead of failing generation.permdock/testingships thepermdock-capability+jwtfixture. -
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;tenantandteamare aliases of the first and second scope, and a policy with{ tenant, team }must now declareteam: { key, within: 'tenant' }.role(name, grants, { on })is typed against the declared names, and theactivationandrestrictedrole 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, andsubjectFromJwtgroups anddirectoryMembershipSourcenow yield tenant memberships withvia: 'group:<id>'instead of team memberships.definePolicythrows when a scoped instance grant touches a resource without amemberOfrelation on the scope's key.where(),filter, snapshots (scopesis now an ordered{ name, key, within, resources }list),fromSnapshot,mayAccess,memberOfconditions, custom roles (CustomRole.scopeandid) and the catalog (scopes[],roles[].onas a scope name) understand named scopes.permdock rls generateemits onepermitted_<scope>_ids(p_grant)per declared scope, readsrls.memberships.scopes.<scope>tables withcolumnsindatabasemode and canonicalmembershipsclaim entries injwtmode, types scope columns throughrls.scopeTypes, and keys the custom-role tables byscopeandscope_idinstead ofteam_id.authorizeSql({ scope })names the first scope.permdock doctorPD025 (--only scopes) warns on fixture memberships the scopes would drop.rlsParity({ snapshot: true })also checks the serialized snapshot, andtestMembershipSource({ policy })checks memberships against the policy's scopes. -
New runtime entry
permdock/catalog:parseCatalog(json)validates apermissions.catalog.json(text or parsed) againstschemas/catalog-v1.jsonand returns a deep-frozen, prototype-safe copy, throwingPermDockValidationErrorwith every issue;rowConditionKeys(catalog)lists the permissions markedrowConditions: true; theCatalog*types move here and stay exported frompermdock/cli, withCatalogDocument['version']now1.permdock/cliexportscatalogPath(config, cwd, out?), the pathcollectwrites to.catalog-v1.jsonnow requires whatcollectalways writes (generatedAt,generator, a permission'smetaandusages, a resource'sidandschema), types every field the catalog carries, and adds the missingstaleOnon approvals;permdock catalog --format schemaemits 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 andpermdock/nextalready did: Hono'sc.get('permdock'), Express and FastifywithPermDockhandlers, Elysia's derivedpermdock, the Node, Claude Agent SDK, Eve, OpenAI Agents and terminalpermdock()results, the terminalprotectcontext, the Supabase middleware contribution, oRPC middleware context, Convexctx.permdockandPdpPermDock.permdock/fastifygainswithPermDock(handler), which typesrequest.permdockwithout augmentingFastifyRequest.Old New CreatePermDockOptionsPermDockOptionsCreatePermDockPluginOptionsPermDockPluginOptionsServerPermDock.handler,AuthzenPermDock.handlerpermdockHandlerExpressPermDock.handler(fn)withPermDock(fn)SsfAdapter,SsfOptionsSsfPermDock,SsfPermDockOptionsSupabaseMiddlewareOptionsSupabaseMiddlewarePermDockOptionsA2AAgentCard,A2APermDockand the otherA2A*typesA2aAgentCard,A2aPermDock, …dock,pd,server,factoryfor the instance in docs and skillspermdock; acloud()result ispermdockCloud -
One package: the CLI moves into
permdock. Thepermdockbinary is the package'sbin,@permdock/clibecomespermdock/cli(defineConfig,run),@permdock/cli/unpluginbecomespermdock/unplugin, andpermdock/next/pluginrunscollectitself instead of resolving@permdock/cli.permdock, owned by thescaledockhqnpm organisation, is the only package name.Runtime entry points (
permdock,permdock/next,permdock/jwt, ...) still depend on@standard-schema/speconly: every command is loaded on demand, andtests/bundlefails if a runtime entry reaches a CLI or test-runner package. Dependency cost, measured as npm unpacked size:oxc-parseris the package's one other dependency, becausecollect,usage,doctor,catalog,cloud pushand 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) andyaml(0.69 MB) are bundled into the lazily loaded OpenAPI command chunks instead of being installed.pgsql-parser(2.83 MB withlibpg-queryWASM andpgsql-deparser),pg(0.10 MB) andunplugin(0.08 MB plus its dependencies) are optional peers.permdock rls import, the--dbmodes andpermdock/unpluginprint 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.deprecatedemitsdeprecatedon 3.2 and 3.3 andx-oai-deprecatedon 3.1.- On 3.1 the device flow sits inside
flowsasx-oai-deviceAuthorization, with the flow's own URL asx-oai-deviceAuthorizationUrl. - A permission granted unconditionally to
anyone()getssecurity: []. - Top-level grants now reach
x-permdock-conditionsandx-permdock-approval. - The 3.3 profile scheme carries
supportedParametersSchemaas a URL and namedservers.securityProfileRequirements(scopeSets?)writes one requirement per distinct scope set, each withsecurityScheme,token_endpoint_auth_methods,grant_typesandscopes. permdock openapi emit --target 3.3writesopenapi: 3.3.0and validates the result against a patch of the 3.2 schema keyed by the draft pin.permdock openapi importaccepts 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 overlaycovers the source document's operations by their ownoperationId, fails on a covered operation without one, and under--checkreports operations whose source already setssecurity.overlay({ operations })takes the same list. Actions are sorted, andinfo.versionis a catalog fingerprint.x-permdock-conditionsandx-permdock-approvalare objects keyed by permission key, as the extension table defines. -
Permission-level custom roles bounded by a ceiling.
CustomRolegainsgrants({ permission, effect? }, no conditions) and an optionalteam;includesis now optional. Every custom role resolves throughresolveCustomRole(policy, role): its included roles' grants plus its own allows, minus its own denies, intersected with the code allows of the declaredassignableroles in its scope. Grants inherit the declared grant's condition, approval and limit, and keys outside the ceiling are dropped and reported byvalidateCustomRoleandpermdock doctorPD023.assignablePermissions({ tenant? })joinsassignableRoles: both intersect the ceiling (narrowed byRoleSource.assignable) with what the subject holds, and a held role or granted permission withmeta.manageRoles: truelifts the intersection. Snapshots carry resolved custom-role grants and a per-tenantassignablelist, read byfromSnapshotand the newuseAssignablePermissionshook (Vue, Solid, React Native;assignablePermissionsstore in Svelte).testRoleSourceaccepts{ policy }to check custom-role grants against the ceiling.Behaviour change: an
includesentry 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, andassignableRoles()now also lists assignable roles whose every allow the subject holds. -
Provisioned roles and plans are bound to their tenant.
directoryMembershipSourcelooks users up with a structuredeqfilter, so a principal id is never parsed as filter syntax. Core drops roles the policy declaresassignable: falsefrommanagedBy: 'idp'memberships, andscimHandlerreports unknown roles onPATCHtoo.subjectFromClerkputso:plans (asentitlements) ando:features on the session organization's membership instead of the principal. -
RLS CLI fixes found by the coverage suite:
rls importmaps= 0and= falseconditions instead of importing them as opaque.rls importtreats onlyauth.jwt()andauth.session()as claim sources;->>on a column or on(select auth.uid())is no longer aprincipal.claim.*reference.- The raw
rls importfallback reads roles,forandas restrictivefrom the policy header only, so awith check (...)or a word insideusingno longer leaks into them. - A malformed
supabase.hook.membershipsentry gets the "takes fromTable / fromJunction sources" error instead of aTypeError. rls generaterefuses any output that namesservice_role, in every target; before, the guard matched onlyto,fromand;forms.
-
Relationship graph additions. An edge relation takes
match(fixed column values, so one table with arolecolumn serves several relations) andgroups(a row may name a group whose members hold the relation, nested at most 16 deep per resource), and any relation may listincludes, the relations that imply it. A resource declareslinks, named to-one references, andrelation(resource, name, { through: ['folder', 'team'] })follows them. A resource role on a self-parented resource reaches the instances below it when arelationssource is present.RelationHoldergains agroupvariant,RelationSource.ancestorstakes a link name asthrough,whoCanreports group shares and implied relations, and RLS compiles all four through thepermitted_<resource>_idshelpers and newpermdock_link_<resource>_<link>helpers. -
Relationship graph. A resource's
parentmay 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 todepthhops (default 16, at most 32);definePolicyrejects athroughgrant that cannot reach its resource or walks amemberOfrelation.Graph grants compile to the new
relatedcondition and are decided through aRelationSource(ancestors,related) passed ascreatePermDock({ relations })(every adapter'screatePermDockforwards it), with answers cached per instance.memoryRelations(permissions, { rows, edges })is the in-process source andtestRelationSourceinpermdock/testingthe 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 pastdepthwith no holder within it, denies with the new reasonrelation-depth; a missing, throwing or unloaded source denies withrelation-unavailable, and a graph deny that cannot be evaluated denies the decision.await permdock.whoCan(permission, row)lists holders and how (role,relation,share) fromMembershipSource.listandRelationSource.related, never grants, and returnscomplete: falsewhenever a grantee cannot be enumerated.Snapshots carry no graph: graph grants, and grants on a relation with a
period, areportable: falsethere, so clients resolve them on the server;where()keeps graph grants asrelatednodes and leaves out only relations with aperiod(partial: true).permdock rls generateemits<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 --dbchecks parity on a generated tree with restricted branches. Catalog resources carryrestrictedand the new relation shapes, and a relation grantee on the wire may carrythroughanddepth.permdock doctorPD031 warns on a self-parent orrestrictedcolumn no graph grant uses, and PD032 errors on a graph resourcerls generatecannot name. The saas domain inpermdock/testinggains 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
permdockpackage 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 aCredential(v1) record and never the key (generateApiKey,parseApiKey). Ausercredential acts as its owner with the owner's live roles and memberships, narrowed to the key's permissions throughdelegation(OAuth scopes, and RFC 9396authorizationDetailswith anidentifierper resource id), so a demoted owner's keys lose the same rights at once. Aservicecredential is akind: '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'sassignableRolesandassignablePermissionsin its tenant, and links, credentials and delegated creators cannot exceed themselves (new denial reasonexceeds-creator). A tenant'scredentialssettings (maxTtl,kinds,approval,allowNoExpiry) come from the newSettingsSource(memorySettings); a violation is the new denial reasoncredential-policy, a key without expiry is refused unless the tenant allows it, andapprovalmakes creationapproval-requiredwith a token bound to the key and its creator.credentialSubject,credentialDelegation,credentialPolicyViolationandparseCredentialare exported.subjectFromApiKey(options)inpermdock/serverreturns aSubjectResolverthat verifies a key through aCredentialVerifier(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 liveowner; any failure is the anonymous subject with anon('auth')cause (malformed,unknown-credential,invalid-claims,expired,credential-policy,credential-revoked,owner-unavailable). Credential changes and sampled uses arecredentialsink events (created,usedwithsample,rotated,revoked) with CloudEvents typedev.permdock.credential, built bycredentialEvent, and decision events name the key insubject.credential.permdock/testingaddstestCredentialVerifierandtestSettingsSource, andpermdock doctorPD029 (--only credentials) flags fixture keys that never expire and tenants that allow them. -
Role ownership and audiences.
role(name, grants, options)takesminandmax(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 typedmeta: RoleMetawithaudience. A role held through a membership kind itsfordoes not list, or through a membership withoutvia, 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 theassignsgraph, the ceiling,for,exclusiveWith,min,maxandtransferOnly, with the new denial reasonslast-holder,max-holders,transfer-only,not-assignable-by,self-demotion,not-allowed-for-membershipandconflicting-role; the snapshot-backed client denies it withunsupported. Once any role declaresassigns,assignableRoles()returns exactly the roles the held roles list, andheldRoles()/assignableRoles()are ranked by the graph.heldRoles({ scope, id })narrows to one scope instance, andpermdock.audiences()andsnapshot.audienceslist the distinct audiences of the roles held in the active tenant.permdock rls generatereads aviacolumn on membership tables, adds a deferred constraint trigger per scope table forminandmax, statement triggers over transition tables fortransferOnly, andpermdock_can_assign(p_role, p_scope_id). Catalog roles carrymin,max,transferOnly,assigns,for,exclusiveWithandaudience.permdock doctorPD026 (--only ownership) warns on a scope whose roles set nomin. -
SCIM discovery follows RFC 7644 section 4:
/Schemasand/ResourceTypesreturn ListResponses, serve one item by id, carrymeta, and refuse afilterwith 403. Every advertised attribute statesmultiValuedandrequired. Created users and groups now get a realmeta.createdtime 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
applyOtelis gone:Before After otel: { logger }otel: (permdock) => withOtel(permdock, { logger }), withwithOtelfrompermdock/otelwebBotAuth: { verify: true, keys }webBotAuth: (request) => verifyWebBotAuth(request, { verify: true, keys }), withverifyWebBotAuthfrom the adapter entry orpermdock/serverOtelWrap(frompermdock/otel) andWebBotAuthVerifier(frompermdock/server) type the two options. A Hono app without either option ships about 1.6 KB gzip less;permdock/nextandpermdock/mcpabout 1.9 and 2.4 KB less.Every outbound request now has a default timeout: JWKS and discovery 5 seconds (
jwksCache.timeoutchanges 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.definePolicyindexes 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: aneqorinon a claim denied what the server granted, and anotIngranted what the server denied.principal.id,tenantand the other fields the snapshot carries stay references. -
Soft and hard quotas.
limitacceptsmode: 'hard' | 'soft'(default'hard', today's behaviour) andalertAt, a fraction ofcountin(0, 1]. A soft limit grants past its count with the obligation{ kind: 'over-limit' };alertAtadds{ kind: 'near-limit' }once usage reaches it. A granted decision under a limit carriesquota: { remaining, resetsAt }(resetsAtin Unix seconds), andobligationswhen one applies. An unreachable store still denies withlimit-unavailablein soft mode.describePolicymatrix cells acceptobligations(the expected kinds). New exported types:GrantLimit,Quota,Obligation. -
Subject attributes in RLS.
permdock rls generatecompiles nested claim refs (principal.claims.attrs.regionbecomes(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 compilesin/notInagainst an array claim to= any (array(select ...)), evaluated once per statement. A grant that readscontext.*is refused with a pointer to the new doctor check PD027 (--only context-refs), or skipped under--skip-closures.rlsParityaccepts subjectclaimsand aneondialect. -
Supabase SQL security and performance:
- Helpers.
rls generateandsupabase hook generateput thesecurity definerhelpers,role_permissions, the closure, break-glass andauthz_versiontables and the hook in a privatepermdockschema the Data API does not expose.authz_version.user_idis auuidthat referencesauth.usersand cascades on delete. - Casts. The helpers, the hook, the ownership triggers, graph SQL and
rls verify --treecompare a membership's user and scope columns uncast and cast the parameter instead, so the column's index applies. authorize(). It honourseffect = 'deny'and membership expiry, and is executable byauthenticatedonly.- 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-glassgrant key. - Generated SQL. It enables row level security before the grants and schema-qualifies every table. The hook reads
app_metadatafrom the event instead ofauth.users. - New
rls generate --splitparts.seedswrites therole_permissionsrows as a versioned migration (--seeds-out).indexeswrites the indexes the policies and helpers filter through.rls verify --introspectwarns about a column no index starts with. - New doctor checks. PD046 to PD053 cover
user_metadatain SQL, definer functions executable byanonorpublic, functions withoutsearch_path,publictables without RLS, unwrappedauth.uid(),updatepolicies withoutwith check, and unindexed foreign keys. PD054 flags stalerole_permissionsseeds. PD028 accounts for Supabase's default privileges and tracksinsertandupdateapart. rls.anonymousSignIns: 'deny'keeps a Supabase anonymous sign-in out of every grant butanyone()'s.exchangeCapabilitysignsES256by default.- Contracts. Every catalog permission carries
rowConditions, which istruewhen the catalog was built without the policy. The claims schema andsupabaseClaims()require a non-emptysubat eachactlevel and acceptmember: { group }, whichsubjectFromSupabasekeeps.
- Helpers.
-
Supabase declarative schemas on pg-delta. With
[experimental.pgdelta] enabled = trueinsupabase/config.toml,permdock rls generate --splitwithout--outwrites pg-delta's per-schema, unnumbered layout underdeclarative_schema_path:permdock/helpers.sql,permdock/indexes.sql,public/policies/permdock.sqlandpermdock/functions/custom_access_token_hook.sql.permdock supabase hook generatewithout--outwrites the same hook path. pg-delta keeps grants, so the hook keeps itssupabase_auth_admingrants. It rejects data in a schema file, so thehelperspart now needs theseedspart with--seeds-out. Doctor PD042 and PD043 are off under pg-delta. The token hook castsuser_idtouuidonce, sosupabase db lintreports no implicit casts. -
Suspension in generated RLS, and a token hook that writes memberships.
rls.suspension(also asupabaseRlsandauthorizeSqloption) names a users table and a table per scope, each{ table, id, disabledAt?, status?, active? }.permdock_has, everypermitted_<scope>_idsandauthorize()then drop a suspended user's roles and every membership whose instance or ancestor instance is suspended. The check runs live indatabaseandjwtmode, and a missing status row counts as suspended.generatefails on a suspension entry with an undeclared scope, nodisabledAtorstatus, astatuswithoutactive, or a nested membership table without the ancestor column it needs.In
jwtmode,permdock rls generate --rbac supabasenow emits acustom_access_token_hookthat also writes the canonicalmembershipsclaim ({ scope, id, within?, roles, via?, expiresAt? }) from everyrls.memberships.scopestable. It leaves out expired and suspended entries, gives a suspended useruser_role: []andmemberships: [], and grantssupabase_auth_adminread access to the tables it reads.supabaseRls({ memberships })acceptsscopes, andSupabaseMembershipTableacceptscolumns, likeRlsMembershipTable. -
The OCSF projections now match OCSF 1.3.0.
accessToOcsfuses Account Change activity 2 (Enable) forstartedand 5 (Disable) forendedandrevoked, instead of 1 (Create) and 4 (Password Reset), and sets the requiredtype_uid.toOcsfalways sets the requireduser, as{ name: 'anonymous' }for an anonymous subject. -
The SQL helpers have a written contract:
permdock_has,permitted_<scope>_idsandpermitted_<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.jsonin the package is the JSON Schema of the claims the hook writes and the helpers andsubjectFromSupabaseread. The Supabase page adds a "With better-supabase" split of what each package owns. -
The SSF receiver looks up
onEventhandlers by own key only. An event named after anObject.prototypemember, such astoString, 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,viaand expiry columns or fixed values),rls(helper schema,jwtordatabasemode, tenant claim, scope id types, and each helper's arguments, return type andexecuteroles),decidingColumns(everyschema.table.columna membership or anattrsclaim is computed from, the same set PD028 checks) andmarkers({ hook: 'v1', grants: 'v1' }), plus$schema. Its JSON Schema ships asschemas/supabase-manifest-v1.json.permdock supabase inspect --out permdock.manifest.jsonwrites it, and--checkexits 1 when the file's JSON differs.inspect --outused to override the hook path; the path now always comes fromsupabase.hook.out.fromTableandfromJunctionexpose their entry assql.manifest. -
The Supabase manifest's
rlssection has amembershipslist of the tablesmember_<scope>_ids_forreads, in the same shape as the hook'smemberships. It names therls.membershipstable mapped for each scope, else therls.membershipSourcesthat 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 bumpsauthz_veronce for each listed user. A trigger on a table the hook does not read, such as better-supabase'sentitlement_members, can now invalidate its users' tokens. The function issecurity definer, and no client role may execute it. The membership triggers now call it. The manifest names it inauthzVersionBumpwhenauthzVersionis true. -
The
cloud()sink bounds its re-queue while the Cloud is unreachable (capacity, default 10 000, oldest dropped first), matchingmemorySink. -
The
permdockCLI parses flags with citty.permdock <command> --help(orpermdock help <command>) prints that command's flags with their values and defaults. A flag with a fixed set of values rejects any other with exit2and the list it accepts, for examplecatalog: 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 thepathsaliases of the nearesttsconfig.json.--checkoncollect,openapi,rls generateandsupabase hook generateprints 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 installwithout--agentasks which agents to install for, anddoctor --fixasks before writing. In CI, in a pipe or with--jsonthere is no prompt.doctorreports are styled on a colour terminal;NO_COLORand--no-colorturn styling off.supabase/config.tomlis read with a TOML parser, and the newPD045warning reports a file that does not parse.The CLI's new dependencies are
citty,jiti,smol-toml,package-manager-detector,@clack/promptsanddiff. Runtime entries still depend on@standard-schema/speconly. -
The
permdockCLI starts faster and reports failures in a form scripts can read.permdock --version(-v) prints the version.--helpprints 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, withtypehttps://permdock.dev/problems/cli-usageorcli-unavailable. - A database that does not answer exits with
1, not2, and names the command.--dbconnections time out after 10 seconds and statements after 60.rls introspectruns its queries in parallel over a pool of four. Ctrl-C ends the connection and exits with130. - Generated SQL, catalogs and
who-canoutput sort by code unit, so the same input gives the same bytes in every locale and runtime.
-
The
permdockskill names the docs MCP toolssearch,list_pagesandget_page, the tools the docs server at/mcpnow exposes. -
The
subjectoption ofpermdock/serverand every adapter built on it is now typed to return a fullSubjectornullas well as the policy's user, matching what the kernel already accepted at runtime. -
The bundled Agent Skills are renamed
permdock-wireandpermdock-audit, and six skills join them:permdock, a general skill that routes to the others, pluspermdock-agents,permdock-approvals,permdock-tenancy,permdock-dataandpermdock-credentials.permdock skills installcopies all eight, andpermdock doctor(PD005) looks for thepermdockskill. -
The catalog,
permdock rlsandpermdock doctornow call Standard JSON Schema'sjsonSchema.outputwith{ 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, andsupabase hook generate --checknames the marker fields that drifted.permdock supabase inspect [--json]prints theversion: 1manifest of the hook and SQL helpers (helper names, tenant claim, budget and its measure, claims written,authz_ver);permdock/supabaseexports theSupabaseHookManifesttype andpermdock/testingexportssupabaseHookManifestFixture. -
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-permdockandaudit-permissionsskills declarelicense: MITandmetadata(author,homepage,repository) in their frontmatter, and the repository exposes them to Claude Code as thepermdockplugin in.claude-plugin/marketplace.json. -
The package carries the
tanstack-intentkeyword. Internal non-null assertions andanyflows in the core, conditions, CLI and adapters are replaced with checked narrowing; the PDP adapters' granted decision now fails closed withanonymouswhen a subject has no principal instead of asserting one. -
The test runners move into
permdock:@permdock/testingis now thepermdock/testingsubpath, withpermdock/testing/saasandpermdock/testing/saas/permissions. Vitest is an optional peer, and no application entry imports the testing entries. Import frompermdock/testingand drop the@permdock/testingdev dependency;permdockis the only package name. -
Tokens are bound to their issuer and audience.
subjectFromJwtrequiresissuerwith any remotejwks(a URL as well as a key set).joseTokenVerifierandpermdock/ssftake the issuer fromdiscoverywhen none is set and check every token against it.subjectFromIntrospectionrequiresaudto contain the configuredaudience, rejects a differingiss, and no longer fillsprincipal.issuerfrom the options.scimHandlerno longer derives the audience from the request URL and throws whenverifieris set withoutaudience. -
PermDockDeniedErrorandPermDockApprovalRequiredErrorcarry a stabledigest(PERMDOCK_DENIED;<permission>andPERMDOCK_APPROVAL_REQUIRED;<permission>;<token>), the property React keeps when an error crosses from a Server Component to the client, andparsePermDockDigestreads it. The newpermdock/next/cliententry exportsPermissionBoundary, an error boundary built oncatchErrorfromnext/errorthat renders itsdeniedorapprovalfallback for a thrown PermDock error and lets every other error through, andusePermissionBoundary(), which gives a fallback the permission, the approval token andretry(). -
RateLimitandRateLimit-Policynow 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().approvalsimplementscancel(filter, meta)overPOST /v1/environments/:env/approvals/cancel, so session revocation rejects pending Cloud approvals in one call. -
cloud().policies.refresh()verifies thepermdock-policy+jwtagainst the Cloud environment URL (issandaudare<PERMDOCK_CLOUD_URL>/v1/environments/<env>;expis 24 hours after issue). Theaudienceoption is removed.cloud()exposes the environment URL asissuer,jwksis the environment's JWK Set URL, andcloudEndpoints()resolves both without a key. The policy JWS fixture inpermdock/testingfollows the new claims. -
cloud().snapshots.get()requestsapplication/jwtand returns only a compactpermdock-snapshot+jwt; an unsigned snapshot body now throws instead of being parsed. -
createPermDockfreezes 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'salternativesat thenowyou pass, not the wall clock. With a pinnednowand no sink oron()listener, a check reads no clock at all, so it runs in a prerendered React Server Component or Client Component undercacheComponents. -
definePermissions(tree, { renamed })maps former permission keys to current ones: stored custom roles, OAuth scopes, AuthZEN actions, hosted grants andfindPermissionaccept the old key, while decisions and audit see only the new one. The catalog listsrenamedFrom,permdock diffreportsrenamed(not breaking) andalias-removed(breaking),rls generateseedsrole_permissionsunder former keys too andpermdock_custom_keysreads a stored former key as its current key,rls generate --shimsadds wrappers under legacy helper names, andpermdock doctorPD055 and PD056 report what still uses an old key or helper. -
definePolicytakesdelegations: standing statements that holders offrom(a role,authenticated(), a plan orassurance()) let actors matchingto(actor('eve'), an actor kind, or{ kind, id }for one agent) usepermissionsfor them, with optionalvalidFrom/validUntil. Each is normalised to{ from, to, permissions: string[], validity? }onpolicy.delegations, is part of the fingerprint, and is listed in the catalog's newdelegationssection;permdock diffreports a removed one asdelegation-removedand one that lost permission keys or validity asdelegation-narrowed. Indecide, the matching delegations form a ceiling for the actor: a permission outside it isnot-delegated, inside it a tokendelegationon the call must still cover, and the principal's grants, conditions, denies and approvals apply first as before. The snapshot carries the ceiling asdelegatedand the client evaluator applies it.delegatedPermissionsis exported frompermdock. -
dev.permdock.catalogdrift findings are typedCatalogFindingobjects{ code, permission, grant? }withcodeone ofpermission-removed,not-hostable,grantee-removedorapproval-tightened;parseCloudEventandverifyWebhookreject the earlier free-text strings. -
endpoint: falseoncreatePermDockfrompermdock/next, itsPermDockProviderand thepermdock/reactprovider 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 reasonserver-only. The provider logs the first such permission once. The same reason replacesopaque-conditionwhenever the client store has no endpoint.permdock doctorPD044 warns whenusePermissionreads such a grant and the app has neither anapp/**/api/permdock/route.tsusingpermdockHandlernor anendpoint. The Next.js Cache Components guide adds URL slugs (a public slug lookup ahead of the private snapshot,notFound()andforbidden()), snapshot-only mode, and a cross-origin endpoint section. -
isPermission(value)is exported frompermdock: it narrows anunknownsuch as an MCP tool'smetatoPermissionwithout a cast, and accepts a leaf that crossed JSON.permdock/cliexportsparseHookMarker(sql)andparseGrantsMarker(sql), which read the first line of a generated hook or--grants-outmigration. -
mayUse(permdock, permission)is exported frompermdock. It answers whether some grant in the instance's snapshot could match for its subject, active tenant and delegation, and is the listing hintpermdock/mcpandpermdock/a2aalready use. An MCP server thatprotectServercannot wrap, such as better-supabasecreateMcp, filters its tool list with it and decides each call withdecide;adapters/mcp.mdxhas the recipe. -
membershipsink events name the scope instance the way memberships do (breaking).MembershipEventdropstenantandteamforscope,idandwithin, and gainsexpiresAt, 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 aTypeErrorwhenscopeandidare not given together, orwithinhas noscope. SCIM group changes emit{ scope: 'tenant', id }, and Better AuthonRoleChange({ sink })emits{ scope: 'team', id, within: { tenant } }for a team role. The format staysv1. -
permdock collectandpermdock doctorno longer crash withCannot read properties of nullon a source file with array holes (const [, , id] = parts). Doctor PD010 and PD014 ignore comments, and PD014 no longer reads aconst jwks: JSONWebKeySetdeclaration as ajwksoption without an issuer. -
permdock diff a bcompares two policies or catalogs (apermissions.catalog.jsonor a module exportingpolicy) and lists the permissions, scopes, roles and grants that changed. It exits1on a breaking change: a removed permission, scope, role or allow, a narrowed allow (new or changedwhere/check, new approval, fewer fields, shorter validity, new limit), or a new or changed deny.--impactruns therls verifyfixtures through both policies and reports who loses or gains what; a lost grant is breaking.--jsonprints the report. The catalog gains agrantssection listing every code grant in canonical order when built with the policy;CatalogGrantandCatalogValidityare exported frompermdock/catalog. -
permdock doctorPD002 andpermdock collectno 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 doctoradds two Supabase checks. PD040 warns onauth.role()in a migration, which Supabase deprecated; name the policy's roles withto authenticatedinstead. PD041 warns whenexchangeCapabilitysigns withalg: 'HS256', the project's shared JWT secret; sign withES256and an asymmetric signing key. -
permdock doctorwithout--fixandpermdock usageno longer writepermissions.catalog.json. PD002, PD044 andusagescanned the sources through a fullcollect, 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 theusagepage already said. -
permdock rls generate --rbac supabaseno longer emitscustom_access_token_hook:permdock supabase hook generateis the one generator of the token hook, so a single function writesuser_role,membershipsand the other claims. The scaffold keeps the enums,user_roles,role_permissions, the helpers andauthorize(). -
permdock rls generate --split helpers,policies,hook --out <dir>/056_permdock_{part}.sqlwrites one file per part for Supabase declarative schemas, and--grants-out <file>(or-to print) moves the token hook'ssupabase_auth_admingrants, execute revoke and read policies into a migration of their own, sincesupabase db diffdrops them.permdock supabase hook generatetakes the same--grants-out.--checkcompares every part and the grants file and names the part that drifted. Doctor adds PD042 (error: the hook is declared undersupabase/schemasand no migration from the one that creates it on grants it tosupabase_auth_admin) and PD043 (warning:schema_pathsapplies a file that calls the helpers before the helpers part), anddoctor.migrationsnow defaults tosupabase/schemastoo. -
permdock rls generate --target drizzlewritespgPolicy(...).link(schema.<table>)exports with thedrizzle-orm/supabaseroles, and--target prismawrites Prisma 8policy_*blocks and refuses deny grants, which Prisma 8 cannot express. Both targets also write<out>.migration.sqlwith the helpers, grants andenable row level security, and--checkcompares both files.rls.drizzle.schema,rls.drizzle.exportsandrls.prisma.modelsset import paths and names. -
permdock rls generateapplies a role'sforto resource-role and nested-scope membership tables too: theexistscheck counts a membership only when itsviacolumn lists an allowed kind, and a table without aviacolumn holds such a role for nothing, matchingdecide. -
permdock rls generatecompiles role checks to per-statement helpers. Policies callpermdock_has('<grant key>')for global roles and"<tenant col>" in (select permitted_tenant_ids('<grant key>'))(orpermitted_team_ids) for scoped roles:security definer,search_path = ''SQL functions over a seededrole_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|jwtnow 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-rolekeeps the per-role layout and--policy-namesets a template. The tenant claim is cast to--tenant-type(defaultuuid). Top-leveldefinePolicy({ grants })compile too, and a grantee Postgres cannot see fails with the permission named.--rbac supabasebuilds on the same helpers;authorizeSqlreads the sharedrole_permissions.rls importreads both layouts back to roles andmemberOf,rls verifypasses roles and memberships in the claims and inserts whole rows, andrlsParitysets the role and memberships GUCs. -
permdock rls generatecompiles two more rules.deny(permission, { to: actor('oauth-client') })becomes a RESTRICTIVE policy that refuses rows while the token carriesclient_idoract, so a third-party app's Supabase token stops where the in-processdecidestops it.containson a column the resource schema types as an array compiles tovalue = any(column), cast to the item type, instead ofLIKEover the column's text. -
permdock rls generateemitsmember_<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". Indatabasemode the helpers read thefromTable/fromJunctionsources in the newrls.membershipSources(defaultsupabase.hook.memberships) for every scoperls.membershipsmaps no table for, so the helpers, the token hook and the application'sMembershipSourcerun the same SQL.rls importreadscol in (select member_<scope>_ids())back as amemberOfwith no roles, and the hook manifest lists the new helpers. -
permdock rls generatefollows the Postgres and Splinter rules its docs cite:- One permissive policy per table, command and database role.
anyone()grants are ORed into theauthenticatedpolicy and get their ownTO anonpolicy, so Splinter'smultiple_permissive_policieslint stays quiet. - The
neondialect targets Neon'sanonymousrole instead ofanon. - The
gucdialect wrapscurrent_setting(...)in(select ...), so each setting is read once per statement. rls importreads the wrapped form back.
- One permissive policy per table, command and database role.
-
permdock rls generateon Supabase writesmember_<scope>_ids_for(p_user uuid)for each scope with a membership source (rls.membershipSourcesorsupabase.hook.memberships) or a mappedrls.membershipstable. It answers whatmember_<scope>_ids()answers, forp_user, from the membership tables, with the same expiry and suspension rules, so asupabase.hook.claimsfunction can read the user's scopes before a token exists.executeis revoked frompublic,anonandauthenticated. Withsupabase.hook.claimsset,permdock supabase hook generategrants it tosupabase_auth_admin(in the--grants-outfile when given), and the hook manifest and PD039 list themember_<scope>_idsandmember_<scope>_ids_forhelpers. -
permdock rls generatereadsrls.dialectfrom the config, aspermdock rls verifydoes;--dialectstill overrides it. It used to fall back tosupabasewhenever--dialectwas absent, so aneonorgucconfig silently produced Supabase SQL. An invalidrls.dialectnow exits 2 like an invalid flag. -
permdock rls generateskips every grant that requires an approval. It skipped onlyapproval: 'human', so anapproval: { 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 increate policyandalter policystatements ontopermitted_<scope>_ids,permdock_hasandmember_<scope>_ids, as configured inrls.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(orrls.helpersOnly) writes only the helpers, seeds and scaffold, andrls verify --introspectwith it diffs the helpers androle_permissionsseeds 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 whatrls generatewould write: policies (by name, command, permissive or restrictive, and roles), row level security on each table, theanonandauthenticatedgrants, and whether each helper is stillsecurity definerwithsearch_path = ''. It prints one line per difference and exits1, so a hand-written permissive policy or a missing grant shows up before a user finds it. -
permdock rls verify --treefills the required columns its generated rows leave out, so it runs on tables with aNOT NULLtenant 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 generategrantssupabase_auth_adminusage on the schema of every table it reads outside the hook's schema, so a schema-qualified source such asfromJunction({ table: 'better_supabase.memberships', … })works without a hand-written grant. -
permdock supabase hook generatewarns with PD039 when the helper schema has no generatedpermdock_hasorpermitted_<scope>_ids(read fromrls.outand the migration folders, or the database with the new--dbflag).permdock doctorPD039 reports the same and, with adoctor.claimsfixture of sample tokens, eachsupabase.hook.claimsentry larger than the memberships budget. -
permdock supabase inspect --outwith no path writespermdock.manifest.json, andinspect --checkwithout--outchecks that file instead of exiting 2. Thedatetime_preferencesclaim insupabaseClaimFixtures.fullnow uses CentraKit's keys:timezone,week_start,date_formatandtime_format. -
permdock.explain(permission, data)(ordecidewithexplain: true) returns the decision with atrace: 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.MatchedGrantcarries the grant'sname; adenydenial from a named deny carriesdetail: { name }.describePolicycells takedeniedBy. The trace is off by default and never emitted on a decision event. -
permdock/a2aemits Agent Cards in the A2A 1.0 wire form, and the cards validate against the publisheda2a.json. The card URL moves intosupportedInterfaces, security schemes use the one-of form (oauth2SecurityScheme), skill requirements become{ schemes: { name: { list } } }, and skills carrytags. The card also fillsdescription,capabilitiesand the default input and output modes.securitySchemeskeeps its OpenAPI-style input with a typedtype.sign(card, signPayload)now returns the card with a detached RFC 8785 JWS appended tosignatures, instead of{ card, signature }. -
permdock/authzenfollows more of AuthZEN 1.0:- Every response echoes
X-Request-ID. /access/v1/evaluationshonoursoptions.evaluations_semantic, and treats a request without anevaluationsarray as a single evaluation.- Discovery under
/.well-known/authzen-configuration/<path>names the path-qualified PDP identifier. - Search accepts
page.limitand returnspage.countandpage.total. - Subject search answers only for the
usersubject type.
- Every response echoes
-
permdock/evefollows eve 0.70:approval.responsereads the responder fromctx.response.principal, and a Cancel from an eligible responder records the approval asrejected, so the re-check denies.permdock/drizzleaccepts drizzle-orm 1.0 release candidates next to 0.40 and later, and recognises 1.0 array columns (dimensions) forcontains. The@supabase/middlewarepeer range is now>=1. -
permdock/jwtandpermdock/supabasenow take the outermost RFC 8693act.subas the actor. RFC 8693 section 4.1 makes that the current actor and says prior actors in nestedactclaims must not decide access; before, the innermost (oldest) actor was used. Every level of the chain must carry a non-empty stringsub, or the subject is anonymous with causeinvalid-chain. The full chain stays ondelegation.chain. -
permdock/jwtfollows OpenID Connect more closely. Discovery never fetches anhttp:jwks_uri, and an inlinemetadata.jwks_urioverhttp:is a configuration error. Withaccept: 'id-token', an ID token needsiat, needsazpwhen it has several audiences, and itsazpmust be the client id whenever present. The OpenID Connect Core section 5.1 profile claims (email,name,pictureand the rest) no longer reachprincipal.claims.claims.membershipsnow flattens Zitadel'srole -> { orgId: domain }project roles into one membership per organisation. -
permdock/mcpfollows the 2026-07-28 specification more closely. A missing scope is challenged with the scope the call needs plusresource_metadata, not the held scopes plus the missing one;permdock/a2aand HTTP challenges use the same builder.approval-requiredbecomes a multi-round-tripinput_requiredresult with a URL-mode elicitation and the approval token asrequestStatewhenapproval.atis set and the client declares URL elicitation, and theelicitationhint is gone from MCP and WebMCP refusals.stepUp: { at }does the same forinsufficient-user-authentication, withacr_valuesandmax_agefrom the failingassurancegrants, which a denial now carries into. Aresourceoption refuses tokens issued for another RFC 8707 audience.ActionMetagainsdestructiveandidempotent; tool annotations the author leaves out are filled from the permission, andcrud()marksdeletewithdestructive: trueinstead oftags: ['destructive']. The unusedInsufficientScopeErrorexport is removed. -
permdock/mcp:createPermDockandsubjectFromMcpnow read RFC 9396 authorization details from bothauthInfo.extra.authorizationDetailsand the raw claim nameauthorization_details. Before, each read only one of the two, so the same verifier output lost its details in one of them. -
permdock/nexttargets Next.js 16.3 (thenextpeer range is now>=16.3).createPermDockalso returnsrequireAccess({ permission, data?, tenant? }), which resolves to the grantedDecisionand interrupts a denial withunauthorized()for an anonymous subject orforbidden()otherwise (experimental.authInterrupts); approval-required and boundary validation still throwPermDockApprovalRequiredErrorandPermDockValidationError. The request-scoped instance is created afterawait 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 wayconnection()would. Aredirect(),notFound()or other Next.js interrupt thrown by thesubjectortenantresolver now propagates (unstable_rethrow) instead of turning the request anonymous. Sink writes and oneflush()per render run insideafter(), so a serverless function stays alive until buffered decision events are delivered. -
permdock/openapimarks an operation withx-permdock-approval(and the optionalx-badgeshint) for every grant that requires an approval. It marked onlyapproval: 'human', soapproval: { by },{ distinct: false }and{ staleOn }grants looked approval-free in the description. -
permdock/supabaseexportsactorOf(claims)anddelegationOf(claims), the rulessubjectFromSupabaseuses for the acting app:actorOfreturns{ ok: true, actor? }with the innermostactsub(orclient_id) and a frozen copy of the chain, or{ ok: false, reason: 'invalid-chain' }, which must deny;delegationOfreturns thescopeclaim as{ scopes }.supabaseClaimFixturesentries now state the expectedactoranddelegation. -
permdock/supabaseexportssupabaseClaims({ tenantClaim? }), a Standard Schema v1 object for the hook's claim contract, and its typesSupabaseClaimsandSupabaseMembershipClaim;.extend(appSchema)merges a Zod, valibot or other Standard Schema over it, so a session library validates tokens without copying the shape.subjectFromSupabasenow readsgrantedByandreasonon memberships,supabase-claims-v1.jsoncoversapp_metadata,client_id,scopeandact, andsupabaseClaimFixturesaddsfull,portalContact,oauthClientandactChain. -
permdock/supabaseexportssupabaseTenantClaim(tenant_id), the one default the hook,subjectFromSupabase,supabaseRls,rls generate,rls verifyandrlsParityshare.permdock doctorPD038 warns when asubjectFromSupabaseorsubjectFromSupabaseSessioncall reads the tenant from a different claim thanrls.tenantClaim. -
permdock/supabasereadsact.kindas better-supabase 0.5.1 writes it:supportbecomes actor kindsupportwithsessionIdandreadOnly, andimpersonationbecomes actor kindimpersonation. Neither carries a delegation, so they reach only what a policy delegation names. An actor withreadOnly: truegets only the read-only permissions of each policy delegation (readOnlyonpolicy.delegations); other permissions deny withnot-delegated, andmayUsefollows the policy delegation ceiling. An unknownkind, or a support level withoutsession_id, is the anonymous subject.supabaseClaims()andsupabase-claims-v1.jsonvalidate the newactfields. -
permdock/terminalasks for the resource id to be typed before running adestructivepermission (replace the prompt withinteractive: { typed }), and without a terminal exits with the newEX_USAGE(64) unless--yesor-yis passed or theyesoption is set.--dry-run(ordryRun: true) decides as a simulation, prints the decision and exits with its code without running the action or consuming a limit. Theci-oidctoken source takes{ source: 'ci-oidc', audience }to request a GitHub Actions audience and{ source: 'ci-oidc', env }to read a GitLabid_tokensvariable.permdock/jwtaddssubjectFromCiOidc(token, { provider, audience, issuer?, schema? })for GitHub Actions, GitLab CI and Buildkite tokens, returning aworkloadprincipal withrepository,refandenvironment, never a user. -
permdock/terminal: a network failure during the device flow now ends thedevicetoken source with no credential, so the chain moves on to the next source, the same as a failed refresh or revocation. Before, the thrownfetcherror escaped the command. -
permdock/testing/saasadds 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-1againsttenant-1on lists and writes, and an expired membership on every permission class. Scenarios may carryactor,delegationandquotaUsed;saasUser,saasScenarioOptionsandsaasLimitStorebuild the subject and options a case runs with. -
permdock/webmcpnow validates instance-tool arguments against the resource schema whenregisterToolsis given a resource node such aspermissions.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 explicitschemaoption now overrides it. -
receiver.pollreports polled SETs that can never verify under RFC 8936setErrsin the acknowledgement request, so a transmitter stops redelivering them. A SET whose handler failed is still left pending for redelivery. -
resource()takesnamefor a resource name apart from its path, action metadata takesmeta.xfor application-owned JSON,rls.actionsmaps action verbs such asviewto SQL commands (or'none'), anddescribe(decision, { messages })localises titles and details. -
scimHandleranddirectoryMembershipSourcereadgroupRolesby own key only. A group id such asconstructoror__proto__no longer resolves to anObject.prototypemember, which made the SCIM endpoint answer 500. -
sender: 'dpop'(theprofile: 'fapi2'default) now resolves the anonymous subject withdpop-proof-invalidwhen noRequestis passed, instead of skipping the proof.verifyDpopProofrefuses a symmetricalgand ajwkheader carrying private key members, per RFC 9449 section 4.3. -
simulate()no longer throws on an Arazzo step whoseparametersarray holdsnullor a non-object. It skips those items and decides the step as usual. -
snapshotTag(sub)frompermdock/nextreturns the cache tag for a user's snapshot entries (permdock:<sub>, orpermdock:anonwithout 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',stalecapped by both the session andcacheLifeFor(snapshot), andbs.invalidateSession(sub, { tags: [snapshotTag(sub)] })after a role change. Its URL-slug loader now takes the org id and never callsnotFound()inside the private cache. The newapps/examples/next-better-supabaseruns that recipe in snapshot-only mode against Postgres in testcontainers.permdock doctorPD014 now accepts a shorthandissuerproperty next tojwks. -
subjectFromSupabaseandsubjectFromSupabaseSessiontakeanonymousSignIns: 'deny', which maps asignInAnonymously()token (is_anonymous: true) to the anonymous subject, asrls.anonymousSignIns: 'deny'does in RLS.permdock doctorPD057 warns whenrls.anonymousSignInsis'deny'and a subject call does not pass the option. -
subjectFromSupabasemaps more of the token.plans: '<claim>'reads the active tenant's entry of a per-tenant plans claim (better-supabase'sfeatures) intoprincipal.plans.actand the OAuthclient_idof a third-party app become anoauth-clientactor withscopeasdelegation.scopes, so such a token only reaches what its scopes delegate. Amembershipsentry the reader cannot use is still dropped, and now reportsmembership-droppedto the newonAuthoption;permdock doctorPD039 lists those entries from thedoctor.claimssamples.supabaseClaimFixtures.betterSupabaseis the canonical claim set better-supabase 0.4 emits. -
supabase.hook.claimsadds 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 jsonbfunction;nullleaves the claim out.permdock supabase hook generaterefuses a claim name PermDock or Supabase Auth writes (roles,memberships, the tenant claim,sub,roleand the rest) and an unqualified function, grantssupabase_auth_adminexecuteon each function, keeps the claims outside the memberships budget, and writes none of them for a suspended user. -
supabaseClaimFixturesinpermdock/testingaddssupportSession,supportSessionReadOnly,impersonationandanonymousSignIn, and each fixture states the actor and delegation it maps to. -
supportAccess()now type-checks insidedefinePolicy({ roles })when the policy's scopes are literal: it returnsRoleBinding<S>foron: SandRoleBinding<'tenant'>withouton, the scope it defaults to. -
webBotAuthtakes anowclock in Unix seconds for thecreatedandexpireschecks, so the RFC 9421 Appendix B vectors and replayed captures can be verified.