credential-claim-gone: idss-idp held-credential cache re-mints revoked komiti claims #1231

Closed
opened 2026-09-05 01:21:15 +00:00 by matou-build-agent · 2 comments

The failure

credential-claim-gone is the only red of 37 legs (36 green, 0 skips). This is not the drive's known frontier: pair is green and legs.json carries no skip reasons at all, so the own-VPS carrier issue never fired on this run.

artifacts/legs.json + artifacts/verdict.json:

{ "leg": "credential-claim-gone", "status": "red", "ms": 8570,
  "error": "the door still carries the finance group after its receipted revocation — revoke must close the claim (ADR 0196, #1087)" }
"firstRedLeg": "credential-claim-gone"

The leg was newly ARMED for this run (app/tests/e2e/journey.idip.spec.ts:1097 — // ARMED (#1104 shipped): the revoke must un-name the group on the door.), so this is its first real exercise. The four legs after it (add-steward, remove-steward, remove-member, heartbeat-repoint) have no records — the red ended the sequence.

Evidence

The product state DID flip. /var/lib/idss/keria/roster.json on the live box (209.38.19.185, still up; read-only session):

"aid": "EJjq3MhCEsFmps7e07PzmSZwfYzsrHJjZwb-07tGwXKf", "username": "rangi",
"held": [ { "said": "EOI6XozZ8-VGF49ebwurtq3bzEIXty_jTzphMgrpboR_",
            "slug": "finance", "state": "revoked",
            "issued_at":  "2026-09-05T01:07:08.907270842Z",
            "updated_at": "2026-09-05T01:08:00.316907709Z" } ]

internal/keria/view.go:44 committees() derives the claim from h.State.issued() (registry.go:47: CredIssued || CredPendingRevoke), so from 01:08:00.316 onward the roster's committee list for rangi is empty.

But the door still holds it. nextcloud-occ user:info rangi, right now:

- groups:
  - finance

And the sign-in that should have cleared it was genuinely fresh, and ran after the revoke. /var/log/nginx/access.log:

[05/Sep/2026:01:08:02 +0000] "GET /login HTTP/1.1" 302
[05/Sep/2026:01:08:02 +0000] "GET /apps/user_oidc/login/1 HTTP/1.1" 303
[05/Sep/2026:01:08:03 +0000] "GET /apps/user_oidc/code?code=lGuO4DLL...&state=HP5VCDEQ... HTTP/1.1" 303
[05/Sep/2026:01:08:04 +0000] "PROPFIND /remote.php/dav/files/rangi/ HTTP/1.1" 207
[05/Sep/2026:01:08:06 +0000] "GET /settings/user HTTP/1.1" 200

A full authorization-code round trip at 01:08:02–03, two seconds after the roster flipped — and /settings/user still named finance.

The door is configured to sync, not merely add (nextcloud-oidc.service start script on the box):

--mapping-groups=ocgroups \
--group-provisioning=1

and user_oidc's ProvisioningService.php:765-772 removes any group absent from the claim:

$userGroups = $this->groupManager->getUserGroupIds($user);
foreach ($userGroups as $groupGID) {
    if (!in_array($groupGID, array_column($syncGroups, 'gid'))) { ...
        $this->groupManager->get($groupGID)?->removeUser($user);

So the door would have dropped finance had the claim arrived without it. It arrived with it.

The defect

internal/idp/signin.go:155-163 — keriVerify short-circuits the entire roster read on a 12-hour cache:

func keriVerify(ctx context.Context, v Verifier, st *store, s SignIn) (Identity, error) {
	if err := v.VerifyChallenge(ctx, s); err != nil {
		return Identity{}, ErrChallengeFailed
	}
	if identity, ok := st.heldCredential(s.AID); ok {
		return identity, nil        // <- cache hit: the WHOLE claim set, minted at the first sign-in
	}
	return v.Presentation(ctx, s)
}

completeLogin (internal/idp/signin.go:225) stores the entire Identity — Role, MembershipSAID and Komitis — under held[AID] with expiry = now + sessionCookieMaxAge, which internal/idp/client.go:17 sets to 12 * time.Hour.

Timeline:

  • 01:07:12 — rangi's first sign-in (leg credential-claim, green; the group correctly appeared). held["EJjq3Mh…"] caches Komitis: ["finance"] until ~13:07.
  • 01:08:00.316 — revoke receipted; roster flips the held credential to revoked.
  • 01:08:02 — fresh browser context, fresh authorization-code sign-in. keriVerify hits the cache, returns the 01:07:12 identity verbatim. setUserinfo (internal/idp/storage.go:557-562) then appends ocgroups straight from id.Claims.Komitis → ["finance"]. The roster is never re-read.

The cache is documented as the verified-key cache (story 12: "a repeat sign-in runs only the challenge"), which is a sound optimisation for the expensive KEL signature check. The bug is that it also caches roster-derived authorization state, which is mutable by design.

Wider blast radius, untested by this drive: the same short-circuit skips Presentation's standing check (internal/idp/keri_verifier.go:113-116: StatusSuspended, StatusRemoved → ErrCredentialRevoked) and the membership IsIssued TEL re-check. A suspended or removed member can therefore complete a fresh sign-in for up to 12 h. Note the refresh path is stricter than the login path — TokenRequestByRefreshToken (internal/idp/storage.go:239-256) does re-check IsIssued on every refresh, exactly as ADR 0196 requires; the fresh-login path does not.

Suspected layer

Product (control plane / idss-idp bridge). Not harness: the assertion is correct and mirrors the claim leg's presence check on both the bare slug and the committee: form per DDR 0179/#1104. Not infra: systemctl --failed is empty, the roster wrote the right state, and the door is configured to sync groups. idss-idp did restart-loop once early (:8465/healthz never became healthy within 60s, 01:00:45) but was healthy and stable from 01:05:39 through the whole failing window.

What plugging it needs

  1. Narrow the held cache to what it is named for. Cache the verified key state / challenge outcome keyed by AID; always re-run Verifier.Presentation for the claim set and standing on every sign-in. keriVerify must stop returning heldEntry.identity wholesale. The roster read is a loopback HTTP call to the control plane (ADR 0212), so per-sign-in cost is negligible.
  2. If the cache stays for latency, re-validate before returning: Member() status + IsIssued(MembershipSAID) + fresh Committees, and rebuild Claims from that — i.e. let the cache skip only key work, never Presentation.
  3. Close the test gap. Nothing today touches the cache: grep heldCredential internal/idp/*_test.go returns nothing, and internal/idp/verifier_committee_test.go exercises revoke by mutating Claims directly (withoutKomiti), so it never crosses the sign-in path. Add a store-level seam test: sign in holding a komiti → revoke in the roster → sign in again inside the 12 h window → assert ocgroups no longer names the slug. Add suspended/removed variants for the standing hole.
  4. Re-drive to green credential-claim-gone and give add-steward, remove-steward, remove-member and heartbeat-repoint their first exercise.

drive 20260905T005212Z red at credential-claim-gone: the door still carries the finance group after its receipted revocation — revoke must close the claim (ADR 0196, #1087)
evidence: /home/dev/swarm/Matou/idss/test-results/drive-idip/20260905T005212Z on matou-workstation (legs.json and whatever else the drive harvested there) — a representative screenshot is attached here if one was captured

## The failure `credential-claim-gone` is the only red of 37 legs (36 green, **0 skips**). This is **not** the drive's known frontier: `pair` is green and `legs.json` carries no skip reasons at all, so the own-VPS carrier issue never fired on this run. `artifacts/legs.json` + `artifacts/verdict.json`: ``` { "leg": "credential-claim-gone", "status": "red", "ms": 8570, "error": "the door still carries the finance group after its receipted revocation — revoke must close the claim (ADR 0196, #1087)" } "firstRedLeg": "credential-claim-gone" ``` The leg was newly ARMED for this run (`app/tests/e2e/journey.idip.spec.ts:1097` — `// ARMED (#1104 shipped): the revoke must un-name the group on the door.`), so this is its first real exercise. The four legs after it (`add-steward`, `remove-steward`, `remove-member`, `heartbeat-repoint`) have no records — the red ended the sequence. ## Evidence **The product state DID flip.** `/var/lib/idss/keria/roster.json` on the live box (209.38.19.185, still up; read-only session): ``` "aid": "EJjq3MhCEsFmps7e07PzmSZwfYzsrHJjZwb-07tGwXKf", "username": "rangi", "held": [ { "said": "EOI6XozZ8-VGF49ebwurtq3bzEIXty_jTzphMgrpboR_", "slug": "finance", "state": "revoked", "issued_at": "2026-09-05T01:07:08.907270842Z", "updated_at": "2026-09-05T01:08:00.316907709Z" } ] ``` `internal/keria/view.go:44` `committees()` derives the claim from `h.State.issued()` (`registry.go:47`: `CredIssued || CredPendingRevoke`), so from 01:08:00.316 onward the roster's committee list for rangi is **empty**. **But the door still holds it.** `nextcloud-occ user:info rangi`, right now: ``` - groups: - finance ``` **And the sign-in that should have cleared it was genuinely fresh, and ran after the revoke.** `/var/log/nginx/access.log`: ``` [05/Sep/2026:01:08:02 +0000] "GET /login HTTP/1.1" 302 [05/Sep/2026:01:08:02 +0000] "GET /apps/user_oidc/login/1 HTTP/1.1" 303 [05/Sep/2026:01:08:03 +0000] "GET /apps/user_oidc/code?code=lGuO4DLL...&state=HP5VCDEQ... HTTP/1.1" 303 [05/Sep/2026:01:08:04 +0000] "PROPFIND /remote.php/dav/files/rangi/ HTTP/1.1" 207 [05/Sep/2026:01:08:06 +0000] "GET /settings/user HTTP/1.1" 200 ``` A full authorization-code round trip at 01:08:02–03, two seconds after the roster flipped — and `/settings/user` still named `finance`. The door is configured to **sync**, not merely add (`nextcloud-oidc.service` start script on the box): ``` --mapping-groups=ocgroups \ --group-provisioning=1 ``` and `user_oidc`'s `ProvisioningService.php:765-772` removes any group absent from the claim: ```php $userGroups = $this->groupManager->getUserGroupIds($user); foreach ($userGroups as $groupGID) { if (!in_array($groupGID, array_column($syncGroups, 'gid'))) { ... $this->groupManager->get($groupGID)?->removeUser($user); ``` So the door would have dropped `finance` had the claim arrived without it. It arrived **with** it. ## The defect `internal/idp/signin.go:155-163` — `keriVerify` short-circuits the entire roster read on a 12-hour cache: ```go func keriVerify(ctx context.Context, v Verifier, st *store, s SignIn) (Identity, error) { if err := v.VerifyChallenge(ctx, s); err != nil { return Identity{}, ErrChallengeFailed } if identity, ok := st.heldCredential(s.AID); ok { return identity, nil // <- cache hit: the WHOLE claim set, minted at the first sign-in } return v.Presentation(ctx, s) } ``` `completeLogin` (`internal/idp/signin.go:225`) stores the entire `Identity` — `Role`, `MembershipSAID` **and `Komitis`** — under `held[AID]` with `expiry = now + sessionCookieMaxAge`, which `internal/idp/client.go:17` sets to `12 * time.Hour`. Timeline: - **01:07:12** — rangi's first sign-in (leg `credential-claim`, green; the group correctly appeared). `held["EJjq3Mh…"]` caches `Komitis: ["finance"]` until ~13:07. - **01:08:00.316** — revoke receipted; roster flips the held credential to `revoked`. - **01:08:02** — fresh browser context, fresh authorization-code sign-in. `keriVerify` hits the cache, returns the 01:07:12 identity verbatim. `setUserinfo` (`internal/idp/storage.go:557-562`) then appends `ocgroups` straight from `id.Claims.Komitis` → `["finance"]`. **The roster is never re-read.** The cache is documented as the *verified-key* cache (story 12: "a repeat sign-in runs only the challenge"), which is a sound optimisation for the expensive KEL signature check. The bug is that it also caches roster-derived **authorization** state, which is mutable by design. **Wider blast radius, untested by this drive:** the same short-circuit skips `Presentation`'s standing check (`internal/idp/keri_verifier.go:113-116`: `StatusSuspended, StatusRemoved → ErrCredentialRevoked`) and the membership `IsIssued` TEL re-check. A suspended or removed member can therefore complete a *fresh* sign-in for up to 12 h. Note the refresh path is stricter than the login path — `TokenRequestByRefreshToken` (`internal/idp/storage.go:239-256`) does re-check `IsIssued` on every refresh, exactly as ADR 0196 requires; the fresh-login path does not. ## Suspected layer **Product** (control plane / `idss-idp` bridge). Not harness: the assertion is correct and mirrors the claim leg's presence check on both the bare slug and the `committee:` form per DDR 0179/#1104. Not infra: `systemctl --failed` is empty, the roster wrote the right state, and the door is configured to sync groups. `idss-idp` did restart-loop once early (`:8465/healthz never became healthy within 60s`, 01:00:45) but was healthy and stable from 01:05:39 through the whole failing window. ## What plugging it needs 1. **Narrow the `held` cache to what it is named for.** Cache the verified key state / challenge outcome keyed by AID; always re-run `Verifier.Presentation` for the claim set and standing on every sign-in. `keriVerify` must stop returning `heldEntry.identity` wholesale. The roster read is a loopback HTTP call to the control plane (ADR 0212), so per-sign-in cost is negligible. 2. **If the cache stays for latency**, re-validate before returning: `Member()` status + `IsIssued(MembershipSAID)` + fresh `Committees`, and rebuild `Claims` from that — i.e. let the cache skip only key work, never `Presentation`. 3. **Close the test gap.** Nothing today touches the cache: `grep heldCredential internal/idp/*_test.go` returns nothing, and `internal/idp/verifier_committee_test.go` exercises revoke by mutating `Claims` directly (`withoutKomiti`), so it never crosses the sign-in path. Add a store-level seam test: sign in holding a komiti → revoke in the roster → sign in again inside the 12 h window → assert `ocgroups` no longer names the slug. Add suspended/removed variants for the standing hole. 4. **Re-drive** to green `credential-claim-gone` and give `add-steward`, `remove-steward`, `remove-member` and `heartbeat-repoint` their first exercise. drive `20260905T005212Z` red at `credential-claim-gone`: `the door still carries the finance group after its receipted revocation — revoke must close the claim (ADR 0196, #1087)` evidence: `/home/dev/swarm/Matou/idss/test-results/drive-idip/20260905T005212Z` on matou-workstation (legs.json and whatever else the drive harvested there) — a representative screenshot is attached here if one was captured <!-- rehearsal-sig: 2dd1a38b309c -->
Author
Member

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

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

close-report for #1231 — status success

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

envelope
{
  "issue": 1231,
  "status": "success",
  "commits": [
    "291bc77d"
  ],
  "changed_files": [
    "STATUS.md",
    "docs/GOTCHAS.md",
    "internal/idp/deviceapprove.go",
    "internal/idp/seam_test.go",
    "internal/idp/signin.go",
    "internal/idp/signin_revocation_seam_test.go",
    "internal/idp/storage.go",
    "internal/idp/verifier.go"
  ],
  "tests": [
    {
      "command": "go test ./internal/idp/",
      "exit_code": 0
    },
    {
      "command": "go test ./...",
      "exit_code": 0
    },
    {
      "command": "go vet ./...",
      "exit_code": 0
    },
    {
      "command": "go build ./... && go build -tags dev ./...",
      "exit_code": 0
    },
    {
      "command": "golangci-lint run ./...",
      "exit_code": 0
    },
    {
      "command": "cd broker && go test ./... && golangci-lint run ./...",
      "exit_code": 0
    }
  ],
  "criteria": {
    "Narrow the held cache to what it is named for — keriVerify must stop returning heldEntry.identity wholesale; always re-run Verifier.Presentation for the claim set and standing on every sign-in": "internal/idp/signin.go: keriVerify now calls only VerifyChallenge + v.Presentation(ctx, s); the st *store param and the st.heldCredential(s.AID) short-circuit are removed. Both callers (signin.go:130 login, deviceapprove.go:92 device-code) updated to the new signature.",
    "The held cache may stay for the paths that cannot re-present, but never supplies authorization on the sign-in path": "The held map is still written by completeLogin (signin.go) and approveDevice (deviceapprove.go) and read ONLY by completeFromSession (silent cross-client SSO, bounded to one access-token hour per ADR 0196) and the device-code identity recovery (storage.go:365/506, DeviceAuthorizationState carries only the AID). The sign-in verify path no longer reads it. Documented at the held field (storage.go) and on keriVerify.",
    "Close the test gap — store-level seam test: sign in holding a komiti -> revoke in the roster -> sign in again inside the 12 h window -> assert ocgroups no longer names the slug; plus suspended/removed variants for the standing hole": "internal/idp/signin_revocation_seam_test.go: TestSeam_KomitiRevokedBetweenSignIns_DropsFromNextToken (komiti revoke drops from the next token's ocgroups) and TestSeam_MembershipRevokedBetweenSignIns_RefusesFreshSignIn (standing hole: a fresh sign-in after a membership revoke is refused). Both fail against the old cache short-circuit and pass after the fix (verified red->green).",
    "Re-drive to green credential-claim-gone and give add-steward/remove-steward/remove-member/heartbeat-repoint their first exercise": "Deferred to the drive harness (the IDIP e2e drive runs on matou-workstation via #1227's lane, not from this sandbox). Fix landed and unit-proven at the seam; noted in the commit and STATUS.md for the next re-drive."
  },
  "summary": "idss-idp keriVerify no longer short-circuits authorization on the held-credential cache — it always re-runs Verifier.Presentation, so a revoked komiti (and standing) closes on the very next sign-in instead of surviving the 12 h session window.",
  "reason": "",
  "blockers": [],
  "no_code_change": ""
}
**close-report** for #1231 — status `success` :white_check_mark: **close-report gates passed** — every claim verified against main; issue closed. <details><summary>envelope</summary> ```json { "issue": 1231, "status": "success", "commits": [ "291bc77d" ], "changed_files": [ "STATUS.md", "docs/GOTCHAS.md", "internal/idp/deviceapprove.go", "internal/idp/seam_test.go", "internal/idp/signin.go", "internal/idp/signin_revocation_seam_test.go", "internal/idp/storage.go", "internal/idp/verifier.go" ], "tests": [ { "command": "go test ./internal/idp/", "exit_code": 0 }, { "command": "go test ./...", "exit_code": 0 }, { "command": "go vet ./...", "exit_code": 0 }, { "command": "go build ./... && go build -tags dev ./...", "exit_code": 0 }, { "command": "golangci-lint run ./...", "exit_code": 0 }, { "command": "cd broker && go test ./... && golangci-lint run ./...", "exit_code": 0 } ], "criteria": { "Narrow the held cache to what it is named for — keriVerify must stop returning heldEntry.identity wholesale; always re-run Verifier.Presentation for the claim set and standing on every sign-in": "internal/idp/signin.go: keriVerify now calls only VerifyChallenge + v.Presentation(ctx, s); the st *store param and the st.heldCredential(s.AID) short-circuit are removed. Both callers (signin.go:130 login, deviceapprove.go:92 device-code) updated to the new signature.", "The held cache may stay for the paths that cannot re-present, but never supplies authorization on the sign-in path": "The held map is still written by completeLogin (signin.go) and approveDevice (deviceapprove.go) and read ONLY by completeFromSession (silent cross-client SSO, bounded to one access-token hour per ADR 0196) and the device-code identity recovery (storage.go:365/506, DeviceAuthorizationState carries only the AID). The sign-in verify path no longer reads it. Documented at the held field (storage.go) and on keriVerify.", "Close the test gap — store-level seam test: sign in holding a komiti -> revoke in the roster -> sign in again inside the 12 h window -> assert ocgroups no longer names the slug; plus suspended/removed variants for the standing hole": "internal/idp/signin_revocation_seam_test.go: TestSeam_KomitiRevokedBetweenSignIns_DropsFromNextToken (komiti revoke drops from the next token's ocgroups) and TestSeam_MembershipRevokedBetweenSignIns_RefusesFreshSignIn (standing hole: a fresh sign-in after a membership revoke is refused). Both fail against the old cache short-circuit and pass after the fix (verified red->green).", "Re-drive to green credential-claim-gone and give add-steward/remove-steward/remove-member/heartbeat-repoint their first exercise": "Deferred to the drive harness (the IDIP e2e drive runs on matou-workstation via #1227's lane, not from this sandbox). Fix landed and unit-proven at the seam; noted in the commit and STATUS.md for the next re-drive." }, "summary": "idss-idp keriVerify no longer short-circuits authorization on the held-credential cache — it always re-runs Verifier.Presentation, so a revoked komiti (and standing) closes on the very next sign-in instead of surviving the 12 h session window.", "reason": "", "blockers": [], "no_code_change": "" } ``` </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#1231
No description provided.