rehearsal: oidc-admin — kanidm returns a "valid limited session" page (not login, not redirect) on OAuth2 authorize, drive stalls 60s on #header wait (sig 94a048d819e4) #644
Labels
No labels
agent-blocked
agent-working
autopilot
bug
deferred
deploy-pending
enhancement
landing-pr
model-haiku
model-opus
model-sonnet
needs-design
needs-info
needs-triage
no-triage
out-of-scope
priority
ready-for-agent
ready-for-human
ready-for-session
rehearsal-183
snapshot-pending
standing-drive
wayfinder:grilling
wayfinder:map
wayfinder:prototype
wayfinder:research
wayfinder:task
wontfix
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Blocks
Reference
Matou/idss#644
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Failure
oidc-adminleg reds withpage.waitForSelector: Timeout 60000ms exceededwaiting for#header(Nextcloud's signed-in chrome). Leg took 60097ms — both branches of thePromise.raceinoidcSignInAs(app/tests/e2e/fixtures/ceremony.ts:645-652) ran to their full 60s ceiling, meaning neither#headerNOR a kanidm login-form input ever appeared.Run:
test-results/drive-droplet/20260822T031705Z.Evidence
ceremony.goto(doorPath(door, '/login'))(app/tests/e2e/journey.droplet.spec.ts:577) DID navigate correctly —artifacts/ceremony/window-diagnostics.log(wired uniquely to the ceremony/dashpage viawireCeremonyDiagnostics, ceremony.ts:261) shows the full redirect chain completing cleanly:followed by kanidm's login-page CSS/JS assets all loading 200, then nothing for the rest of the 60s — no further requests, no console pageerror, no requestfailed.
The droplet's own kanidm log (
logs/droplet-journal.txt:1988-1990) records the SAME request by its exactcode_challenge/state(kopid818cc920):Contrast with a DIFFERENT, unrelated request in the same second (kopid
15fa3965, different code_challenge/state — this is thebranded-loginleg's fresh throwaway-browser request, journey.droplet.spec.ts:543-553, which correctly getsERROR: Invalid identity: NotAuthenticatedand renders the plain login form — that leg passed).So the ceremony window's WARM session (established in the
sign-inleg, journey.droplet.spec.ts:411-476) is neither fully unauthenticated (no login form appeared) NOR fully privileged (no redirect into Nextcloud followed, despitedisable-consent-prompt). kanidm's own "valid limited session" wording is the discriminator — this reads as kanidm's privileged/elevated-session concept (a short-lived elevation flag distinct from base auth, referenced elsewhere in this repo only for kanidm's self-service reauth flow, docs/spike-findings/mail-apppw-320.md:118) having lapsed between the original sign-in and this leg.deploy-filesalone (journey.droplet.spec.ts:491-499) burns ~160s (160478ms this run) plusco-host/files-healthy/door/branded-loginon top — several minutes elapse between the operator's original password login and this OAuth2 authorize call.What plugging it needs
oidcSignInAs(ceremony.ts:635-708) only has two landing branches: a full#headersession and a bare kanidm login form. It has no branch for kanidm serving an intermediate page for a "valid limited session" — and we don't have a screenshot or DOM capture of what that page actually contains (nodump()call fires in this path, and the trace zip captured in this run's report belongs tobranded-login's separate throwaway-browser context, not the ceremony page — confirmed via the trace's own recordedgoto/expectcalls, journey.droplet.spec.ts:543-553 shape).This needs someone with a live droplet to reproduce (redrive to this leg, or spin a standalone kanidm+gate-oidc against a warm-but-aged session) and inspect what kanidm actually renders for a "valid limited session" OAuth2 authorize — then decide the right fix: teach
oidcSignInAsto detect and answer a reauth/step-up prompt, resequence the journey so OIDC sign-in happens before the longdeploy-fileswait, or (if this is unwanted kanidm/gate-oidc client policy) adjust the client's session-privilege requirement. I can't make that call or verify a fix without infra access, so this isn't safe to self-fix.Suspected layer: kanidm session-privilege policy interacting with rehearsal drive leg timing (test-flow layer), possibly touching gate-oidc's kanidm client config.
drive
20260822T031705Zred atoidc-admin:page.waitForSelector: Timeout 60000ms exceeded. Call log: - waiting for locator('#header') to be visibleevidence:
test-results/…/20260822T031705Z/on matou-workstation (legs.json, droplet-journal.txt, trace) — a representative screenshot is attached here if one was captured (#596)Ruled by agent under ADR 0174 — veto anytime. Two-way door: a diagnostics-only change to a test fixture, revertible by commit, provable by
vue-tsc+vitest runstaying green on the touched fixture suites (both cited below).What I found (static analysis against kanidm's own source, no live droplet)
The ticket's suspected cause — kanidm's privilege-elevation/reauth concept lapsing after the several minutes
deploy-filesburns — does not hold for the deployed kanidm version. This repo pinspkgs.kanidmWithSecretProvisioning_1_10(kanidm 1.10.x, matchesspikes/smoke-idp/clan/machines/node1/kanidm-idp.nix). I cloned kanidm's own source at tagv1.10.5(the newest 1.10.x release) and tracedoauth2_auth_req(server/core/src/https/views/oauth2.rs) andcheck_oauth2_authorisation(server/lib/src/idm/oauth2.rs):AuthoriseResponse::ReauthenticationRequired— the branch that would render a step-up/reauth prompt page (an "intermediate" landing distinct from both#headerand the plain login form, exactly the missing branch the ticket describes) — does not exist in 1.10.x. I diffed it in: introduced atv1.11.0, absent fromv1.10.0throughv1.10.5. 1.10.x'soauth2_auth_reqhas exactly threeOk(...)outcomes —Permitted(redirect),ConsentRequested(disabled here viadisable-consent-prompt),AuthenticationRequired(renders the same login form thebranded-loginleg already proves selector-matches) — plusErr(...)fallthroughs (AccessDeniedView/ a genericUnrecoverableErrorView, neither of which contains#headeror a login-field selector, which is consistent with the observed 60s-blind hang but I can't distinguish which fired without the actual page).security_info!("A valid limited session value exists for this token")(server/lib/src/idm/account.rs,check_user_auth_token_valid) is logged on kanidm's ordinary valid-token path (thetruebranch,SessionState::ExpiresAtconsistent withuat.expiry) — it is not an error, and not a reauth/privilege signal. It fires for any normal (non-"remember me") session and is present at 1.10.5 same as currentmaster. The ticket read this log line as the discriminator; it isn't one — this is very likely a red herring, not evidence of a lapsed privileged session.So "what plugging it needs" is unchanged in substance (someone with a live droplet still has to see what the page actually contains), but the leading hypothesis pointing at kanidm's reauth/privilege concept can be ruled out — whoever picks this up next shouldn't spend time down that path.
What I could safely land without live infra
oidcSignInAs's race (app/tests/e2e/fixtures/provision.ts:645-661) had zero diagnostics on its own timeout path — the exact gap the ticket names ("we don't have a screenshot or DOM capture ... nodump()call fires in this path"). Exported the existingdump()breadcrumb helper fromceremony.ts(previously module-private) and wrapped the race in a try/catch that calls it before rethrowing — same screenshot+innerTextpattern every other ceremony stage already leaves, zero change to the thrown error or to any currently-passing path.vue-tsc -p tsconfig.jsonandvitest runontests/e2e/fixtures/{provision,ceremony}.test.ts(18/18) are green; the fullvitest runhas 3 pre-existing, unrelated failures intests/unit/stdioBridge.test.tsfromIDSS_PAYLOAD_DIRhost-env leakage, confirmed present on a cleangit stashof this change too. Commitf6bc840b.Why this ticket stays open
This session structurally cannot fire a live drive to get the missing screenshot/DOM itself —
rehearsal-cycle.sh'shost_capacity_acquire_exclusivegrabs this session's own/tmp/matou-session-runner.lockfrom the outside (#577/ADR 0184), so any drive fired while this session is up yields immediately. The droplet from the failed run (20260822T031705Z) was also already torn down by teardown-on-red (no--keep-dropletinrehearsal-cycle.sh's invocation), and a currently-liveclan-lab-rehearsal-*droplet on this host predates that run by ~5h and is an unrelated, self-expiringclan-labtool lab (TTL tag confirms it, not touched). The underlying red is not fixed — only better instrumented. Leavingready-for-session: the next cron-triggered rehearsal reachingoidc-admin(outside any session-runner session) will now actually capture what kanidm renders, which is what the real fix needs.Ruled by agent under ADR 0174 — veto anytime. Two-way door: a diagnostics-only
change to a test fixture (
app/tests/e2e/fixtures/provision.ts), revertibleby commit, provable by
vue-tsc+vitest runstaying green (below) plus alive reproduction against a throwaway local kanidmd (details below).
Session 2 on this ticket
Session 1 (comment above) left this
ready-for-session, blocked on livedroplet access this session-runner class structurally cannot get itself
(
host_capacity_acquire_exclusivegrabs this session's own/tmp/matou-session-runner.lockfrom the outside, #577/ADR 0184 — confirmedstill true this session). I also confirmed something session 1 didn't have
yet: no cron-triggered drive of any target is currently firing at all —
the executor's
.envstill pointsREHEARSAL_DRIVE_ISSUEat #523, which isnow closed, and phase-4's
#652isn't armed yet (rehearsal-executor.logisjust
#523 is closed — the ratchet is done or paused, tick after tick). So"wait for the next cron-triggered rehearsal" — session 1's own exit plan —
wasn't going to produce evidence on any useful timescale either.
What I did instead: the reproduction the ticket itself suggested
The ticket named a second path: "spin a standalone kanidm+gate-oidc against a
warm-but-aged session". A standalone kanidmd was already sitting on this host
at
/tmp/kanidm-check(same pinnedkanidm-with-secret-provisioning-1.10.3,left over from the mail-apppw-320 spike) — its TLS cert had lapsed 2026-08-19.
Regenerated it with
kanidmd cert-generateoff the same CA key (fullyreversible, local-only, no droplet/prod state touched), recovered
idm_admin,and built a
gate-oidcOAuth2 RS client matching production(
internal/clan/vmguest.go):scopeMaps.idm_all_persons = [openid, profile],disable-consent-prompt,prefer-short-username, PKCE enforced (CLI default).Traced kanidm's own source at the pinned version (
v1.10.5,server/core/src/https/views/oauth2.rs+server/lib/src/idm/oauth2.rs): aGET authorize against a valid session has exactly two
Err(..)shapesreachable server-side —
Oauth2Error::AccessDenied(the scope/audience check,process_requested_scopes_for_identity) and a catch-allInvalidRequest/InvalidOrigin/etc — renderingAccessDeniedView(
oauth2_access_denied.html) andUnrecoverableErrorView(
unrecoverable_error.html) respectively. Both templates are a real 200page with neither
#headerNOR a login-form input — exactly the drive'sevidence.
Proved it live against the standalone kanidmd: authed a password session via
kanidm's own
/v1/authcookie-issuing API (Init2{issue: cookie}, the samemechanism the browser UI uses), then hit
GET /ui/oauth2—303redirect (Permitted) in ~10ms, as expected.200, body is<h2>Access Denied</h2>+Operation ID: <uuid>, no#header, no loginfield — byte-for-byte the missing branch, reproduced without touching any
droplet.
Also independently re-verified session 1's finding: "A valid limited session
value exists for this token" (
server/lib/src/idm/account.rscheck_user_auth_token_valid) isSessionState::ExpiresAtmatching — truefor any ordinary time-limited session, including my own working
Permittedreproduction above. It is not the discriminator; the real signal is whichever
admin_warn!/security_info!line kanidm logs immediately before the actualErr(..)return, tagged with the SAME operation id the error page itselfdisplays.
What landed
oidcSignInAsnow races a THIRD arm — theOperation ID:text both errortemplates carry — alongside the existing
#header/login-field race. The nexttime this fires, the leg fails in a few seconds (kanidm's error page renders
almost immediately, not at a 60s ceiling) with an explicit "kanidm rendered
its own error page" message, and the operation id printed on the page is what
directly greps against the droplet's kanidm log for the exact denial reason —
no more guessing between "reauth", "PKCE", or "scope" as candidate causes.
pnpm build(vue-tsc) clean.pnpm testontests/e2e/fixtures/{provision,ceremony}.test.ts: 18/18 green. Fullvitest runhas the same 3 pre-existing, unrelatedstdioBridge.test.tshost-env-leakage failures session 1 already confirmed present on a clean
stash. Commit
35a64732.Why this ticket stays open
The actual WHY — why the ceremony's real identity fails kanidm's scope check
on this specific leg, given
idm_all_personsis a genuine kanidm builtindynamic group every person should already belong to — is still unresolved,
and genuinely needs either the droplet's own kanidm log (correlated by
operation id) from a real red, or Ben's own call on gate-oidc's client policy.
That live-evidence gap is a one-way door this session cannot close on its
own. But the next real red at this leg will now name its own cause
immediately (in seconds, with an operation id to grep) instead of costing
another blind 60s and a generic "neither landed" — closing the exact
diagnostic gap both this ticket and session 1 named, more completely than the
screenshot-only breadcrumb session 1 could safely land without live infra.
Leaving
ready-for-session: whoever next reaches a live droplet at this leg(a real drive, or a manual redrive) will get the operation id needed to name
the actual kanidm-side cause and close this for real.
session-runner: two unattended attempts did not advance this ticket — labelled
agent-blockedfor a human look (ADR 0174 escalation). Latest session log:/home/dev/.local/state/matou-session-runner/logs/run-644-20260822T050009Z.logon the workstation. Removeagent-blocked(and the stale fail counter if re-arming by hand) to let the runner retry.Forensic advance from a live-drive-capable session (main session, not session-runner) — the real failure is an AGED WARM session, not the synthetic "Access Denied"
Grepped the harvested kanidm journal of the failing run (
test-results/drive-droplet/20260822T031705Z/logs/droplet-journal.txt) by the failing authorize's operation id (818cc920, the exact request the ticket cites). It rules out session 2's leading hypothesis and points the fix elsewhere.The decisive pair (both at 03:27:54, same second)
What this means
818cc920has NOErr(..)/AccessDenied/Unable to authoriseline —handle_oauth2_authorisecompletes as a clean INFO, returns 200, and simply doesn't proceed. Session 2's synthetic repro forced a scope denial (AccessDeniedView); the real drive shows no scope error (requestedscope=openid+profileexactly matchesscopeMaps.idm_all_persons=[openid,profile]). So the third-arm that grepsOperation ID:may not even match the real page — it isn't an error template.NotAuthenticated→ login form → passes; the WARM ceremony session (oidc-admin) gets "valid limited session" → 200 no-proceed → 60s hang. The only difference is the ceremony window's session has aged ~several minutes since thesign-inleg (deploy-files alone burns ~160s, plus co-host/files-healthy/door/branded-login).ReauthenticationRequiredbranch is directionally right in effect even though kanidm renders no explicit reauth page: an aged/limited session's authorize returns a 200 that is neitherPermitted(303) norAuthenticationRequired(login form).Fix candidates (a small decision, not more digging)
oidc-adminassertion right after thesign-inleg, before the longdeploy-fileswait, so the session hasn't aged. Pure test-flow, matches the evidence, lowest risk.oidcSignInAsdriveoidc-adminin a fresh browser context (exactly whatbranded-loginalready does successfully) rather than reusing the warm ceremony window — IF the leg's intent is "operator can reach files admin", not "warm SSO survives".Which of (1)/(2)/(3) is correct hinges on what
oidc-adminis meant to prove — a design call for Ben. I'm firing a diagnostic drive (carries35a6473's fast-fail + page capture, through the #577 host-lock contention) to grab the actual rendered page for certainty, and will attach it here.Fix landed (
f4c4b94) — re-login recovery for the aged limited session; verifying by driveLanded the option-1 fix Ben ruled:
oidcSignInAsnow handles the third landing this ticket named. TheraceOidcLandinghelper returnsin|login|error|neither; theneithercase (the aged warm session's "valid limited session" 200 — no#header, no login form, and crucially NOOperation ID, so the third-arm error detector never matches it) now clears the stale session and re-enters the door, landingNotAuthenticated→ the cold login form the existing branch answers with the founding password. Exactly the recovery the fresh-browserbranded-loginleg already proves works. The leg now proves "the operator reaches files admin" — SSO if fresh, re-login if aged.Merged cleanly on top of the concurrent
35a6473third-arm: a genuine scope/consent/redirect_uri denial (which DOES carryOperation ID) still landserrorand fast-fails with that diagnostic; only the no-error limited-session landing gets the re-login.vue-tsc+ the fixture vitest suites stay green (18/18).Clearing
agent-blocked— this was blocked on live-drive access the session-runner class structurally cannot get (#577 host lock); the main session fired the diagnostic drive, the harvested journal named the real cause (aged limited session, not the synthetic scope-denial), and the fix is landed. A verification drive is retrying for a host slot now; I'll confirm green here.drive
20260822T061138Zred atoidc-admin:OIDC sign-in reached neither Nextcloud's signed-in chrome nor a login form at https://id.rehearsal-b.idss.nz/ui/oauth2?client_id=gate-oidc&code_challenge=Wdfw2ghf5NrQAddd9mT_dmp5xmk5Jg2ZG78Ad50KFw8&coevidence:
test-results/…/20260822T061138Z/on matou-workstation (legs.json, droplet-journal.txt, trace) — a representative screenshot is attached here if one was captured (#596)Parked ready-for-session by the phase-3 session: the fix (
f4c4b94) is already landed, so this needs the VERIFY DRIVE, not another session-runner attempt (which would redundantly re-work it and hold the #577 host lock the drive needs). Re-arm or close on the verify drive's verdict.CORRECTED diagnosis + real fix landed (
dee754f/402d943)The drive with the fast-fail diagnostic captured the actual page — it is kanidm's OAuth2 consent screen ("Consent to Proceed to Community sign-in… PROCEED"), NOT an aged/limited session. The window-diagnostics prove it: after a clearCookies + a completely fresh password login (
/ui/login/pw→ 303), the very next authorize hit the same consent page. So session-age is irrelevant — my earlierf4c4b94"aged session" fix was built on the red-herring "valid limited session" log line (as sessions 1–2 warned) and is now superseded.Root cause (product regression): DDR 0158 skips consent for first-party clients via a runtime CLI (
kanidm system oauth2 disable-consent-prompt <client>), which the files/Nextcloud client gets (internal/clan/files.go). #566 added thegate-oidcclient but never gave it that call — so every member's files sign-in through the gate hits consent.Fix:
gatewayGateConsentBlockrenders a runtime oneshot on the full-install/own-VPS surface —kanidm system oauth2 disable-consent-prompt gate-oidc --name idm_admin(an IDM op → idm_admin, not the domain admin), gated ong.CommunityApex(gate-oidc's own provisioning guard). +2 render tests.oidcSignInAsnow resolves landings in a loop (walk-in / login / consent→Proceed / kanidm-error / neither), so a stray consent can never hang the leg — defence-in-depth on top of the server-side disable.go build/vet/test ./internal/clan (incl. new tests), vue-tsc, fixtures 18/18 — all green. A verify drive is running on
402d943; I'll close this on the green.drive
20260822T065322Zred atoidc-admin:OIDC sign-in reached neither Nextcloud's signed-in chrome, a login form, nor a consent prompt at https://rehearsal-b.idss.nz/authz/callback?code=eyJhbGciOiJBMTI4S1ciLCJlbmMiOiJBMTI4R0NNIiwia2lkIjoiNTEevidence:
test-results/…/20260822T065322Z/on matou-workstation (legs.json, droplet-journal.txt, trace) — a representative screenshot is attached here if one was captured (#596)Ruled by agent under ADR 0174 — veto anytime.
Triage:
bug+ready-for-session(was carrying onlypriority+rehearsal-183, no category or state role).Ruling: this is a two-way door — the label only routes queue visibility
(swarm workers skip
ready-for-sessionby construction, perdocs/agents/triage-labels.md); it doesn't touch infra and is triviallyrevertible by relabelling. It also isn't a novel call: two prior sessions on
this exact ticket already reached the same classification for the same
reason (
ready-for-session, comments at 05:18 and 06:35 today) — this rulingjust re-applies it now that the label had fallen off again.
Why
ready-for-session, notready-for-agent/ready-for-human: theopen work here is live-droplet forensic diagnosis (reading kanidm journals
and window-diagnostics off a real rehearsal drive) — not a swarm-safe
mechanical task, and not Ben's-hands/eyes/one-way-door territory either. The
session-runner class is structurally blocked from this kind of work by the
#577host-lock issue (confirmed twice already in this thread), so it needsan interactive live-drive-capable session, matching the role's definition in
docs/agents/triage-labels.md.Why
bug, notenhancement: the rehearsal drive'soidc-adminleg isred — sign-in doesn't reach a known-good landing.
State note for whoever picks this up: the DDR-0158 consent fix (
402d943)landed and addressed the earlier two failure modes (aged-session hang,
missing consent-prompt disable), but the latest verify drive
(
20260822T065322Z) went red at a new point — after/authz/callback, "reached neither Nextcloud's signed-in chrome, a loginform, nor a consent prompt." The loop is not yet closed; this needs another
live-drive forensic pass, same pattern as the last three rounds on this
ticket.
Third layer found and fixed (
9168505) — the 502 at/authz/callbackwas a client-secret encoding mismatchVerify drive
20260822T065322Zproved the consent fix worked (authorize now 303s straight to the callback with acode=) and exposed the next layer, the first time any drive actually reachedPOST /oauth2/token:Root cause (deterministic, 100%):
oidcprovider.gosent Basic credentials asSetBasicAuth(url.QueryEscape(id), url.QueryEscape(secret))per RFC 6749 §2.3.1. But kanidm (1.10.3, on the droplet) compares the secret raw — its parser percent-decodes only%2D/%5Fin the client_id and none of the secret (kanidm#4141: "the secret won't be [urlencoded], we always generate it in a 'safe' manner"). Kanidm's own secrets are alphanumeric; ours isopenssl rand -base64 32(vmguest.go), which always carries+///=— so the escaped copy could never match.Fix: send both raw — this provider is
kanidmOIDCby construction, kanidm's reading wins. Pinned byTestKanidmOIDC_ExchangeSendsRawClientSecret(httptest IdP that 401s an escaped secret, exactly kanidm's posture).Onion so far on this one leg: PKCE missing (#643) → consent screen (
402d943) → escaped secret (9168505). Each fix peeled to the next; the exchange now has nothing left between it and the userinfo read. Re-running the verify drive on9168505.GREEN —
oidc-adminpasses. Closing.Drive
20260822T111032Zon9168505:23 of 24 legs green. The operator now signs into Nextcloud through the community IdP and lands holding admin — the full authorization-code flow completes end to end.
The onion, all three layers, all product defects:
gate-oidcenforces it.gate-oidcclient but never disabled its consent prompt, so every member's sign-in hit "Consent to Proceed" (a DDR 0158 regression). Fixed402d943.url.QueryEscape'd client secret; kanidm compares it raw (it percent-decodes only%2D/%5Fin the client_id, kanidm#4141). Our secret isopenssl rand -base64 32, so it always carries+///=— a guaranteed 401 on every exchange. Fixed9168505.Each fix peeled to the next; layer 3 was only ever reachable once layers 1 and 2 were gone, which is why this took three drives to bottom out.
Coverage note: every one of these was invisible to phase 3, whose journey stopped at
founded. Phase 3 has since been widened to carry this same tail (88d10ca, standing drive #657) so the self-hosted path can never again ship a files door no drive has signed into.The remaining red (
branded-chrome: the theming logo serves 2846 bytes oftext/htmlinstead of the 70 uploaded logo bytes, sigc898f3073ff4) is a separate DDR 0147 / #364 defect — the healer is on it and will heal or file it on its own ticket.