setPassword's begin-credential-update GET still decodes {token:...}; real kanidm answers [CUSessionToken, CUStatus] as an array, and even fixed the commit is MFA-policy-refused — by-hand temp_password 400s live (invite-member leg) #662

Closed
opened 2026-08-22 12:25:15 +00:00 by matou-build-agent · 1 comment

Failure

invite-member leg (rehearsal drive 20260822T121105Z, signature 1dc3e7a84786) reds on POST /api/v1/members/by-hand:

400 {"code":"act_failed","message":"kanidm: decode GET /v1/person/e2e-member/_credential/_update: json: cannot unmarshal array into Go value of type struct { Token kanidm.cuToken \"json:\\\"token\\\"\" }"}

Source: error-context.md in the run dir, tests/e2e/journey.droplet.spec.ts:664 (the invite-member leg, journey.droplet.spec.ts:638-703).

Evidence

  • internal/kanidm/kanidm.go:657-661 (setPassword) begins the admin credential-update session with GET /v1/person/{id}/_credential/_update, decoding the response into struct { Token cuToken \json:"token"` }`.
  • Real kanidm 1.10.3 does not return {"token":...} for that GET — it returns a JSON array [CUSessionToken, CUStatus]. This exact shape was already found and documented live against real kanidm 1.10.3 in docs/spike-findings/smoke-idp-178.md:68-86 (finding 3), which lists four separate setPassword defects:
    1. begin GET returns an array, not {"token":...} — still broken; this is what reds today.
    2. POST /v1/credential/_update body order [CURequest, CUSessionToken] — fixed by #580 (e198b8cd), confirmed at kanidm.go:668-672 (comment cites the fix).
    3. commit route /v1/credential/_commit — fixed by #551 (db8ada0e), confirmed at kanidm.go:679.
    4. kanidm's default account policy (credential-type-minimum = mfa) refuses to commit a bare admin-set password (can_commit:false, warnings:["MfaRequired"]) even once the wire shapes are correct.
  • internal/kanidm/fakekanidm_test.go:322-334's fake server still answers the begin GET with {"token": sid} (an object), matching the code's wrong assumption rather than real kanidm — so the seam test can't catch this; only a live drive does. The fake double for the POST step already documents the array convention correctly at fakekanidm_test.go:346-350 (the #580 comment) — the begin-GET handler never got the matching correction.
  • internal/kanidm/kanidm.go:179-182 (CreatePerson) is what routes the by-hand path through setPassword in the first place, driven from POST /api/v1/members/by-hand (internal/controlapi/members.go:153, internal/member/byhand.go:46 CreateByHand).

Suspected layer

internal/kanidm (setPassword + its fake double), plus a founding/provisioning-layer account-policy decision (ADR 0077 territory — same shape as #485's credential-type-minimum oneshot for the founding passkey floor, see internal/founding, grep credential-type-minimum).

Why this isn't a mechanical self-fix

Fixing only the decode (accept the array) satisfies the compiler and a seam test, but per the spike finding it will not close this leg: kanidm still refuses to commit a bare admin-set password credential under its default MFA-required policy, so the by-hand temp-password flow will fail one step later with a different error on the next drive. The finding's own two remediation options are structurally different:

  • (a) extend the runtime account-policy oneshot #485 already applies for founding (RenderGatewayGuest/RenderFrontDoor) to also cover the by-hand temp-password path, keeping setPassword and its "operator hands the person a temp_password" contract (internal/member/idp.go:33-35, DDR 0073) intact; or
  • (b) stop routing by-hand temp-password creation through setPassword at all and instead mint a reset-token intent via the already-working MintResetToken path (internal/kanidm/kanidm.go:262-, internal/member/reset.go:241) — the way the smoke-idp-178 lab run had to route around this exact defect — which changes the by-hand UX contract (no more direct temp password handed out).

Choosing between those is a design decision, not a one-line fix, and this healer session has no live kanidm to prove either path against (the droplet from this drive is already torn down).

What plugging it needs

  1. Pick the fix shape (extend the account-policy oneshot vs. switch by-hand's temp-password flow to MintResetToken) — human/design call, ADR 0077.
  2. If keeping setPassword: fix its begin-GET decode to the real [CUSessionToken, CUStatus] array shape (kanidm.go:657-661).
  3. Correct fakekanidm_test.go:322-334's begin-GET handler to answer the same array shape, so the seam test would catch this the way #580's POST-body fix did.
  4. Prove it live against a clan-lab (or the next rehearsal drive) — docs/spike-findings/smoke-idp-178.md shows this exact path was never actually load-bearing on real kanidm before this leg started exercising it.

drive 20260822T121105Z red at invite-member: POST /api/v1/members/by-hand e2e-member failed: 400 {"code":"act_failed","message":"kanidm: decode GET /v1/person/e2e-member/_credential/_update: json: cannot unmarshal array into Go value of type str
evidence: test-results/…/20260822T121105Z/ on matou-workstation (legs.json, droplet-journal.txt, trace) — a representative screenshot is attached here if one was captured (#596)

## Failure `invite-member` leg (rehearsal drive `20260822T121105Z`, signature `1dc3e7a84786`) reds on `POST /api/v1/members/by-hand`: ``` 400 {"code":"act_failed","message":"kanidm: decode GET /v1/person/e2e-member/_credential/_update: json: cannot unmarshal array into Go value of type struct { Token kanidm.cuToken \"json:\\\"token\\\"\" }"} ``` Source: `error-context.md` in the run dir, `tests/e2e/journey.droplet.spec.ts:664` (the `invite-member` leg, `journey.droplet.spec.ts:638-703`). ## Evidence - `internal/kanidm/kanidm.go:657-661` (`setPassword`) begins the admin credential-update session with `GET /v1/person/{id}/_credential/_update`, decoding the response into `struct { Token cuToken \`json:"token"\` }`. - Real kanidm 1.10.3 does **not** return `{"token":...}` for that GET — it returns a **JSON array** `[CUSessionToken, CUStatus]`. This exact shape was already found and documented live against real kanidm 1.10.3 in `docs/spike-findings/smoke-idp-178.md:68-86` (finding 3), which lists **four** separate `setPassword` defects: 1. begin GET returns an array, not `{"token":...}` — **still broken; this is what reds today**. 2. POST `/v1/credential/_update` body order `[CURequest, CUSessionToken]` — fixed by #580 (`e198b8cd`), confirmed at kanidm.go:668-672 (comment cites the fix). 3. commit route `/v1/credential/_commit` — fixed by #551 (`db8ada0e`), confirmed at kanidm.go:679. 4. kanidm's default account policy (`credential-type-minimum = mfa`) refuses to **commit** a bare admin-set password (`can_commit:false, warnings:["MfaRequired"]`) even once the wire shapes are correct. - `internal/kanidm/fakekanidm_test.go:322-334`'s fake server still answers the begin GET with `{"token": sid}` (an object), matching the code's wrong assumption rather than real kanidm — so the seam test can't catch this; only a live drive does. The fake double for the *POST* step already documents the array convention correctly at `fakekanidm_test.go:346-350` (the #580 comment) — the begin-GET handler never got the matching correction. - `internal/kanidm/kanidm.go:179-182` (`CreatePerson`) is what routes the by-hand path through `setPassword` in the first place, driven from `POST /api/v1/members/by-hand` (`internal/controlapi/members.go:153`, `internal/member/byhand.go:46` `CreateByHand`). ## Suspected layer `internal/kanidm` (`setPassword` + its fake double), plus a founding/provisioning-layer account-policy decision (ADR 0077 territory — same shape as #485's `credential-type-minimum` oneshot for the founding passkey floor, see `internal/founding`, grep `credential-type-minimum`). ## Why this isn't a mechanical self-fix Fixing only the decode (accept the array) satisfies the compiler and a seam test, but per the spike finding it will **not** close this leg: kanidm still refuses to *commit* a bare admin-set password credential under its default MFA-required policy, so the by-hand temp-password flow will fail one step later with a different error on the next drive. The finding's own two remediation options are structurally different: - (a) extend the runtime account-policy oneshot #485 already applies for founding (`RenderGatewayGuest`/`RenderFrontDoor`) to also cover the by-hand temp-password path, keeping `setPassword` and its "operator hands the person a temp_password" contract (`internal/member/idp.go:33-35`, DDR 0073) intact; or - (b) stop routing by-hand temp-password creation through `setPassword` at all and instead mint a reset-token intent via the already-working `MintResetToken` path (`internal/kanidm/kanidm.go:262-`, `internal/member/reset.go:241`) — the way the smoke-idp-178 lab run had to route around this exact defect — which changes the by-hand UX contract (no more direct temp password handed out). Choosing between those is a design decision, not a one-line fix, and this healer session has no live kanidm to prove either path against (the droplet from this drive is already torn down). ## What plugging it needs 1. Pick the fix shape (extend the account-policy oneshot vs. switch by-hand's temp-password flow to `MintResetToken`) — human/design call, ADR 0077. 2. If keeping `setPassword`: fix its begin-GET decode to the real `[CUSessionToken, CUStatus]` array shape (`kanidm.go:657-661`). 3. Correct `fakekanidm_test.go:322-334`'s begin-GET handler to answer the same array shape, so the seam test would catch this the way #580's POST-body fix did. 4. Prove it live against a clan-lab (or the next rehearsal drive) — `docs/spike-findings/smoke-idp-178.md` shows this exact path was never actually load-bearing on real kanidm before this leg started exercising it. drive `20260822T121105Z` red at `invite-member`: `POST /api/v1/members/by-hand e2e-member failed: 400 {"code":"act_failed","message":"kanidm: decode GET /v1/person/e2e-member/_credential/_update: json: cannot unmarshal array into Go value of type str` evidence: `test-results/…/20260822T121105Z/` on matou-workstation (legs.json, droplet-journal.txt, trace) — a representative screenshot is attached here if one was captured (#596) <!-- rehearsal-sig: 1dc3e7a84786 -->
Author
Member

Close report — advances #662

Ruled by agent under ADR 0174 — veto anytime. Two-way door: revertible by
commit 7b842332, provable by the seam tests (which previously could not
catch this — see below).

What landed

7b842332 — internal/kanidm.setPassword's begin-credential-update GET now
decodes real kanidm's [CUSessionToken, CUStatus] array, not
{"token":...}. Both fake kanidm doubles that had silently drifted to match
the wrong assumption (internal/kanidm/fakekanidm_test.go and the smoke-idp
binary's own control-plane/cmd/smoke-idp/localkanidm.go) are corrected to
the same array shape, so the seam tests now catch this class of drift instead
of only a live drive. docs/GOTCHAS.md #52 records the wire-shape hazard.
STATUS.md updated same commit.

The design question this ticket raised is already closed

The ticket's "why this isn't a mechanical self-fix" section read
smoke-idp-178.md finding 3's fourth defect (kanidm's default
credential-type-minimum = mfa refusing to commit a bare admin-set
password) as still open, needing a ruling between (a) extending the
account-policy oneshot to cover by-hand, or (b) switching by-hand to
MintResetToken.

That ruling was already made — ten days before this ticket's drive — as
ADR 0170 / #485 (landed a54545ea, confirmed live by #494 80b26fa7).
RenderFrontDoor's kanidmCredentialFloorBlock
(internal/clan/frontdoor.go:203-209) unconditionally lowers
idm_all_persons' credential floor to any on every gateway render — own-
VPS, rented, and self-hosted alike (confirmed still unconditional after
#660's public-carrier widening) — and idm_all_persons is the builtin group
every person belongs to, a by-hand member included. The block's own doc
comment already names "a founder (or member) commits a bare password" as the
intent — option (a) was already implemented, generically, for an unrelated
ticket. So there was no live design decision left for this session to make or
park: this was a mechanical two-way-door fix all along.

Proof

TDD red-first: fakekanidm_test.go's begin-GET handler was switched to the
array shape first, reproducing the ticket's exact decode error
(json: cannot unmarshal array into Go value of type struct { Token kanidm.cuToken "json:\"token\"" }) against the unfixed adapter — then the
adapter fix turned it green. go build ./..., go vet ./..., go test ./...
green across every package (57 pkgs, incl. control-plane/cmd/smoke-idp,
which shared the same drifted-double bug), gofmt clean.

NOT re-proved by a fresh live drive this session — the drive's droplet
(20260822T121105Z) was already torn down, and this session-runner class
cannot itself fire the standing rehearsal (#577/ADR 0184 lock). The next
invite-member leg is the live proof, per the #635/#636/#641/#643 precedent
of closing a healed ticket on the strength of seam tests + a landed design
ruling rather than blocking on a drive this session cannot cause.

## Close report — advances #662 **Ruled by agent under ADR 0174 — veto anytime.** Two-way door: revertible by commit `7b842332`, provable by the seam tests (which previously could not catch this — see below). ### What landed `7b842332` — `internal/kanidm.setPassword`'s begin-credential-update GET now decodes real kanidm's `[CUSessionToken, CUStatus]` **array**, not `{"token":...}`. Both fake kanidm doubles that had silently drifted to match the wrong assumption (`internal/kanidm/fakekanidm_test.go` and the smoke-idp binary's own `control-plane/cmd/smoke-idp/localkanidm.go`) are corrected to the same array shape, so the seam tests now catch this class of drift instead of only a live drive. `docs/GOTCHAS.md` #52 records the wire-shape hazard. `STATUS.md` updated same commit. ### The design question this ticket raised is already closed The ticket's "why this isn't a mechanical self-fix" section read `smoke-idp-178.md` finding 3's fourth defect (kanidm's default `credential-type-minimum = mfa` refusing to **commit** a bare admin-set password) as still open, needing a ruling between (a) extending the account-policy oneshot to cover by-hand, or (b) switching by-hand to `MintResetToken`. That ruling was already made — **ten days before this ticket's drive** — as ADR 0170 / #485 (landed `a54545ea`, confirmed live by #494 `80b26fa7`). `RenderFrontDoor`'s `kanidmCredentialFloorBlock` (`internal/clan/frontdoor.go:203-209`) unconditionally lowers `idm_all_persons`' credential floor to `any` on **every** gateway render — own- VPS, rented, and self-hosted alike (confirmed still unconditional after #660's public-carrier widening) — and `idm_all_persons` is the builtin group every person belongs to, a by-hand member included. The block's own doc comment already names "a founder (or member) commits a bare password" as the intent — option (a) was already implemented, generically, for an unrelated ticket. So there was no live design decision left for this session to make or park: this was a mechanical two-way-door fix all along. ### Proof TDD red-first: `fakekanidm_test.go`'s begin-GET handler was switched to the array shape first, reproducing the ticket's exact decode error (`json: cannot unmarshal array into Go value of type struct { Token kanidm.cuToken "json:\"token\"" }`) against the unfixed adapter — then the adapter fix turned it green. `go build ./...`, `go vet ./...`, `go test ./...` green across every package (57 pkgs, incl. `control-plane/cmd/smoke-idp`, which shared the same drifted-double bug), `gofmt` clean. **NOT re-proved by a fresh live drive this session** — the drive's droplet (`20260822T121105Z`) was already torn down, and this session-runner class cannot itself fire the standing rehearsal (#577/ADR 0184 lock). The next `invite-member` leg is the live proof, per the #635/#636/#641/#643 precedent of closing a healed ticket on the strength of seam tests + a landed design ruling rather than blocking on a drive this session cannot cause.
matou-build-agent 2026-08-22 12:36:33 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
Matou/idss#662
No description provided.