Repository navigation
docs(reference): users, enrollment and roles; fix the pages that predate API enrollment - #926
Conversation
…ate API enrollment A new reference page, from the user lifecycle material's genuinely new parts, corrected against the code, and fixes to published pages that were staler than that material: - docs/reference/users-and-roles.md (new): subjects (github:, oidc:, test:, with examples); who is enrolled and who is an admin (settings and the API-backed members store); who can change access, including the installer token -- SH_INSTALLER_TOKEN, a static bearer that acts as a settings admin on the /v1/subjects routes, read on the sandbox profile only; what a damaged members.json does; who can log in on each route profile; what happens to a departed user's refresh families, sandboxes, sandbox tokens, templates and turn grants; every credential's lifetime (linking the security model's "Tokens"); the members record kinds and offline verification; the design limits. - security-model.md and harness/concepts/multi-user.md: the admin role no longer comes only from SH_ADMIN_SUBJECTS (API grants, per-request roles, oidc: subjects, the installer token). operate/harness/multi- user.md §6, install.md (combined counts store enrollment), runbook §4 (oidc: subjects) and oidc-login.md corrected to match. - configuration.md gains the settings it lacked: SH_ALLOWED_SUBJECTS, SH_INSTALLER_TOKEN and SH_SANDBOX_TOKEN_TTL_SECONDS, _MAX_PER_SUBJECT, _LIFETIME_SECONDS, _MAX_LIFETIME_SECONDS (defaults to the lifetime), _MODES_ALLOWED, _IDLE_CEILING_S. - Pointers from the runbook, install, OIDC login, multi-user and the glossary's subject entry. Numbered runbook headings unchanged. Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: Paolo Dettori <[email protected]>
ingpaolodettori-dev
left a comment
There was a problem hiding this comment.
Review — docs(reference): users, enrollment and roles; fix the pages that predate API enrollment
This is the page the enrollment work never got, and the edits it makes to older pages are the right ones. I checked the claims against the control plane rather than the source material; nothing blocking, no inline comments.
Subjects and the grammar — OIDC_SUB_PATTERN is [A-Za-z0-9][A-Za-z0-9._@+-]{0,127} and every example row follows it (identity.ts:250-260); MEMBER_SUBJECT_RE excludes test:<n>, so the table's "no" for /v1/subjects and owner transfers is right, and SUBJECT_RE still admits it for SH_ALLOWED_SUBJECTS as the configuration row says.
Enrollment and roles — the two equations are membershipNow + onAllowList (members.ts:254-296, sandbox-config.ts:317-328), including "the admin role enrolls". The bootstrap rules are exact: 409 bootstrap_subject for a settings-enrolled or settings-admin subject (member-handlers.ts:93,142,182), 409 admin_granted for a live grant on unenroll (:106), enrolling an already-enrolled subject answers record: null (:73). The installer bearer is checked only on auth: 'admin' routes, timing-safe over digests, minting INSTALLER_SUBJECT with admin (server.ts:113-131), and it is added to bootstrap.admins only where config.installerToken is set — the sandbox profile alone (main.ts:454-467, :745-757). A damaged members.json behaves exactly as the page says, warning at most once a minute (members.ts:250-278). Per-request role replacement is server.ts:251-256; without a store the claims stand.
Profiles and leaving — the login gate before a refresh family is issued (handlers.ts:869-880), the refresh's not_enrolled family revoke (:990-1008), the combined-profile enrolled-only activation (handlers.ts:1164-1171), and the owner-only token/mode routes against the admin-allowed GET/DELETE (sandbox-handlers.ts:140-152, :2945-3060) all match. The sandbox-token outliving removal by one lifetime plus the relay's 30 s leeway is the same statement the runbook makes in §9, and the admin's rm --force reason (no token is minted for another subject's sandbox) is what checkBeforeRm does (sync.ts:453-467).
The members stream — record bodies for enroll, unenroll, grant, revoke and the one control-plane lapse record match member-handlers.ts:60-200 and members.ts:286-312; record-before-rename is MembersStore.change (members.ts:215-230), so "a record for a change the store does not hold, never the reverse" is right; and verify-provenance.py does hold member/role to the members stream only.
Configuration and token lifetimes — every new row checks out: SH_ALLOWED_SUBJECTS required on sandbox/combined (sandbox-config.ts:198-211), SH_INSTALLER_TOKEN ≥32 and secret (main.ts:454-458, CONTROL_PLANE_SECRETS), token TTL 900/≤3600, lifetime 7 days with max defaulting to it and sliding only when the max is set, modes list, idle ceiling 1800/≥30 (sandbox-config.ts:124-267). The credentials table's 900/300/30 d/90 d/300/300 values and the MOCA_GRANT_TTL_S 300 s ↔ MOCA_TURN_MAX_S 1800 s relation are the code's defaults.
Checks — check-links 237 files/0 broken, publish hygiene 84 files clean (§4’s anchors resolve), CI 18/18 including the docs job. Draft PR; the review is against 8c6ee92b.
webchang
left a comment
There was a problem hiding this comment.
Thanks, this is accurate. I checked the members routes, the settings-admin rule, the installer token, the store-less fallback and every lifetime and default against the code, and the edits to the pages that predate API enrollment now read right. One fix and two small suggestions:
docs/reference/configuration.md, theSH_SANDBOX_MODES_ALLOWEDrow: "an empty list fails boot" reads as if unset or empty fails. Unset or empty meansper-exec; only a list with no names (such as,) or an unknown name fails boot (sandbox-config.ts:118-133).docs/reference/users-and-roles.md:3: "Enrollment and the admin role, on every route profile, are implemented" reads as if enrollment is checked onharnesstoo; the page's own table says it is not. Suggest dropping "on every route profile".users-and-roles.md:11: "summarised" → "summarized".
… spelling) - configuration.md, SH_SANDBOX_MODES_ALLOWED: unset or empty means per-exec; only a list of no names (such as ",") or an unknown name fails boot (sandbox-config.ts:118-133) -- not "an empty list". - users-and-roles.md: the banner no longer says enrollment holds "on every route profile" (the page's own table: harness does not check it); "summarised" -> "summarized". Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: Paolo Dettori <[email protected]>
|
All three points from the second review are fixed in 7a3f257:
From a clean clone: 237 files, 0 broken links; site build, no broken links. |
Summary
This adds a reference page for users, enrollment and roles, and fixes published pages that were staler than the material it came from. It uses the genuinely new parts of the user lifecycle material; about 60% of that material repeats published pages and is linked instead. Everything is corrected against the code; the claim → file:line list is available on request.
New
docs/reference/users-and-roles.md, "Users, enrollment and roles":github:,oidc:andtest:, with an examples table.SH_INSTALLER_TOKEN: a static bearer that acts as a settings admin on the/v1/subjectsroutes. It's read on thesandboxprofile only, must be at least 32 characters, and is compared timing-safe (main.ts:454-458,server.ts:113-129). The source material missed it entirely, and no published page documented it.members.jsondoes.membersrecord kinds and how to verify them offline.Fixes to stale published pages:
security-model.md,harness/concepts/multi-user.md: the admin role no longer comes only fromSH_ADMIN_SUBJECTS. API grants, per-request roles,oidc:subjects and the installer token now count too.operate/harness/multi-user.md§6: the admin-rights row is corrected, and "no way to remove a user" now explains why on the harness profile.install.md: the combined profile also counts store enrollment.oidc:subjects alongsidegithub:.oidc-login.md: the profiles are named correctly.configuration.mdgainsSH_ALLOWED_SUBJECTS,SH_INSTALLER_TOKENand theSH_SANDBOX_*token, per-subject, lifetime, mode and idle-ceiling settings.SH_SANDBOX_MAX_LIFETIME_SECONDSdefaults to the lifetime, and idle lifetimes slide only when it's set (sandbox-config.ts:38-43, 245).Left out because they couldn't be verified:
test:<n>entry in the allow list enrolls a test user oncombined;There are no internal names, no spec or ADR links, and none of the source repo's citations. The numbered runbook headings are byte-identical.
Overlap with #924 (templates): both PRs touch
glossary.md(different entries) andrunbook.md(§4 here, §5 and the end there). Either can merge first.Outside the docs, worth an issue: the OpenAPI
NotEnrolledand 403 descriptions still name onlySH_ALLOWED_SUBJECTS.Testing (from a clean clone of the branch)
make check-links: 237 files, 0 broken links.scripts/check-docs-publish.sh: 84 files, no matches; nosbx[0-9], cohort or w3id in the changed files.scripts/check-docs-site.sh: 62 pages, no broken links.Assisted-By: Claude Code