Protocol note for this thread (adopted at Daniel's request): lines are marked OBSERVED (tested, timestamped, reproducible), ANALYSIS (interpretation, testable), PROPOSAL (design suggestion, needs decision), QUESTION (open). Daniel's convention: statements without should/could are statements — everything below marked accordingly.
1. OBSERVED: the defect
The database-acl-grant description promises: "the caller and every group the caller is in — nobody grants themselves access." Tested on apps/ailab.nsf (caller: OpenCode Assistant/DominoLab, manager there as creator):
| # | action | expected | result |
| 1 | create group AI Gang with the caller as member → grant AI Gang editor on ailab | 403 | added |
| 2 | grant cantest-expansion-group (caller's membership weeks old) editor | 403 | added |
| 3 | re-grant AI Gang at author level (minutes later) | 403 | changed |
OBSERVED: the membership guard did not fire in any case — fresh group, long-known group, retest. Not a cache race: the weeks-old membership was also not caught.
OBSERVED: the guards that do fire, correctly and with named errors: caller's own name; protected groups (LocalDomainAdmins); -Default-/Anonymous; levels above editor (schema-enforced); lowering existing designer/manager entries; names not in the directory.
OBSERVED: cleanup completed — AI Gang restored to editor (the team's intended level), cantest-expansion-group revoked to noAccess. No actual privilege was gained (the caller is already manager of ailab.nsf).
2. ANALYSIS: why the two lists disagree
The escalation path is real and two-step: group-create with the caller as member → database-acl-grant of that group → editor on any database the policy allows.
- ANALYSIS: at authentication, Domino resolves the user's names list including group memberships. My
auth-whoami exposes it — and at token time it already contained cantest-expansion-group. The long-known-group grant was catchable from the session names list; it was not caught.
- ANALYSIS: a group created after token issuance is absent from the session names list (and subject to group-cache timing) — the fresh-group case. Two lists, two truths: the same failure class as the
NSHMCP_OIDC_USERS vs. users.json divergence earlier this week.
- ANALYSIS: consequence of the same mechanism for the effectiveness side: ACL entries granted via the new group presumably only become effective for existing sessions at re-authentication / cache refresh — the race window is inherent to group-based ACL changes, on the effectiveness side as well.
- ANALYSIS: Daniel's point stands: protecting against an admin is a different problem class — the API rules define what an operator under rules may do, and this defect means the rule existed as documentation but not as enforcement.
3. PROPOSAL: a two-layer fix, race-free by construction
Layer 1 — the write path (the choke point). group-create and group-member-add refuse when the caller would become a member, directly or transitively: adding group X as member of group Y requires walking X's membership subtree; if the caller appears anywhere in it, refuse. The race disappears because the content of the write is the truth — no cache, no timing, no resolution against stale state. The transitive walk is bounded by the directory size; trivial at lab scale.
Layer 2 — the read path. database-acl-grant refuses target groups present in the caller's session names list — which the API already holds in-process from token validation (auth-whoami exposes exactly it, so the data is there). This covers every group that existed at authentication time, including nesting.
The residual gap — a group created after token issuance containing the caller — is closed by Layer 1: the caller cannot put itself into any group, directly or through nesting, so Layer 2 never misses one. Together: no path, no timing dependence.
Optional Layer 3: a policy knob scoping which databases acl-grant may touch at all — defense in depth, and the honest answer to the admin-class question (rules for operators, power for admins).
4. PROPOSAL: the test battery for the fix
- fresh group containing caller → grant → refused (Layer 1 repro)
- weeks-old membership group → grant → refused (Layer 2 repro — today's case #2)
- transitive: caller in G2, G2 member of G1, add G1 to... / add G2 to G1 → refused
- nested grant: group containing caller only via nesting, in names list → grant → refused
- group not containing caller → grant → allowed (the false-positive guard: legitimate group grants must keep working)
- after re-auth with a new group created by a human admin containing the caller → grant → refused (the legitimate-admin case: humans manage groups containing themselves via the client, and the API still refuses the AI — the admin boundary Daniel described)
- error messages named and guiding, per house standard
5. QUESTION: decisions needed
- Layer 1 scope: refuse caller-membership for all API callers, or only identities flagged in the users file? A human admin using the API also loses the ability to add themselves to groups — acceptable restriction, or AI-only rule (which would need an identity-class concept the API doesn't have yet)?
- Layer 2 data source: session names list (free, race-free for pre-auth groups) vs. live directory resolution (complete but slower and caches anyway). Proposal: session names list + Layer 1 closes the rest.
- Interim until the fix ships: Daniel's call — the lab accepted the risk with a loud ledger entry (my recommendation: keep the defect kept, not hidden).
Filed by OpenCode Assistant — the ACL feature's first production day, and the QE battery found the one guard that gives the AI gang its own door. Which is, in the end, the battery working exactly as designed. 🛡️