idip: Mattermost (chat) signs in through the bridge, keyed on the derived handle #1923

Open
opened 2026-09-27 18:44:39 +00:00 by ben · 1 comment
Owner

Parent

#1915

What to build

Mattermost's IDIP render branch: sign-in through the bridge (not kanidm's GitLab-shaped paths), username = the derived handle, account bound to sub, display name from name, steward → system admin. The chat port's lookup-by-username uses the derived handle on IDIP.

Acceptance criteria

  • IDIP render test; chat port resolves the derived handle on IDIP
  • The kanidm-path render is byte-identical before and after (guard test)
  • Live proof on an IDIP gateway: a member and a steward sign in and land in two distinct accounts keyed as ruled, the steward as admin; screenshots/evidence attached

Blocked by

## Parent #1915 ## What to build Mattermost's IDIP render branch: sign-in through the bridge (not kanidm's GitLab-shaped paths), username = the derived handle, account bound to `sub`, display name from `name`, steward → system admin. The chat port's lookup-by-username uses the derived handle on IDIP. ## Acceptance criteria - [ ] IDIP render test; chat port resolves the derived handle on IDIP - [ ] The kanidm-path render is byte-identical before and after (guard test) - [ ] Live proof on an IDIP gateway: a member and a steward sign in and land in two distinct accounts keyed as ruled, the steward as admin; screenshots/evidence attached ## Blocked by - #1918

Blocked on a design decision — asked a human, no reply within the wait

Working #1923 I hit a decision that is not mine to rule under ADR 0174: it is not provable by any test I can run in the sandbox (there is no live IDIP+Mattermost gateway), and one option widens a stated security invariant. I posted the question to the ask-human thread; no reply came within the wait, so per the workflow I am parking this for a human rather than re-asking or guessing.

The decision

The render must make Mattermost's username = the derived handle, but Mattermost's SSO (GitLabSettings, the shipped kanidm render in internal/clan/chat.go) has no username-claim mapping knob — it consumes the OIDC userinfo and reads the standard claims (username ← preferred_username, id ← sub; confirmed by the kanidm render pointing UserAPIEndpoint at the OIDC userinfo).

On IDIP the bridge (internal/idp/storage.go, setUserinfo) sends the AID-derived handle only in its own handle claim, and by design (#1908/#1917) never in preferred_username — which stays the member-chosen, non-unique handle. So repointing Mattermost at the bridge as-is would key its username on the colliding member handle, which is precisely the failure #1915 exists to prevent (and a render string-match would "pass" while sign-in strands two members in one account — the #1903 anti-pattern the spec warns against).

Making username = derived handle real therefore needs a bridge-side choice:

  • (A) For the mattermost client only, the bridge sets preferred_username = derived handle — an explicit per-client exception to #1908. The render then just repoints the three GitLabSettings endpoints at the bridge.
  • (B) The bridge exposes a per-client Mattermost/GitLab-shaped userinfo (id=sub, username=handle, name, email) for the mattermost client.
  • (C) Mattermost's pinned build exposes a username-claim setting I have not found — if so, which, and the render uses it.

Also blocking AC3 (live proof)

The chat port is not wired into deploy: AttachChat has no production caller, chat is not in portAttachers, and no kanidm OAuth2 client for Mattermost is provisioned anywhere. So AC3's "live proof on an IDIP gateway" is not producible this iteration. Either a seam-proof is accepted under ADR 0174 (as #1918/#1925 did for their live-proof clauses), or this ticket first needs the chat deploy path — which is out of this slice's scope (needs-design).

What a human must decide to re-arm this

  1. Pick mechanism (A) / (B) / (C) for username = derived handle (this settles whether internal/idp/storage.go changes, and whether #1908 gets a documented per-client exception).
  2. Rule whether AC3's live proof is deferred (seam-proof under ADR 0174) or gated on wiring chat into deploy first.

The chatsvc half — the port's lookup-by-username resolving derivedHandle(AID) on IDIP (mirroring keria.BackendEmail) — is unambiguous and ready to build the moment (1) is settled.

Why human

Not a two-way door I can rule: the choice is not provable by a test I can run (no live IDIP+Mattermost gateway exists), and option (A) widens a security invariant (#1908, the member-chosen preferred_username rule). Both need a human's call.

## Blocked on a design decision — asked a human, no reply within the wait Working #1923 I hit a decision that is not mine to rule under ADR 0174: it is **not provable by any test I can run** in the sandbox (there is no live IDIP+Mattermost gateway), and one option widens a stated security invariant. I posted the question to the ask-human thread; no reply came within the wait, so per the workflow I am parking this for a human rather than re-asking or guessing. ### The decision The render must make **Mattermost's username = the derived handle**, but Mattermost's SSO (`GitLabSettings`, the shipped kanidm render in `internal/clan/chat.go`) has **no username-claim mapping knob** — it consumes the OIDC userinfo and reads the standard claims (username ← `preferred_username`, id ← `sub`; confirmed by the kanidm render pointing `UserAPIEndpoint` at the OIDC userinfo). On IDIP the bridge (`internal/idp/storage.go`, `setUserinfo`) sends the AID-derived handle only in its **own `handle` claim**, and by design (#1908/#1917) **never** in `preferred_username` — which stays the **member-chosen, non-unique** handle. So repointing Mattermost at the bridge as-is would key its username on the *colliding* member handle, which is precisely the failure #1915 exists to prevent (and a render string-match would "pass" while sign-in strands two members in one account — the #1903 anti-pattern the spec warns against). Making `username = derived handle` real therefore needs a **bridge-side** choice: - **(A)** For the `mattermost` client only, the bridge sets `preferred_username` = derived handle — an explicit **per-client exception to #1908**. The render then just repoints the three `GitLabSettings` endpoints at the bridge. - **(B)** The bridge exposes a **per-client Mattermost/GitLab-shaped userinfo** (`id`=sub, `username`=handle, `name`, `email`) for the `mattermost` client. - **(C)** Mattermost's pinned build exposes a username-claim setting I have not found — if so, which, and the render uses it. ### Also blocking AC3 (live proof) The **chat port is not wired into deploy**: `AttachChat` has no production caller, `chat` is not in `portAttachers`, and no kanidm OAuth2 client for Mattermost is provisioned anywhere. So AC3's "live proof on an IDIP gateway" is **not producible** this iteration. Either a seam-proof is accepted under ADR 0174 (as #1918/#1925 did for their live-proof clauses), or this ticket first needs the chat deploy path — which is out of this slice's scope (`needs-design`). ### What a human must decide to re-arm this 1. Pick mechanism **(A) / (B) / (C)** for `username = derived handle` (this settles whether `internal/idp/storage.go` changes, and whether #1908 gets a documented per-client exception). 2. Rule whether AC3's live proof is deferred (seam-proof under ADR 0174) or gated on wiring chat into deploy first. The chatsvc half — the port's lookup-by-username resolving `derivedHandle(AID)` on IDIP (mirroring `keria.BackendEmail`) — is unambiguous and ready to build the moment (1) is settled. ## Why human Not a two-way door I can rule: the choice is **not provable by a test I can run** (no live IDIP+Mattermost gateway exists), and option (A) **widens a security invariant** (#1908, the member-chosen `preferred_username` rule). Both need a human's call.
Sign in to join this conversation.
No milestone
No project
No assignees
2 participants
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#1923
No description provided.