Skip to content

Commit ef84694

Browse files
committed
docs(security): state privileged view authority
1 parent 3f5b0d2 commit ef84694

1 file changed

Lines changed: 18 additions & 11 deletions

File tree

AGENTS.md

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,18 @@ add CODEOWNERS-based merge gates until multiple independent maintainers exist.
5656
visibility. Every callable routine in that closure must also pin its routine-level
5757
`search_path = pg_catalog, pg_temp`; absent or different name-resolution authority
5858
is rejected before tenant binding or outbox data SQL, rather than trusting caller
59-
temporary-schema state or unqualified user-schema objects. PostgreSQL permits a
60-
role administrator to grant the administered role to a new principal even when
61-
the administrator's own membership is `INHERIT FALSE, SET FALSE`; the new
62-
principal can then use the granted role's selectable path after the definer
63-
returns. `SECURITY DEFINER` similarly executes with its owner's privileges, so a
64-
safe outer owner does not make a privileged nested definer safe. Direct runtime
59+
temporary-schema state or unqualified user-schema objects. Caller-selectable
60+
ordinary views that directly depend on the lifecycle outbox are also outside the
61+
runtime envelope when they are not `security_invoker=true` and their owner is a
62+
superuser or `BYPASSRLS` principal with outbox read authority. PostgreSQL otherwise
63+
applies the view owner's permissions and RLS policies to the underlying relation,
64+
so such a view can expose cross-tenant rows even when the runtime caller itself is
65+
`NOBYPASSRLS`; reject that authority before tenant binding or outbox data SQL.
66+
PostgreSQL permits a role administrator to grant the administered role to a new
67+
principal even when the administrator's own membership is `INHERIT FALSE, SET
68+
FALSE`; the new principal can then use the granted role's selectable path after the
69+
definer returns. `SECURITY DEFINER` similarly executes with its owner's privileges,
70+
so a safe outer owner does not make a privileged nested definer safe. Direct runtime
6571
`CREATEDB` and `CREATEROLE` are database/role administration capabilities outside
6672
an application identity; callable `CREATEROLE` is rejected because it is
6773
executable within the definer boundary, while `CREATEDB` remains covered when
@@ -80,17 +86,18 @@ add CODEOWNERS-based merge gates until multiple independent maintainers exist.
8086
parser-normalized `USING`/`WITH CHECK` predicates and allowed catalog dependencies,
8187
and the complete effective/session-selectable authority envelope before tenant
8288
binding or outbox data SQL. A migration success record is point-in-time evidence
83-
and does not authorize later same-name policy, ACL, membership, routine, or
89+
and does not authorize later same-name policy, ACL, membership, routine, view, or
8490
role-authority drift. The normal runtime role needs only non-grantable `SELECT`
8591
and `INSERT` on the outbox. Replay serialization must use transaction-scoped
8692
advisory locking on the validated tenant/event identity rather than `SELECT ...
8793
FOR UPDATE`, so serialization never requires ambient row-mutation authority. Do
8894
not authenticate runtime connections as a database creator, role administrator,
8995
replication identity, relation maintainer, DML delegator, privileged definer
90-
gateway, or other administrator and rely on `SET ROLE` or `SET SESSION
91-
AUTHORIZATION` as a downgrade; administrative, replication, maintenance,
92-
grant-capable, membership-delegating, executable-privileged, and owner-capable
93-
login sessions are outside the application isolation guarantee.
96+
gateway, privileged-view gateway, or other administrator and rely on `SET ROLE` or
97+
`SET SESSION AUTHORIZATION` as a downgrade; administrative, replication,
98+
maintenance, grant-capable, membership-delegating, executable-privileged,
99+
view-mediated-RLS-bypass, and owner-capable login sessions are outside the
100+
application isolation guarantee.
94101
- Migrations must restore forced RLS within the same atomic SQL statement that
95102
relaxes owner enforcement, preserve legacy rows under `standalone`, remain
96103
idempotent, and keep the packaged and Docker initialization schemas

0 commit comments

Comments
 (0)