kanidm: internal/kanidm's setPassword() posts to the wrong credential-commit route (/v1/credential/_update_commit vs real /v1/credential/_commit) #551

Closed
opened 2026-08-14 23:55:39 +00:00 by ben · 3 comments
Owner

Found live

While driving #319's golden-clan-lab smoke-mail session (ADR 0174 standing), I needed internal/kanidm.Adapter's admin credential-set path (setPassword, internal/kanidm/kanidm.go:590) to give a lab person a primary password, and reproduced its exact REST call sequence by hand against a real kanidm 1.10.3 (the same pinned version this repo targets).

The begin (GET /v1/person/<id>/_credential/_update) and set-password (POST /v1/credential/_update) calls work exactly as setPassword sends them (once the array element order is [CURequest, CUSessionToken] -- confirmed by the server's own deserialization error messages naming which position was expected).

The COMMIT call is wrong: setPassword posts to POST /v1/credential/_update_commit, which returns kanidm's own 404 Route not found (not a generic web-server 404 -- kanidm's router genuinely has no such route). The real route, confirmed by grepping the installed kanidm CLI binary for credential/_update literals (grep -a -o '/v1/credential[a-zA-Z0-9_/]*' <kanidm-binary>), is POST /v1/credential/_commit. Once pointed at the right path (same body shape, the raw CUSessionToken object, not array-wrapped), the commit succeeds (200, credential live, login works).

Impact

Any production/founding code path that calls internal/kanidm.Adapter's admin password-set flow would currently fail at the commit step against a real kanidm 1.10.3 -- this looks like it has never been exercised against real kanidm before (matches the #319 pattern: several real bugs this cycle were found only once code met a REAL deployed service for the first time).

Suggested fix

internal/kanidm/kanidm.go:608 -- change the path from /v1/credential/_update_commit to /v1/credential/_commit. Should be TDD-able against a small local double or, ideally, verified once against a real kanidm the way this finding was (a local kanidmd + curl loop, no clan-lab needed -- same shape as spike #320).

Out of #319's scope (mail's own ticket) -- filed separately per the ticket's "work only this ticket" rule.

Ruled by agent under ADR 0174 -- veto anytime. This is a bug REPORT with a proposed fix, not itself a ruling; no code changed here.

## Found live While driving #319's golden-clan-lab smoke-mail session (ADR 0174 standing), I needed `internal/kanidm.Adapter`'s admin credential-set path (`setPassword`, `internal/kanidm/kanidm.go:590`) to give a lab person a primary password, and reproduced its exact REST call sequence by hand against a real kanidm 1.10.3 (the same pinned version this repo targets). The begin (`GET /v1/person/<id>/_credential/_update`) and set-password (`POST /v1/credential/_update`) calls work exactly as `setPassword` sends them (once the array element order is `[CURequest, CUSessionToken]` -- confirmed by the server's own deserialization error messages naming which position was expected). The COMMIT call is wrong: `setPassword` posts to `POST /v1/credential/_update_commit`, which returns kanidm's own `404 Route not found` (not a generic web-server 404 -- kanidm's router genuinely has no such route). The real route, confirmed by grepping the installed `kanidm` CLI binary for `credential/_update` literals (`grep -a -o '/v1/credential[a-zA-Z0-9_/]*' <kanidm-binary>`), is `POST /v1/credential/_commit`. Once pointed at the right path (same body shape, the raw `CUSessionToken` object, not array-wrapped), the commit succeeds (`200`, credential live, login works). ## Impact Any production/founding code path that calls `internal/kanidm.Adapter`'s admin password-set flow would currently fail at the commit step against a real kanidm 1.10.3 -- this looks like it has never been exercised against real kanidm before (matches the #319 pattern: several real bugs this cycle were found only once code met a REAL deployed service for the first time). ## Suggested fix `internal/kanidm/kanidm.go:608` -- change the path from `/v1/credential/_update_commit` to `/v1/credential/_commit`. Should be TDD-able against a small local double or, ideally, verified once against a real kanidm the way this finding was (a local kanidmd + curl loop, no clan-lab needed -- same shape as spike #320). Out of #319's scope (mail's own ticket) -- filed separately per the ticket's "work only this ticket" rule. Ruled by agent under ADR 0174 -- veto anytime. This is a bug REPORT with a proposed fix, not itself a ruling; no code changed here.
Author
Owner

This was generated by AI during triage.

Verification: Confirmed live in the codebase — the admin credential-set flow's commit step posts to /v1/credential/_update_commit, a route the reporter confirmed (via the installed kanidm 1.10.3 binary and live REST probing) does not exist on real kanidm. The begin and set-password calls in the same flow are correct; only the commit call's path is wrong.

Agent Brief

Category: bug
Summary: The admin password-set flow's commit call posts to a kanidm route that doesn't exist on real kanidm 1.10.3, so the flow fails at the final step every time it's exercised against a real server.

Current behavior:
The kanidm adapter's admin password-set flow issues three REST calls in sequence: a begin call (GET the update-session token), a set-password call (POST the new password), and a commit call. The begin and set-password calls work correctly against real kanidm. The commit call posts to /v1/credential/_update_commit, which kanidm's router does not recognize — it returns kanidm's own genuine 404 Route not found, not a generic web-server 404. Any caller of this flow currently fails at the commit step against a real kanidm server.

Desired behavior:
The commit call posts to the correct route, /v1/credential/_commit, with the same body shape already in use (the raw CUSessionToken object, not array-wrapped). The full begin → set-password → commit sequence succeeds end-to-end against real kanidm: the credential is live and the account can log in with the new password.

Key interfaces:

  • The kanidm adapter's admin setPassword flow — only the commit call's route changes; the request/response handling around it is otherwise correct.

Acceptance criteria:

  • The commit call posts to /v1/credential/_commit, not /v1/credential/_update_commit.
  • A test (unit double or, ideally, a local kanidmd integration test per the spike #320 shape) proves the full begin → set-password → commit sequence succeeds.
  • go build/vet/test and golangci-lint stay green.

Out of scope:

  • Any other kanidm adapter credential flow (e.g. the intent/reset flow at a different route) — only the admin password-set commit call is affected.
  • The #319 mail work this was discovered alongside — unrelated.
> *This was generated by AI during triage.* **Verification:** Confirmed live in the codebase — the admin credential-set flow's commit step posts to `/v1/credential/_update_commit`, a route the reporter confirmed (via the installed kanidm 1.10.3 binary and live REST probing) does not exist on real kanidm. The begin and set-password calls in the same flow are correct; only the commit call's path is wrong. ## Agent Brief **Category:** bug **Summary:** The admin password-set flow's commit call posts to a kanidm route that doesn't exist on real kanidm 1.10.3, so the flow fails at the final step every time it's exercised against a real server. **Current behavior:** The kanidm adapter's admin password-set flow issues three REST calls in sequence: a begin call (GET the update-session token), a set-password call (POST the new password), and a commit call. The begin and set-password calls work correctly against real kanidm. The commit call posts to `/v1/credential/_update_commit`, which kanidm's router does not recognize — it returns kanidm's own genuine `404 Route not found`, not a generic web-server 404. Any caller of this flow currently fails at the commit step against a real kanidm server. **Desired behavior:** The commit call posts to the correct route, `/v1/credential/_commit`, with the same body shape already in use (the raw `CUSessionToken` object, not array-wrapped). The full begin → set-password → commit sequence succeeds end-to-end against real kanidm: the credential is live and the account can log in with the new password. **Key interfaces:** - The kanidm adapter's admin `setPassword` flow — only the commit call's route changes; the request/response handling around it is otherwise correct. **Acceptance criteria:** - [ ] The commit call posts to `/v1/credential/_commit`, not `/v1/credential/_update_commit`. - [ ] A test (unit double or, ideally, a local kanidmd integration test per the spike #320 shape) proves the full begin → set-password → commit sequence succeeds. - [ ] `go build/vet/test` and golangci-lint stay green. **Out of scope:** - Any other kanidm adapter credential flow (e.g. the intent/reset flow at a different route) — only the admin password-set commit call is affected. - The #319 mail work this was discovered alongside — unrelated.
Author
Owner

swarm-claim host=elitebook-distributed-server-03 run=6523
(automated multi-host claim — lowest live claim id works this ticket)

swarm-claim host=elitebook-distributed-server-03 run=6523 (automated multi-host claim — lowest live claim id works this ticket)
Author
Owner

close-report for #551 — status success

✅ close-report gates passed — every claim verified against main; closing.

envelope
{
  "issue": 551,
  "status": "success",
  "commits": [
    "db8ada0e16cc96357cd62809475d3c377e153101"
  ],
  "changed_files": [
    "internal/kanidm/kanidm.go",
    "internal/kanidm/fakekanidm_test.go",
    "control-plane/cmd/smoke-idp/localkanidm.go"
  ],
  "tests": [
    {
      "command": "go build ./...",
      "exit_code": 0
    },
    {
      "command": "go vet ./internal/kanidm/... ./control-plane/cmd/smoke-idp/...",
      "exit_code": 0
    },
    {
      "command": "go test ./internal/kanidm/... ./control-plane/cmd/smoke-idp/...",
      "exit_code": 0
    },
    {
      "command": "golangci-lint run ./internal/kanidm/... ./control-plane/cmd/smoke-idp/...",
      "exit_code": 0
    }
  ],
  "criteria": {
    "The commit call posts to /v1/credential/_commit, not /v1/credential/_update_commit": "internal/kanidm/kanidm.go:608 now posts to /v1/credential/_commit",
    "A test proves the full begin -> set-password -> commit sequence succeeds": "fakekanidm_test.go double serves only the real /v1/credential/_commit route; every CreatePerson-seeded test (e.g. TestCreatePerson_ByHand_EnabledAndIdempotent) drives begin->set-password->commit end-to-end and passes; regression to the old path 404s red (confirmed pre-fix)",
    "go build/vet/test and golangci-lint stay green": "all four commands exit 0 on both affected packages"
  },
  "summary": "kanidm setPassword commits to the real route /v1/credential/_commit so admin password-set succeeds against real kanidm 1.10.3.",
  "blockers": []
}
**close-report** for #551 — status `success` :white_check_mark: **close-report gates passed** — every claim verified against main; closing. <details><summary>envelope</summary> ```json { "issue": 551, "status": "success", "commits": [ "db8ada0e16cc96357cd62809475d3c377e153101" ], "changed_files": [ "internal/kanidm/kanidm.go", "internal/kanidm/fakekanidm_test.go", "control-plane/cmd/smoke-idp/localkanidm.go" ], "tests": [ { "command": "go build ./...", "exit_code": 0 }, { "command": "go vet ./internal/kanidm/... ./control-plane/cmd/smoke-idp/...", "exit_code": 0 }, { "command": "go test ./internal/kanidm/... ./control-plane/cmd/smoke-idp/...", "exit_code": 0 }, { "command": "golangci-lint run ./internal/kanidm/... ./control-plane/cmd/smoke-idp/...", "exit_code": 0 } ], "criteria": { "The commit call posts to /v1/credential/_commit, not /v1/credential/_update_commit": "internal/kanidm/kanidm.go:608 now posts to /v1/credential/_commit", "A test proves the full begin -> set-password -> commit sequence succeeds": "fakekanidm_test.go double serves only the real /v1/credential/_commit route; every CreatePerson-seeded test (e.g. TestCreatePerson_ByHand_EnabledAndIdempotent) drives begin->set-password->commit end-to-end and passes; regression to the old path 404s red (confirmed pre-fix)", "go build/vet/test and golangci-lint stay green": "all four commands exit 0 on both affected packages" }, "summary": "kanidm setPassword commits to the real route /v1/credential/_commit so admin password-set succeeds against real kanidm 1.10.3.", "blockers": [] } ``` </details>
ben closed this issue 2026-08-15 01:23:58 +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.

Dependencies

No dependencies set.

Reference
Matou/idss#551
No description provided.