You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit e86302c
Browse filesBrowse the repository at this point in the historyBrowse files
test(plugin-security): pin the delegated answer about a user the caller cannot read in three postures
The write gate's four direct-grant shapes, security/explain and the
effective-access read answer each of four subject states as an id
naming no user; a readable subject inside the scope is served, and a
tenant-level or organization administrator still removes the stored
grant.
Claude-Session: https://claude.ai/code/session_017xRBcT1w3zpekijraHJE4f
Co-authored-by: Claude <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: packages/plugins/plugin-security/src/delegated-admin-own-name-set.posture.test.ts
+144Lines changed: 144 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -768,3 +768,147 @@ describe("[ADR-0105 D6; ADR-0091 D3] a delegated business-unit walk never starts
768
768
});
769
769
}
770
770
});
771
+
772
+
/**
773
+
* [ADR-0090 D12; ruling on #26059, Q3] A delegated answer about a user the
774
+
* caller cannot read does not depend on that user's existence or memberships.
775
+
* One subject id in four states — no user; a user holding no business-unit
776
+
* membership; a user whose unit is outside the delegate's scope; a user whose
777
+
* unit is inside it whom the delegate cannot read — asked of every delegated
778
+
* door that judges a target user: the write gate's four direct-grant shapes
779
+
* (an insert, an update pointing a stored grant at the subject, an update of
780
+
* the subject's stored grant leaving its `user_id` as stored, a removal of
781
+
* it), `security/explain` for the subject, and the subject's effective access.
782
+
* Every state answers exactly what the id naming no user answers; the CONTROL,
783
+
* a user inside the scope whom the delegate reads, is served at every door.
784
+
*
785
+
* A user the delegate cannot read is one its context may not read: `sys_user`'s
786
+
* row scope (`id == current_user.id || id in current_user.org_user_ids`), the
787
+
* same in every posture. The write shapes are asked of the gate itself, as
788
+
* `gateInsert` above asks it: the delegate holds no read of
789
+
* `sys_user_permission_set`, so for a stored grant the write door would answer
790
+
* the read door's refusal instead (`readDoorAnswerForGateRefusal`).
791
+
*
792
+
* Revocation does not leave the organization: a tenant-level administrator and
793
+
* the organization administrator still remove the stored grant of the subject
794
+
* the delegate cannot read, through the write door itself.
795
+
*/
796
+
describe("[ADR-0090 D12] a delegated answer about a user the caller cannot read does not depend on that user's existence or memberships — three postures",()=>{
797
+
constSUBJECT='u_subject';
798
+
constSTATES=[
799
+
'an id naming no user',
800
+
'a user with no business-unit membership',
801
+
'a user whose business unit is outside the scope',
802
+
'a user with a business unit inside the scope whom the delegate cannot read',
803
+
]asconst;
804
+
constUNREADABLE_INSIDE=STATES[3];
805
+
constCONTROL='a user with a business unit inside the scope whom the delegate reads';
806
+
typeState=(typeofSTATES)[number]|typeofCONTROL;
807
+
808
+
/** The delegate's context: the subject is among the users it may read exactly when the subject is a user it reads. */
809
+
constdelegateFor=(state: State)=>({
810
+
...NARROW,
811
+
org_user_ids: state==='an id naming no user'||state===UNREADABLE_INSIDE ? ORG_USER_IDS : [...ORG_USER_IDS,SUBJECT],
812
+
});
813
+
814
+
/** A fresh rig with the subject in `state`, its stored grant `g_subject`, and `g_target`, a grant of a user inside the scope. */
it("CONTROL: a tenant-level administrator and the organization administrator still remove the stored grant of the subject the delegate cannot read, through the write door",async()=>{
0 commit comments