IDIP bridge never reads its own sign-in session cookie — Nextcloud's OIDC hop re-prompts and the oidc-admin walk stalls blind for 120 s #1027

Closed
opened 2026-08-30 10:07:25 +00:00 by matou-build-agent · 2 comments

Failure

Drive 20260830T094937Z, leg oidc-admin, signature 94a048d819e4 (third consecutive red on this signature; the two prior heals — b28bf658, 1dd3f5b5 — each cleared a different fault in front of this one).

artifacts/legs.json records 19 green legs then oidc-admin red at 121250 ms with expect(locator).toBeVisible() failed … Error: element(s) not found. artifacts/verdict.json names firstRedLeg: oidc-admin at commit 53d139cd.

Evidence

The Playwright trace (artifacts/journey.idip-IDIP-journey--133f0-ey-on-the-rehearsal-droplet/trace.zip, context 1-trace.network / 1-trace.trace) records the full walk. The founder's sign-in succeeded:

GET  files.rehearsal-b.idss.nz/login                          302
GET  rehearsal-b.idss.nz/authz/signin?rd=…                    302
GET  id.rehearsal-b.idss.nz/authorize?client_id=gate-oidc…    302
GET  id.rehearsal-b.idss.nz/login?authRequestID=b66f6a09…     200   <- signed in here
… keria agent / identifiers / login/challenge …
POST id.rehearsal-b.idss.nz/login/verify                      302   <- verified, session cookie set
GET  id.rehearsal-b.idss.nz/authorize/callback?id=b66f6a09…   302
GET  rehearsal-b.idss.nz/authz/callback?code=…                302
GET  files.rehearsal-b.idss.nz/login                          302
GET  files.rehearsal-b.idss.nz/apps/user_oidc/login/1         303
GET  id.rehearsal-b.idss.nz/authorize?client_id=nextcloud…    302
GET  id.rehearsal-b.idss.nz/login?authRequestID=5bdc07d8…     200   <- ASKS AGAIN

That last line is the last request of the run. The trace's frame snapshots confirm it: before@call@389 (the click) is on …?authRequestID=b66f6a09…; after@call@391 (the 120 s timeout) is on …?authRequestID=5bdc07d8…. error-context.md's page snapshot at failure is a pristine bridge sign-in page — alert empty, paragraph (progress) empty, the form and "Nau mai ki E2E Drive" welcome line present.

So: the member authenticated once at the bridge, and the bridge's second authorize — Nextcloud's own client — ignored the session it had just minted and re-rendered the sign-in page.

Suspected layer — the bridge (internal/idp), not the journey

The session cookie is write-only:

  • internal/idp/signin.go:19 declares sessionCookieName = "idss_idp_session".
  • internal/idp/signin.go:96 calls l.setSession(w, identity.AID) on a successful verify; internal/idp/signin.go:142-152 writes the 12 h cookie, its doc comment calling it "the browser-side session marker with the same lifetime".
  • grep -rn 'sessionCookieName|idss_idp_session' --include=*.go . returns only those two sites plus one assertion in internal/idp/keri_verifier_test.go:247. No handler reads it.
  • internal/idp/signin.go:42-45 — handlePage reads only authRequestID and unconditionally renders the page: no session lookup, no silent completion.
  • internal/idp/storage.go:144-168 — CreateAuthRequest refuses prompt=none and enforces PKCE, but carries no notion of an existing browser session; the subject it stores is whatever op hands in (empty on a cold authorize).

The design contract says this hop must be silent:

  • docs/ux/flows/files-member.mermaid:30 — "returns with a live community session — the IdP hop is silent (SSO), the member lands straight back in Files".
  • docs/adr/0196-idip-oidc-bridge-idss-idp.md:47 — "Bridge sign-in session cookie 12 h".

The journey encodes the same expectation: app/tests/e2e/fixtures/idip.ts:314-336 (oidcSignInViaBridge) signs in once and then waits for Nextcloud's #header.

What plugging it needs

1. The substantive fix — honour the session on a subsequent authorize. On GET /login with a valid idss_idp_session whose AID is still live in the verified-key cache (store.heldCredential, internal/idp/signin.go:183-194), complete the auth request and redirect to the callback instead of rendering the form. Three things a worker must settle while doing it:

  • Interceptor wiring. l.callback is op.AuthCallbackURL(provider) (internal/idp/provider.go:94) and today only POST /login/verify is wrapped in l.interceptor.Handler(...) (internal/idp/signin.go:39). A silent completion from handlePage needs the issuer in context too — GET /login must be wrapped the same way, or the callback URL will be built without an issuer.
  • Revocation. heldCredential checks only expiry — it never re-checks the TEL. ADR 0196:44-47 already bounds the exposure ("suspension = revocation + gate session kill … a missed kill is bounded to one access-token hour"), so reusing the held credential inside the 12 h window is consistent with the ruling; say so explicitly in the code comment rather than leaving it implicit.
  • The apparent tension with story 12 ("a repeat where the bridge holds the credential runs only the challenge", internal/idp/signin.go:59-63) is about skipping the ACDC presentation, not about re-prompting the member — keriVerify (internal/idp/signin.go:107-115) always runs the challenge and skips only Presentation. Silent SSO across clients is a separate axis and does not contradict it. Worth a line in the ADR so the next reader doesn't re-litigate it.

2. The observability fix (secondary, but it cost this drive its whole 120 s ceiling). oidcSignInViaBridge (app/tests/e2e/fixtures/idip.ts:326-327) now waits on three arms — #header, a non-empty [data-status], and the #1026 protocol-error body text. A blank re-prompt matches none of them, so the leg can only time out with element(s) not found and say nothing about what it saw. Add a fourth arm: form#signin visible again after the sign-in click means "the bridge asked a second time", and the leg should red in seconds naming that. This alone will not make the drive green — it only stops the next red from burning the ceiling blind.

A targeted check for (1) lives in internal/idp (GOWORK=$PWD/go.work go test ./internal/idp/): a seam test that verifies once, then issues a second authorize for a different client carrying the returned cookie, and asserts a 302 to the callback rather than a 200 sign-in page.

drive 20260830T094937Z red at oidc-admin: expect(locator).toBeVisible() failed Locator: locator('#header').or(locator('[data-status]').filter({ hasText: /\S/ })).or(locator('body').filter({ hasText: /unable to retrieve client|invalid_request|
evidence: /home/dev/swarm/Matou/idss/test-results/drive-idip/20260830T094937Z on matou-workstation (legs.json and whatever else the drive harvested there) — a representative screenshot is attached here if one was captured

## Failure Drive `20260830T094937Z`, leg `oidc-admin`, signature `94a048d819e4` (third consecutive red on this signature; the two prior heals — `b28bf658`, `1dd3f5b5` — each cleared a different fault in front of this one). `artifacts/legs.json` records 19 green legs then `oidc-admin` red at 121250 ms with `expect(locator).toBeVisible() failed … Error: element(s) not found`. `artifacts/verdict.json` names `firstRedLeg: oidc-admin` at commit `53d139cd`. ## Evidence The Playwright trace (`artifacts/journey.idip-IDIP-journey--133f0-ey-on-the-rehearsal-droplet/trace.zip`, context `1-trace.network` / `1-trace.trace`) records the full walk. The founder's sign-in **succeeded**: ``` GET files.rehearsal-b.idss.nz/login 302 GET rehearsal-b.idss.nz/authz/signin?rd=… 302 GET id.rehearsal-b.idss.nz/authorize?client_id=gate-oidc… 302 GET id.rehearsal-b.idss.nz/login?authRequestID=b66f6a09… 200 <- signed in here … keria agent / identifiers / login/challenge … POST id.rehearsal-b.idss.nz/login/verify 302 <- verified, session cookie set GET id.rehearsal-b.idss.nz/authorize/callback?id=b66f6a09… 302 GET rehearsal-b.idss.nz/authz/callback?code=… 302 GET files.rehearsal-b.idss.nz/login 302 GET files.rehearsal-b.idss.nz/apps/user_oidc/login/1 303 GET id.rehearsal-b.idss.nz/authorize?client_id=nextcloud… 302 GET id.rehearsal-b.idss.nz/login?authRequestID=5bdc07d8… 200 <- ASKS AGAIN ``` That last line is the last request of the run. The trace's frame snapshots confirm it: `before@call@389` (the click) is on `…?authRequestID=b66f6a09…`; `after@call@391` (the 120 s timeout) is on `…?authRequestID=5bdc07d8…`. `error-context.md`'s page snapshot at failure is a pristine bridge sign-in page — `alert` empty, `paragraph` (progress) empty, the form and "Nau mai ki E2E Drive" welcome line present. So: the member authenticated once at the bridge, and the bridge's **second** authorize — Nextcloud's own client — ignored the session it had just minted and re-rendered the sign-in page. ## Suspected layer — the bridge (`internal/idp`), not the journey The session cookie is **write-only**: - `internal/idp/signin.go:19` declares `sessionCookieName = "idss_idp_session"`. - `internal/idp/signin.go:96` calls `l.setSession(w, identity.AID)` on a successful verify; `internal/idp/signin.go:142-152` writes the 12 h cookie, its doc comment calling it "the browser-side session marker with the same lifetime". - `grep -rn 'sessionCookieName|idss_idp_session' --include=*.go .` returns **only** those two sites plus one assertion in `internal/idp/keri_verifier_test.go:247`. **No handler reads it.** - `internal/idp/signin.go:42-45` — `handlePage` reads only `authRequestID` and unconditionally renders the page: no session lookup, no silent completion. - `internal/idp/storage.go:144-168` — `CreateAuthRequest` refuses `prompt=none` and enforces PKCE, but carries no notion of an existing browser session; the `subject` it stores is whatever `op` hands in (empty on a cold authorize). The design contract says this hop must be silent: - `docs/ux/flows/files-member.mermaid:30` — "returns with a live community session — **the IdP hop is silent (SSO)**, the member lands straight back in Files". - `docs/adr/0196-idip-oidc-bridge-idss-idp.md:47` — "Bridge sign-in session cookie **12 h**". The journey encodes the same expectation: `app/tests/e2e/fixtures/idip.ts:314-336` (`oidcSignInViaBridge`) signs in once and then waits for Nextcloud's `#header`. ## What plugging it needs **1. The substantive fix — honour the session on a subsequent authorize.** On `GET /login` with a valid `idss_idp_session` whose AID is still live in the verified-key cache (`store.heldCredential`, `internal/idp/signin.go:183-194`), complete the auth request and redirect to the callback instead of rendering the form. Three things a worker must settle while doing it: - **Interceptor wiring.** `l.callback` is `op.AuthCallbackURL(provider)` (`internal/idp/provider.go:94`) and today only `POST /login/verify` is wrapped in `l.interceptor.Handler(...)` (`internal/idp/signin.go:39`). A silent completion from `handlePage` needs the issuer in context too — `GET /login` must be wrapped the same way, or the callback URL will be built without an issuer. - **Revocation.** `heldCredential` checks only expiry — it never re-checks the TEL. ADR 0196:44-47 already bounds the exposure ("suspension = revocation + gate session kill … a missed kill is bounded to one access-token hour"), so reusing the held credential inside the 12 h window is consistent with the ruling; say so explicitly in the code comment rather than leaving it implicit. - **The apparent tension with story 12** ("a repeat where the bridge holds the credential runs only the challenge", `internal/idp/signin.go:59-63`) is about skipping the *ACDC presentation*, not about re-prompting the member — `keriVerify` (`internal/idp/signin.go:107-115`) always runs the challenge and skips only `Presentation`. Silent SSO across clients is a separate axis and does not contradict it. Worth a line in the ADR so the next reader doesn't re-litigate it. **2. The observability fix (secondary, but it cost this drive its whole 120 s ceiling).** `oidcSignInViaBridge` (`app/tests/e2e/fixtures/idip.ts:326-327`) now waits on three arms — `#header`, a non-empty `[data-status]`, and the `#1026` protocol-error body text. A **blank re-prompt** matches none of them, so the leg can only time out with `element(s) not found` and say nothing about what it saw. Add a fourth arm: `form#signin` visible again after the sign-in click means "the bridge asked a second time", and the leg should red in seconds naming that. This alone will not make the drive green — it only stops the next red from burning the ceiling blind. A targeted check for (1) lives in `internal/idp` (`GOWORK=$PWD/go.work go test ./internal/idp/`): a seam test that verifies once, then issues a second authorize for a different client carrying the returned cookie, and asserts a 302 to the callback rather than a 200 sign-in page. drive `20260830T094937Z` red at `oidc-admin`: `expect(locator).toBeVisible() failed Locator: locator('#header').or(locator('[data-status]').filter({ hasText: /\S/ })).or(locator('body').filter({ hasText: /unable to retrieve client|invalid_request|` evidence: `/home/dev/swarm/Matou/idss/test-results/drive-idip/20260830T094937Z` on matou-workstation (legs.json and whatever else the drive harvested there) — a representative screenshot is attached here if one was captured <!-- rehearsal-sig: 94a048d819e4 -->
Author
Member

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

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

close-report for #1027 — status success

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

envelope
{
  "issue": 1027,
  "status": "success",
  "commits": [
    "9b6f26cd"
  ],
  "changed_files": [
    "STATUS.md",
    "app/tests/e2e/fixtures/idip.test.ts",
    "app/tests/e2e/fixtures/idip.ts",
    "docs/adr/0196-idip-oidc-bridge-idss-idp.md",
    "internal/idp/seam_test.go",
    "internal/idp/signin.go"
  ],
  "tests": [
    {
      "command": "GOWORK=$PWD/go.work go test ./internal/idp/",
      "exit_code": 0
    },
    {
      "command": "node_modules/.bin/vitest run tests/e2e/fixtures/idip.test.ts",
      "exit_code": 0
    },
    {
      "command": "go build ./... && go vet ./internal/idp/",
      "exit_code": 0
    }
  ],
  "criteria": {
    "The substantive fix — honour the session on a subsequent authorize (GET /login with a valid idss_idp_session whose AID is live in heldCredential completes the auth request and redirects to the callback)": "internal/idp/signin.go handlePage now calls completeFromSession, which reads sessionCookieName, looks up heldCredential, completeLogin, and 302s to l.callback; proven by TestSeam_SilentSSO_AcrossClients (302 to callback + working code) in internal/idp/seam_test.go",
    "Interceptor wiring — GET /login wrapped in l.interceptor.Handler so the callback URL is built with the issuer": "internal/idp/signin.go register() now mounts GET /login via l.interceptor.Handler(http.HandlerFunc(l.handlePage)); the silent 302 in the seam test would fail to build the callback without it",
    "Revocation reasoning stated explicitly rather than left implicit": "completeFromSession doc comment in internal/idp/signin.go states reuse inside the 12 h window is bounded to one access-token hour per ADR 0196:44-47; also recorded in docs/adr/0196",
    "Story-12 tension resolved in the ADR so it is not re-litigated": "docs/adr/0196-idip-oidc-bridge-idss-idp.md records silent SSO as a separate axis from story 12 (presentation-skip vs re-prompt-skip)",
    "Seam test — verify once then a second authorize for a different client carrying the returned cookie asserts a 302 to the callback rather than a 200 sign-in page": "TestSeam_SilentSSO_AcrossClients (gate-oidc sign-in mints cookie; netbird second authorize + cookie 302s to callback) and TestSeam_ColdLogin_StillRendersForm (no cookie still renders the form) in internal/idp/seam_test.go; go test ./internal/idp/ exit 0",
    "Observability fix — a fourth arm on oidcSignInViaBridge: form#signin visible again after sign-in reds in seconds naming the second prompt": "app/tests/e2e/fixtures/idip.ts adds .or(signin) to the post-sign-in wait union behind a signin.waitFor detached guard, throwing a message naming the unread session cookie (#1027); pinned red-first by the 'names a silent-SSO re-prompt (#1027)' block in idip.test.ts, vitest exit 0"
  },
  "summary": "The IDIP bridge now reads its own 12 h sign-in session cookie so Nextcloud's OIDC hop completes silently (SSO) instead of a blank re-prompt, plus a fourth e2e wait arm that names the fault fast.",
  "reason": "",
  "blockers": [],
  "no_code_change": ""
}
**close-report** for #1027 — status `success` :white_check_mark: **close-report gates passed** — every claim verified against main; issue closed. <details><summary>envelope</summary> ```json { "issue": 1027, "status": "success", "commits": [ "9b6f26cd" ], "changed_files": [ "STATUS.md", "app/tests/e2e/fixtures/idip.test.ts", "app/tests/e2e/fixtures/idip.ts", "docs/adr/0196-idip-oidc-bridge-idss-idp.md", "internal/idp/seam_test.go", "internal/idp/signin.go" ], "tests": [ { "command": "GOWORK=$PWD/go.work go test ./internal/idp/", "exit_code": 0 }, { "command": "node_modules/.bin/vitest run tests/e2e/fixtures/idip.test.ts", "exit_code": 0 }, { "command": "go build ./... && go vet ./internal/idp/", "exit_code": 0 } ], "criteria": { "The substantive fix — honour the session on a subsequent authorize (GET /login with a valid idss_idp_session whose AID is live in heldCredential completes the auth request and redirects to the callback)": "internal/idp/signin.go handlePage now calls completeFromSession, which reads sessionCookieName, looks up heldCredential, completeLogin, and 302s to l.callback; proven by TestSeam_SilentSSO_AcrossClients (302 to callback + working code) in internal/idp/seam_test.go", "Interceptor wiring — GET /login wrapped in l.interceptor.Handler so the callback URL is built with the issuer": "internal/idp/signin.go register() now mounts GET /login via l.interceptor.Handler(http.HandlerFunc(l.handlePage)); the silent 302 in the seam test would fail to build the callback without it", "Revocation reasoning stated explicitly rather than left implicit": "completeFromSession doc comment in internal/idp/signin.go states reuse inside the 12 h window is bounded to one access-token hour per ADR 0196:44-47; also recorded in docs/adr/0196", "Story-12 tension resolved in the ADR so it is not re-litigated": "docs/adr/0196-idip-oidc-bridge-idss-idp.md records silent SSO as a separate axis from story 12 (presentation-skip vs re-prompt-skip)", "Seam test — verify once then a second authorize for a different client carrying the returned cookie asserts a 302 to the callback rather than a 200 sign-in page": "TestSeam_SilentSSO_AcrossClients (gate-oidc sign-in mints cookie; netbird second authorize + cookie 302s to callback) and TestSeam_ColdLogin_StillRendersForm (no cookie still renders the form) in internal/idp/seam_test.go; go test ./internal/idp/ exit 0", "Observability fix — a fourth arm on oidcSignInViaBridge: form#signin visible again after sign-in reds in seconds naming the second prompt": "app/tests/e2e/fixtures/idip.ts adds .or(signin) to the post-sign-in wait union behind a signin.waitFor detached guard, throwing a message naming the unread session cookie (#1027); pinned red-first by the 'names a silent-SSO re-prompt (#1027)' block in idip.test.ts, vitest exit 0" }, "summary": "The IDIP bridge now reads its own 12 h sign-in session cookie so Nextcloud's OIDC hop completes silently (SSO) instead of a blank re-prompt, plus a fourth e2e wait arm that names the fault fast.", "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#1027
No description provided.