bug: every other preferred_username-keyed service (Gramps, video, newsletters, surveys, Paperless, portroute) carries the same IDIP username collision #1902 fixed for Files #1903

Closed
opened 2026-09-25 21:26:51 +00:00 by matou-build-agent · 3 comments

Symptom

Sibling of #1902 (Files/Nextcloud), which was fixed by keying the Nextcloud account uid on the member's AID (sub) on the IDIP path instead of preferred_username. Every OTHER community service that keys accounts/records on the preferred_username claim carries the SAME collision on the IDIP path: the bridge takes preferred_username from the member's own credential (identityFromVerdict, internal/idp/ledger_verifier.go) and nothing makes it unique, so two IDIP members who chose the same username collide onto one account/record.

Services still exposed (from #1902's cause analysis, not yet verified live per service)

  • Gramps / whakapapa (internal/clan/whakapapa.go:~645)
  • video (internal/clan/video.go:~660)
  • newsletters
  • surveys
  • Paperless
  • portroute

kanidm communities are NOT exposed (kanidm already makes preferred_username unique, #866).

What is needed

A ruling (the same A/B shape #1902 faced) per service, then the fix: on the IDIP path, key each service on the member's AID (sub, ADR 0196) — or the ruled equivalent — the way #1902 did for Nextcloud. Each service verifies that two IDIP members with the same preferred_username get two separate accounts/records.

References

  • #1902 (the Nextcloud fix + Ben's A1 ruling), GOTCHAS #349
  • ADR 0196 (sub = AID), ADR 0212 / #788 (the IDIP bridge), #866 (why preferred_username on kanidm)

Filed while working #1902 (its ruling scoped these services out as "a separate ticket").

## Symptom Sibling of #1902 (Files/Nextcloud), which was fixed by keying the Nextcloud account uid on the member's AID (`sub`) on the IDIP path instead of `preferred_username`. Every OTHER community service that keys accounts/records on the `preferred_username` claim carries the SAME collision on the IDIP path: the bridge takes `preferred_username` from the member's own credential (`identityFromVerdict`, `internal/idp/ledger_verifier.go`) and nothing makes it unique, so two IDIP members who chose the same username collide onto one account/record. ## Services still exposed (from #1902's cause analysis, not yet verified live per service) - Gramps / whakapapa (`internal/clan/whakapapa.go:~645`) - video (`internal/clan/video.go:~660`) - newsletters - surveys - Paperless - portroute kanidm communities are NOT exposed (kanidm already makes `preferred_username` unique, #866). ## What is needed A ruling (the same A/B shape #1902 faced) per service, then the fix: on the IDIP path, key each service on the member's AID (`sub`, ADR 0196) — or the ruled equivalent — the way #1902 did for Nextcloud. Each service verifies that two IDIP members with the same `preferred_username` get two separate accounts/records. ## References - #1902 (the Nextcloud fix + Ben's A1 ruling), GOTCHAS #349 - ADR 0196 (`sub` = AID), ADR 0212 / #788 (the IDIP bridge), #866 (why `preferred_username` on kanidm) Filed while working #1902 (its ruling scoped these services out as "a separate ticket").
Author
Member

This was generated by AI during triage.

Ruled by agent under ADR 0174 — veto anytime

Ruling: this is a verify-first sibling of #1902, labelled bug + ready-for-agent. The A/B architectural choice is NOT reopened per service — Ben already ruled A1 on #1902 (key on the AID, sub, on the IDIP path; kanidm unchanged; no migration). The remaining work is, per service, to determine whether an exposed IDIP path even exists and, only where it does, apply that same doctrine.

Why this is a two-way door. Each service's OIDC claim mapping is a one-line render change, revertible by a later commit, and provable by a per-service render test plus a "two IDIP members, same preferred_username" collision test — the exact shape #1902 pins. It closes an impersonation hole (it does not widen security posture), destroys no data (A1 leaves existing accounts behind), touches no credentials and spends nothing. None of the one-way-door residues apply; the only genuinely human call — A vs B — was already made on #1902.

What I verified in the code (correcting the ticket's premise)

The ticket carries #1902's cause analysis "not yet verified live per service". I looked. All six named services provision against co-located kanidm OAuth2 clients, and kanidm already makes preferred_username unique (#866) — which #1902's own ruling states is NOT exposed:

  • Gramps/whakapapa — whakapapaOIDCClientID, "the kanidm whakapapa OAuth2 client (co-located, loopback)" (internal/clan/whakapapa.go:161,215).
  • video — "Video consumes kanidm OIDC … a video node with no co-located kanidm carries no IdP host, so this renders nothing" (internal/clan/video.go:44,517-518,558).
  • newsletters — "the kanidm newsletters OAuth2 client … the files.go:822 pattern … no co-located kanidm carries no IdP host" (internal/clan/newsletters.go:77,174,538).
  • surveys — identity header carries preferred_username, superadmin set reconciled from the ledger (internal/clan/surveys.go:227).
  • paperless — paperlessOIDCProviderName = "kanidm" (internal/clan/paperless.go:111,122).
  • portroute — preferred_username from the operator account (internal/clan/portroute.go:42).

The Files/Nextcloud collision existed because Nextcloud has a second render block — the device/IDIP-bridge provider whose discovery is the PUBLIC IDIP issuer (cfg.OIDCDiscoveryURL, internal/clan/files.go:1172-1173), not kanidm; on that path nothing makes preferred_username unique. I did not find an equivalent IDIP/bridge render branch in any of the six services above — they appear kanidm-only. I did keyword-grade tracing, not an exhaustive read of every render path, so this is "likely not exposed", not proven.

⚠️ Regression warning for the implementing agent

These services key on kanidm's preferred_username on purpose — kanidm makes it unique (#866), and it is the correct handle there. Do NOT blindly flip these mappings to sub. Changing the kanidm claim would break kanidm sign-in for a case that was never broken. The fix applies ONLY to a genuine IDIP/bridge render path (a block whose discovery URI is the public IDIP issuer, like files.go:1172), if one exists for that service.

Agent brief

Depends on #1902 (native dependency added) — land the Nextcloud IDIP fix first; it is the reference implementation for the AID-keyed IDIP block.

For each service in {Gramps/whakapapa, video, newsletters, surveys, paperless, portroute}, do the verify-then-fix loop:

  1. Locate the OIDC render path(s). Determine whether the service renders an IDIP/bridge OIDC provider — a block whose discovery URI is the public IDIP issuer (cfg.OIDCDiscoveryURL), the way internal/clan/files.go:1172-1173 does — separate from its co-located kanidm client.
  2. If no IDIP path exists (the service only ever provisions a kanidm client): it is NOT exposed to this collision. Record that finding in the ticket with the file/line evidence and add a small assertion/comment pinning "kanidm-only, keys on kanidm's unique preferred_username" so a future reader doesn't re-file. No mapping change.
  3. If an IDIP path exists: apply #1902's A1 doctrine on that path — key the account/record on the member's AID (sub, ADR 0196), leave the kanidm path on preferred_username, no migration of existing accounts. Pin with a render test (IDIP branch → sub, kanidm branch → preferred_username) and a collision test (two IDIP members with the same preferred_username get two separate accounts/records).

Acceptance criteria

  • Each of the six services has, in the ticket, either (a) a recorded finding + code assertion that it is kanidm-only and not exposed, or (b) a landed IDIP-path fix keying on sub with the two tests above.
  • No kanidm render path's preferred_username mapping is changed (a render/assertion guards this).
  • GOTCHAS #349 and this ticket agree on which services were exposed.

References

  • #1902 (Nextcloud fix + Ben's A1 ruling), GOTCHAS #349
  • ADR 0196 (sub = AID), ADR 0212 / #788 (the IDIP bridge), #866 (why preferred_username is safe on kanidm)
> *This was generated by AI during triage.* ## Ruled by agent under ADR 0174 — veto anytime **Ruling: this is a verify-first sibling of #1902, labelled `bug` + `ready-for-agent`. The A/B architectural choice is NOT reopened per service — Ben already ruled A1 on #1902 (key on the AID, `sub`, on the IDIP path; kanidm unchanged; no migration). The remaining work is, per service, to determine whether an exposed IDIP path even exists and, only where it does, apply that same doctrine.** **Why this is a two-way door.** Each service's OIDC claim mapping is a one-line render change, revertible by a later commit, and provable by a per-service render test plus a "two IDIP members, same `preferred_username`" collision test — the exact shape #1902 pins. It closes an impersonation hole (it does not widen security posture), destroys no data (A1 leaves existing accounts behind), touches no credentials and spends nothing. None of the one-way-door residues apply; the only genuinely human call — A vs B — was already made on #1902. ## What I verified in the code (correcting the ticket's premise) The ticket carries #1902's cause analysis "not yet verified live per service". I looked. **All six named services provision against co-located kanidm OAuth2 clients**, and kanidm already makes `preferred_username` unique (#866) — which #1902's own ruling states is **NOT exposed**: - Gramps/whakapapa — `whakapapaOIDCClientID`, "the kanidm `whakapapa` OAuth2 client (co-located, loopback)" (`internal/clan/whakapapa.go:161,215`). - video — "Video consumes kanidm OIDC … a video node with no co-located kanidm carries no IdP host, so this renders nothing" (`internal/clan/video.go:44,517-518,558`). - newsletters — "the kanidm `newsletters` OAuth2 client … the files.go:822 pattern … no co-located kanidm carries no IdP host" (`internal/clan/newsletters.go:77,174,538`). - surveys — identity header carries `preferred_username`, superadmin set reconciled from the ledger (`internal/clan/surveys.go:227`). - paperless — `paperlessOIDCProviderName = "kanidm"` (`internal/clan/paperless.go:111,122`). - portroute — `preferred_username` from the operator account (`internal/clan/portroute.go:42`). The Files/Nextcloud collision existed because Nextcloud has a **second render block — the device/IDIP-bridge provider** whose discovery is the PUBLIC IDIP issuer (`cfg.OIDCDiscoveryURL`, `internal/clan/files.go:1172-1173`), not kanidm; on that path nothing makes `preferred_username` unique. I did not find an equivalent IDIP/bridge render branch in any of the six services above — they appear kanidm-only. I did keyword-grade tracing, not an exhaustive read of every render path, so this is "likely not exposed", not proven. ## ⚠️ Regression warning for the implementing agent These services key on kanidm's `preferred_username` **on purpose** — kanidm makes it unique (#866), and it is the correct handle there. **Do NOT blindly flip these mappings to `sub`.** Changing the kanidm claim would break kanidm sign-in for a case that was never broken. The fix applies ONLY to a genuine IDIP/bridge render path (a block whose discovery URI is the public IDIP issuer, like `files.go:1172`), if one exists for that service. ## Agent brief **Depends on #1902** (native dependency added) — land the Nextcloud IDIP fix first; it is the reference implementation for the AID-keyed IDIP block. For each service in {Gramps/whakapapa, video, newsletters, surveys, paperless, portroute}, do the verify-then-fix loop: 1. **Locate the OIDC render path(s).** Determine whether the service renders an IDIP/bridge OIDC provider — a block whose discovery URI is the public IDIP issuer (`cfg.OIDCDiscoveryURL`), the way `internal/clan/files.go:1172-1173` does — separate from its co-located kanidm client. 2. **If no IDIP path exists** (the service only ever provisions a kanidm client): it is NOT exposed to this collision. Record that finding in the ticket with the file/line evidence and add a small assertion/comment pinning "kanidm-only, keys on kanidm's unique `preferred_username`" so a future reader doesn't re-file. No mapping change. 3. **If an IDIP path exists:** apply #1902's A1 doctrine on that path — key the account/record on the member's AID (`sub`, ADR 0196), leave the kanidm path on `preferred_username`, no migration of existing accounts. Pin with a render test (IDIP branch → `sub`, kanidm branch → `preferred_username`) and a collision test (two IDIP members with the same `preferred_username` get two separate accounts/records). **Acceptance criteria** - [ ] Each of the six services has, in the ticket, either (a) a recorded finding + code assertion that it is kanidm-only and not exposed, or (b) a landed IDIP-path fix keying on `sub` with the two tests above. - [ ] No kanidm render path's `preferred_username` mapping is changed (a render/assertion guards this). - [ ] GOTCHAS #349 and this ticket agree on which services were exposed. ## References - #1902 (Nextcloud fix + Ben's A1 ruling), GOTCHAS #349 - ADR 0196 (`sub` = AID), ADR 0212 / #788 (the IDIP bridge), #866 (why `preferred_username` is safe on kanidm)
Author
Member

swarm-claim host=matou-dev-server-01 run=33025
(automated multi-host claim — lowest live claim id works this ticket)

swarm-claim host=matou-dev-server-01 run=33025 (automated multi-host claim — lowest live claim id works this ticket)
Author
Member

close-report for #1903 — status success

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

envelope
{
  "issue": 1903,
  "status": "success",
  "commits": [
    "b509319cd8be8211ab241fb2ea828b87ff15f594"
  ],
  "changed_files": [
    "STATUS.md",
    "docs/GOTCHAS.md",
    "internal/clan/datacollections.go",
    "internal/clan/idip_username_collision_1903_test.go",
    "internal/clan/newsletters.go",
    "internal/clan/paperless.go",
    "internal/clan/portroute.go",
    "internal/clan/surveys.go",
    "internal/clan/video.go",
    "internal/clan/whakapapa.go",
    "internal/controlapi/oidcprovider_test.go"
  ],
  "tests": [
    {
      "command": "go test ./internal/clan/ ./internal/controlapi/ -count=1",
      "exit_code": 0
    },
    {
      "command": "nix develop .#go-ci (pre-push gate: full go test ./... + golangci-lint)",
      "exit_code": 0
    }
  ],
  "criteria": {
    "Each of the six services has a recorded finding + code assertion that it is not exposed (or a landed IDIP-path fix)": "VERIFIED NOT EXPOSED for all six. Findings recorded in this comment + STATUS.md + GOTCHAS #349. Code assertions: #1903-verified comments at each keying site (whakapapa.go GRAMPSWEB_OIDC_USERNAME_CLAIM, video.go username-property, newsletters.go OIDC render, paperless.go, surveys.go SurveysConfig.Operators, datacollections.go dataCollectionsIdentityHeader, portroute.go PortPlacement.Operator) + guard tests TestIDIP1903_OIDCServicesKeyOnCoLocatedKanidmNotBridge and TestIDIP1903_HeaderTrustingServicesTrustTheGateIdentity (internal/clan/idip_username_collision_1903_test.go) + TestBridgeOIDC_KeysIdentityOnSubNotUsername (internal/controlapi/oidcprovider_test.go).",
    "No kanidm render path's preferred_username mapping is changed (a render/assertion guards this)": "No mapping changed (git diff shows only comment + test additions, no WriteString mapping edits). TestIDIP1903_OIDCServicesKeyOnCoLocatedKanidmNotBridge asserts each of the four kanidm services keeps its co-located kanidm issuer + prefer-short-username, failing if repointed at the bridge root.",
    "GOTCHAS #349 and this ticket agree on which services were exposed": "GOTCHAS #349 amended (docs/GOTCHAS.md) to record that #1903 verified the other six services are NOT exposed and Files was the sole hole — matching this ticket's finding."
  },
  "summary": "Verified none of the six other preferred_username-keyed services carry the #1902 IDIP collision (Files was the sole hole) — four are kanidm-only-unique, two receive the AID via the gate on IDIP — and pinned each finding with comments + guard tests.",
  "blockers": []
}
**close-report** for #1903 — status `success` :white_check_mark: **close-report gates passed** — every claim verified against main; issue closed. <details><summary>envelope</summary> ```json { "issue": 1903, "status": "success", "commits": [ "b509319cd8be8211ab241fb2ea828b87ff15f594" ], "changed_files": [ "STATUS.md", "docs/GOTCHAS.md", "internal/clan/datacollections.go", "internal/clan/idip_username_collision_1903_test.go", "internal/clan/newsletters.go", "internal/clan/paperless.go", "internal/clan/portroute.go", "internal/clan/surveys.go", "internal/clan/video.go", "internal/clan/whakapapa.go", "internal/controlapi/oidcprovider_test.go" ], "tests": [ { "command": "go test ./internal/clan/ ./internal/controlapi/ -count=1", "exit_code": 0 }, { "command": "nix develop .#go-ci (pre-push gate: full go test ./... + golangci-lint)", "exit_code": 0 } ], "criteria": { "Each of the six services has a recorded finding + code assertion that it is not exposed (or a landed IDIP-path fix)": "VERIFIED NOT EXPOSED for all six. Findings recorded in this comment + STATUS.md + GOTCHAS #349. Code assertions: #1903-verified comments at each keying site (whakapapa.go GRAMPSWEB_OIDC_USERNAME_CLAIM, video.go username-property, newsletters.go OIDC render, paperless.go, surveys.go SurveysConfig.Operators, datacollections.go dataCollectionsIdentityHeader, portroute.go PortPlacement.Operator) + guard tests TestIDIP1903_OIDCServicesKeyOnCoLocatedKanidmNotBridge and TestIDIP1903_HeaderTrustingServicesTrustTheGateIdentity (internal/clan/idip_username_collision_1903_test.go) + TestBridgeOIDC_KeysIdentityOnSubNotUsername (internal/controlapi/oidcprovider_test.go).", "No kanidm render path's preferred_username mapping is changed (a render/assertion guards this)": "No mapping changed (git diff shows only comment + test additions, no WriteString mapping edits). TestIDIP1903_OIDCServicesKeyOnCoLocatedKanidmNotBridge asserts each of the four kanidm services keeps its co-located kanidm issuer + prefer-short-username, failing if repointed at the bridge root.", "GOTCHAS #349 and this ticket agree on which services were exposed": "GOTCHAS #349 amended (docs/GOTCHAS.md) to record that #1903 verified the other six services are NOT exposed and Files was the sole hole — matching this ticket's finding." }, "summary": "Verified none of the six other preferred_username-keyed services carry the #1902 IDIP collision (Files was the sole hole) — four are kanidm-only-unique, two receive the AID via the gate on IDIP — and pinned each finding with comments + guard tests.", "blockers": [] } ``` </details>
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#1903
No description provided.