Skip to content

Commit 042578c

Browse files
committed
docs(owner): distinguish safe SET from ADMIN-delegated authority
1 parent eab6bbf commit 042578c

1 file changed

Lines changed: 24 additions & 18 deletions

File tree

CLAUDE.md

Lines changed: 24 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -23,24 +23,30 @@
2323
closure, plus table- or column-level `SELECT WITH GRANT OPTION` and
2424
`INSERT WITH GRANT OPTION`. Outbox `MAINTAIN` is also forbidden: PostgreSQL
2525
defines it as relation-wide authority for maintenance operations including
26-
`LOCK TABLE`, not application `SELECT`/`INSERT` DML. A session identity with
27-
membership `ADMIN OPTION` over a role that directly/inheritedly carries outbox
28-
`SELECT`/`INSERT`/`MAINTAIN`, or that can reach such authority through an
29-
all-`SET TRUE` membership path, is also rejected. Callable non-system-schema
30-
`SECURITY DEFINER` routines are rejected when their owner can directly
31-
reintroduce forbidden authority through superuser, `CREATEROLE`, `REPLICATION`,
32-
RLS-bypass status, exact or inherited table ownership, grant options,
33-
`MAINTAIN`, `TRUNCATE`, `DELETE`, `UPDATE`, `REFERENCES`, or `TRIGGER`; they are
34-
also rejected when the owner can use membership `ADMIN OPTION` to redistribute
35-
a role that directly, or through an all-`SET TRUE` path, carries the forbidden
36-
runtime/operator envelope including `CREATEDB` or `MAINTAIN`. That executable-
37-
principal check is transitive: once a caller can enter a user-schema
38-
`SECURITY DEFINER`, admission must recursively follow any further user-schema
39-
`SECURITY DEFINER` that the discovered owner can execute through schema `USAGE`
40-
plus routine `EXECUTE`, using a cycle-safe owner closure. Every callable routine
41-
in that closure must also pin routine-level `search_path = pg_catalog, pg_temp`;
42-
absent or different name-resolution authority is rejected before tenant binding
43-
or outbox data SQL rather than inheriting caller temporary-schema state. The
26+
`LOCK TABLE`, not application `SELECT`/`INSERT` DML. A pure `SET TRUE` path
27+
does not mint membership: the intended non-grantable outbox `SELECT`/`INSERT`
28+
of an ordinary SET-selectable forced-RLS application role remains valid. The
29+
delegated-DML envelope starts only once an `ADMIN OPTION` edge has been crossed
30+
and that ADMIN-bearing state must then propagate recursively through later
31+
`SET` or `ADMIN` edges. A session identity with membership `ADMIN OPTION` over
32+
a role that directly/inheritedly carries outbox `SELECT`/`INSERT`/`MAINTAIN`,
33+
or that can reach such authority through later `SET`/`ADMIN` membership edges,
34+
is rejected. Callable non-system-schema `SECURITY DEFINER` routines are
35+
rejected when their owner can directly reintroduce forbidden authority through
36+
superuser, `CREATEROLE`, `REPLICATION`, RLS-bypass status, exact or inherited
37+
table ownership, grant options, `MAINTAIN`, `TRUNCATE`, `DELETE`, `UPDATE`,
38+
`REFERENCES`, or `TRIGGER`; they are also rejected when the owner can use
39+
membership `ADMIN OPTION` to redistribute a role that directly, or through a
40+
recursively mixed `SET`/`ADMIN` path, carries the forbidden runtime/operator
41+
envelope including `CREATEDB` or `MAINTAIN`. Do not bound that delegated-definer
42+
proof to one administered role plus one all-SET layer. That executable-principal
43+
check is transitive: once a caller can enter a user-schema `SECURITY DEFINER`,
44+
admission must recursively follow any further user-schema `SECURITY DEFINER`
45+
that the discovered owner can execute through schema `USAGE` plus routine
46+
`EXECUTE`, using a cycle-safe owner closure. Every callable routine in that
47+
closure must also pin routine-level `search_path = pg_catalog, pg_temp`; absent
48+
or different name-resolution authority is rejected before tenant binding or
49+
outbox data SQL rather than inheriting caller temporary-schema state. The
4450
discovered definer owner must also pass the same reachable ordinary-view,
4551
materialized-copy, inheritance/partition, and opaque foreign-data authority probe
4652
as a runtime principal. A caller's missing direct foreign-table `SELECT` is not

0 commit comments

Comments
 (0)