Repository navigation
fix(plugin-auth): ban and unban write the admin audit row; the remove-sso-user row is named in the ledger note and docs - #35758
Conversation
…emove-sso-user row in the ledger note and docs A ban or an unban that committed now writes the sibling doors' admin audit row (writeAdminAudit, action update, event user.admin_banned / user.admin_unbanned, hostNotified). A refused one writes none. Measured: without the admin plugin the engine ban writer carries no attributed user, so plugin-audit's mirror row names no administrator. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L9qibyy9KSA69EGZtjDj9c
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L9qibyy9KSA69EGZtjDj9c
📓 Docs Drift CheckThis PR changes 1 package(s): 25 hand-written doc(s) name something this change touched — list omitted above 15 rows. Re-derive on the tree named below: ⛔ 7 release-owned page(s) also affected — read-only, see AGENTS.md Documentation Guardrails. What this run could not see
Coarse fallback — 21 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): Which tree this was computed onThis run read A worktree cut from an older # while this PR is open — GitHub drops the merge commit once it closes
git fetch origin 9bab3118bd305eba9db69ff10672cc7d5e9d8d5f && git checkout 9bab3118bd305eba9db69ff10672cc7d5e9d8d5f
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin d1ebe86dd3c2ec380de7c2c8607306c8e4bb9b73 fe109ec6cf2eee4c8d64316174270301ce7d9fc6 && git checkout -B drift-repro d1ebe86dd3c2ec380de7c2c8607306c8e4bb9b73 && git merge --no-ff fe109ec6cf2eee4c8d64316174270301ce7d9fc6
node scripts/docs-audit/affected-docs.mjs --json d1ebe86dd3c2ec380de7c2c8607306c8e4bb9b73
|
…ttribution Without the vendor admin plugin the ban columns are written through the data engine; that write now takes the administrator in scope through the existing authSystemWriteContext seam, so plugin-audit's mirror row names them instead of the system, as the internalAdapter path already did. Written fields unchanged. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L9qibyy9KSA69EGZtjDj9c
…attributed ban write The engine ban writer's context now spreads authSystemWriteContext(), which the census reads as undecidable elevation, as it reads the sibling seam sites. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L9qibyy9KSA69EGZtjDj9c
|
repo:objectstack#7 · os-tesla · session_01L9qibyy9KSA69EGZtjDj9c Final head for review · 2026-11-20T07:32Z: What the patch round adds beyond the PR body (the body is left as created so its attribution header stays on top; this comment carries the delta):
|
|
repo:objectstack#7 · os-tesla · session_01L9qibyQBB3KuDoNobNq9LH Seat checkL1: ACCEPT (L1-a, for area d7-A) at head Shape and declarations
Code
Tests and controls
Prose, sentence by sentence
Your three points
Nit (not owed)The changeset opens on Gates and routing
Generated by Claude Code |
|
repo:objectstack#7 · os-tesla · session_01L9qibyy9KSA69EGZtjDj9c Landing · 2026-11-20T07:35Z · head
What landed beyond the PR body (L1 asked it carried here): State: ready + auto-merge now; #35440 closes on merge. |
Requested by Tesla · project thread
Fixes #35440
Clause-②: no
Metadata-protocol: none
维护者速读
What changes
admin/ban-userandadmin/unban-usernow write one admin audit row for a change that committed, through the sharedwriteAdminAuditthe other admin user doors use (create-user, set-user-password, add/import/remove SSO user):action: 'update'on the targetsys_user, naming the administrator, withmetadata{ event: 'user.admin_banned' | 'user.admin_unbanned', hostNotified }. A refused ban or unban writes no row. The ban writes themselves are unchanged (the maintainer ruling recorded inadmin-ban-endpoints.tsstands).AdminAuditDecisionsgains the two events. The ban reason and expiry are fields of the user, so they stay on plugin-audit's mirror row and are kept out ofmetadata, as that type's docblock requires.POST /api/v1/auth/admin/remove-sso-userandcontent/docs/permissions/authentication.mdxnow name that door'suser.admin_removed_pendingrow (actiondelete, written only on a committed removal). The ban/unban paragraph of the doc names the new rows.Why
Item 2 of the card asked to measure whether plugin-audit's mirror row already covers a ban. It does not:
{ isSystem: true, attributedUserId: ADMIN_ID }, so the mirror row names the admin. But it is a plainupdatefield diff, with no event and nohostNotified.engineUserBanWriter, the managed Free/Team case), the write reaches the engine as{ isSystem: true, positions: [], permissions: [] }, with noattributedUserId. So the mirror row records the ban as the system. There, no row named the administrator who banned.Measured by a throwaway spy on
engine.updatein the shared route harness (not committed). Real route, both kernels, ban then unban:That rules out an exemption, so the doors now write the row.
Tests
The pins are in the shared route harness for these doors (
pending-sso-users.test.ts, which already drivesadmin/ban-user/admin/unban-userover the real mount), in a new[#35440]describe:updaterows. Each names the admin asuser_id/actoronsys_user/ the target, with metadatauser.admin_banned/user.admin_unbannedandhostNotified: true.hostNotified: false.Readings (final head 0f9dc05, after merging origin/main)
pnpm --filter @objectstack/plugin-auth typecheck && pnpm --filter @objectstack/plugin-auth test:check:test-typecheck: OK; Test Files 287 passed (287), Tests 6070 passed | 10 skipped (6080). Lock VERDICT command-exit 0. The pre-merge head 64d7c50 read 287/287 files and 6053 passed.scripts/ablation-replace.mjs --deleteof the ban door'sauditBancall. The anchor went 1 to 0 and the blob from 6f0477963c20 to 1fe3fd0e2ff3. The[#35440]describe then went 4 of 4 red: the CONTROL's committed-ban leg asserts the row too. On restore the blob matched HEAD again (6f0477963c20) andgit diff HEADwas empty. Plugin-auth tests importsrc, so no dist rebuild sits between the mutation and the run.Acceptance notes
admin/ban-userandadmin/unban-userhave no ledger note to amend. They appear only inBETTER_AUTH_MOUNTED_SURFACE, the list of vendor routes the raw mount shadows, with no note string. The new rows are named inadmin-ban-endpoints.ts's header and in the doc instead.engineUserBanWriterpasses a bare system context with no attributed user. The explicit row added here is now the trail that names the administrator. Fixing the mirror row's attribution is a change touser-ban-write.ts, outside this claim.writeAdminAuditposture: it never fails the answer and logs onewarn.Verification
Read first, by risk:
packages/plugins/plugin-auth/src/admin-ban-endpoints.ts, theauditBanhelper and its two call sites. Each call sits after the committed write (and, for a ban, after the session revocation), so no refusal path reaches it.packages/plugins/plugin-auth/src/admin-user-endpoints.ts, the newAdminAuditDecisionsmember. It is closed to decisions only, with no field value of the user.packages/plugins/plugin-auth/src/pending-sso-users.test.ts, the[#35440]describe.Two-minute check:
pnpm --filter @objectstack/plugin-auth exec vitest run --maxWorkers=2 src/pending-sso-users.test.ts -t 35440. Expect 4 passed.Local gate subset (head 0f9dc05)
node scripts/pm/dispatch-gates.mjs --commandsderived 104 families, and all 104 ran with exit 0 (--ran: 104 derived, 104 run, 0 UNRUN). Exit codes were captured per command before any pipe. On the pre-merge head,check:skill-examplesandcheck:dual-build-cjs-loadsanswered PREREQUISITE NOT MET (unbuilt dist); they measured once the closure was built.node scripts/check-platform-checklist.mjs --changed-from origin/main: OK, 0 anchors lost.node scripts/pm/overlap-check.mjs --branch=HEAD: VERDICT clean (main, fix(plugin-auth)!: a credential change ends access issued before it #35664 and fix(plugin-auth)!: a directory deactivation removes the user's local password; a re-activation restores access through SSO only #34738 merge cleanly).🤖 Generated with Claude Code
https://claude.ai/code/session_01L9qibyy9KSA69EGZtjDj9c