idip: bridge identity claims — derived handle, AID-derived email, and role claims #1917

Closed
opened 2026-09-27 18:44:16 +00:00 by ben · 6 comments
Owner

Parent

#1915

What to build

The bridge carries, beside sub (the AID): a derived handle u + first 20 lowercase hex of sha256(AID) (21 chars, lowercase, letter-first) as its own claim; an AID-derived email as its own claim (never in email); and the operator role in the shapes the services' renders map (a groups membership plus the per-service role claim names), from the roster's live operator standing.

Acceptance criteria

  • Claims-seam tests: the handle and derived email are stable per AID and unique across AIDs differing only by case
  • A live steward's token carries the operator role in every declared shape; a member's does not; a demoted steward's next token drops it
  • email still carries only a real address on record

Blocked by

None — can start immediately

## Parent #1915 ## What to build The bridge carries, beside `sub` (the AID): a derived handle `u` + first 20 lowercase hex of sha256(AID) (21 chars, lowercase, letter-first) as its own claim; an AID-derived email as its own claim (never in `email`); and the operator role in the shapes the services' renders map (a `groups` membership plus the per-service role claim names), from the roster's live operator standing. ## Acceptance criteria - [ ] Claims-seam tests: the handle and derived email are stable per AID and unique across AIDs differing only by case - [ ] A live steward's token carries the operator role in every declared shape; a member's does not; a demoted steward's next token drops it - [ ] `email` still carries only a real address on record ## Blocked by None — can start immediately

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

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

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

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

swarm-claim host=bens-mac-04 run=34318
(automated multi-host claim — lowest live claim id works this ticket)

swarm-claim host=bens-mac-04 run=34318 (automated multi-host claim — lowest live claim id works this ticket)

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

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

Ruled by agent under ADR 0174 — veto anytime.

Decision: the two AID-derived claims the bridge sends "as their own claim beside sub" (this ticket) are named handle (the derived username u+20 hex of sha256(AID)) and derived_email (the AID-derived address). The operator-role shapes reuse the exact claim NAMES the services' existing kanidm claim maps already read — groups (operators, Forgejo), ocgroups (admin, Nextcloud), role=administrator (PeerTube, video.go), roles/owner+member (Gramps, whakapapa.go), pgroups/admins+members (Paperless, paperless.go) — so each service's IDIP render only switches the issuer, never the claim name.

Why a two-way door: revertible by a later commit — no service render ticket has landed that reads handle/derived_email yet, so renaming later costs nothing and touches no live community. Not on the one-way-door list (no credential, no security-posture widening, no data destruction). The per-service role claim names are not a choice at all: they are what the kanidm-path renders already map.

What proves it: internal/idp TestDerivedHandle_StablePerAID_UniqueAcrossCase (stable per AID, unique across case, 21-char lowercase letter-first), TestSeam_IDIPClaims_OperatorCarriesRoleInEveryDeclaredShape, TestSeam_IDIPClaims_MemberCarriesNoOperatorShape, TestSetUserinfo_DemotedStewardDropsOperatorRole.

**Ruled by agent under ADR 0174 — veto anytime.** **Decision:** the two AID-derived claims the bridge sends "as their own claim beside `sub`" (this ticket) are named **`handle`** (the derived username `u`+20 hex of sha256(AID)) and **`derived_email`** (the AID-derived address). The operator-role shapes reuse the exact claim NAMES the services' existing kanidm claim maps already read — `groups` (operators, Forgejo), `ocgroups` (admin, Nextcloud), `role`=`administrator` (PeerTube, video.go), `roles`/`owner`+`member` (Gramps, whakapapa.go), `pgroups`/`admins`+`members` (Paperless, paperless.go) — so each service's IDIP render only switches the issuer, never the claim name. **Why a two-way door:** revertible by a later commit — no service render ticket has landed that reads `handle`/`derived_email` yet, so renaming later costs nothing and touches no live community. Not on the one-way-door list (no credential, no security-posture widening, no data destruction). The per-service role claim names are not a choice at all: they are what the kanidm-path renders already map. **What proves it:** `internal/idp` `TestDerivedHandle_StablePerAID_UniqueAcrossCase` (stable per AID, unique across case, 21-char lowercase letter-first), `TestSeam_IDIPClaims_OperatorCarriesRoleInEveryDeclaredShape`, `TestSeam_IDIPClaims_MemberCarriesNoOperatorShape`, `TestSetUserinfo_DemotedStewardDropsOperatorRole`.

close-report for #1917 — status success

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

envelope
{
  "issue": 1917,
  "status": "success",
  "commits": [
    "0073b9dde7e64da33923dd7069c9239e153eeaca"
  ],
  "changed_files": [
    "STATUS.md",
    "internal/idp/claims_1917_seam_test.go",
    "internal/idp/seam_test.go",
    "internal/idp/storage.go",
    "internal/idp/verifier.go"
  ],
  "tests": [
    {
      "command": "go test ./internal/idp/...",
      "exit_code": 0
    },
    {
      "command": "nix develop .#go-ci --command bash -c 'gofmt -l . ; go build ./... ; go vet ./... ; go test ./... ; golangci-lint run ./...'",
      "exit_code": 0
    }
  ],
  "criteria": {
    "Claims-seam tests: the handle and derived email are stable per AID and unique across AIDs differing only by case": "internal/idp/verifier.go derivedHandle = \"u\"+sha256(AID)[:20] (case-sensitive); internal/idp/claims_1917_seam_test.go TestDerivedHandle_StablePerAID_UniqueAcrossCase asserts stability, 21-char lowercase letter-first format, and that an AID and its case-variant produce different handle and derived email; empty apex yields no email",
    "A live steward's token carries the operator role in every declared shape; a member's does not; a demoted steward's next token drops it": "internal/idp/storage.go setUserinfo emits the operator role in groups(operators)+ocgroups(admin)+role(administrator, PeerTube)+roles(owner, Gramps)+pgroups(admins, Paperless), keyed to the operator role alone; TestSeam_IDIPClaims_OperatorCarriesRoleInEveryDeclaredShape (operator has all), TestSeam_IDIPClaims_MemberCarriesNoOperatorShape (member has none, lands base defaults), TestSetUserinfo_DemotedStewardDropsOperatorRole (same AID re-minted as member drops every operator value)",
    "email still carries only a real address on record": "internal/idp/storage.go keeps `email` guarded by id.Claims.Email != \"\"; the AID-derived address rides its own derived_email claim; TestSeam_IDIPClaims_OperatorCarriesRoleInEveryDeclaredShape asserts email == the real address and != derived_email, and TestSeam_IDIPClaims_MemberCarriesNoOperatorShape asserts email is absent for a member with no real address"
  },
  "summary": "The IDIP bridge mints an AID-derived handle and email as their own OIDC claims and the operator role in every declared per-service shape, keeping `email` for real addresses only.",
  "blockers": []
}
**close-report** for #1917 — status `success` :white_check_mark: **close-report gates passed** — every claim verified against main; issue closed. <details><summary>envelope</summary> ```json { "issue": 1917, "status": "success", "commits": [ "0073b9dde7e64da33923dd7069c9239e153eeaca" ], "changed_files": [ "STATUS.md", "internal/idp/claims_1917_seam_test.go", "internal/idp/seam_test.go", "internal/idp/storage.go", "internal/idp/verifier.go" ], "tests": [ { "command": "go test ./internal/idp/...", "exit_code": 0 }, { "command": "nix develop .#go-ci --command bash -c 'gofmt -l . ; go build ./... ; go vet ./... ; go test ./... ; golangci-lint run ./...'", "exit_code": 0 } ], "criteria": { "Claims-seam tests: the handle and derived email are stable per AID and unique across AIDs differing only by case": "internal/idp/verifier.go derivedHandle = \"u\"+sha256(AID)[:20] (case-sensitive); internal/idp/claims_1917_seam_test.go TestDerivedHandle_StablePerAID_UniqueAcrossCase asserts stability, 21-char lowercase letter-first format, and that an AID and its case-variant produce different handle and derived email; empty apex yields no email", "A live steward's token carries the operator role in every declared shape; a member's does not; a demoted steward's next token drops it": "internal/idp/storage.go setUserinfo emits the operator role in groups(operators)+ocgroups(admin)+role(administrator, PeerTube)+roles(owner, Gramps)+pgroups(admins, Paperless), keyed to the operator role alone; TestSeam_IDIPClaims_OperatorCarriesRoleInEveryDeclaredShape (operator has all), TestSeam_IDIPClaims_MemberCarriesNoOperatorShape (member has none, lands base defaults), TestSetUserinfo_DemotedStewardDropsOperatorRole (same AID re-minted as member drops every operator value)", "email still carries only a real address on record": "internal/idp/storage.go keeps `email` guarded by id.Claims.Email != \"\"; the AID-derived address rides its own derived_email claim; TestSeam_IDIPClaims_OperatorCarriesRoleInEveryDeclaredShape asserts email == the real address and != derived_email, and TestSeam_IDIPClaims_MemberCarriesNoOperatorShape asserts email is absent for a member with no real address" }, "summary": "The IDIP bridge mints an AID-derived handle and email as their own OIDC claims and the operator role in every declared per-service shape, keeping `email` for real addresses only.", "blockers": [] } ``` </details>
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#1917
No description provided.