IDIP sign-out is impossible: the bridge accepts NO post_logout_redirect_uri, so the gate's /authz/signout always dies on invalid_request and the IdP session survives #1713

Closed
opened 2026-09-21 21:40:47 +00:00 by ben · 3 comments
Owner

What happened

Whakatōhea Demo (rented + IDIP). GET https://<apex>/authz/signout (the gate's real sign-out — and what the panel's button calls once #1712 lands) → 302 to https://id.<apex>/end_session?client_id=gate-oidc&post_logout_redirect_uri=https%3A%2F%2F<apex>%2F → the bridge answers raw JSON:

error "invalid_request"   error_description "post_logout_redirect_uri invalid"

Cause

internal/idp/client.go:34: func (c *client) PostLogoutRedirectURIs() []string { return nil } — hard-coded empty for every client, and the rendered idss-idp-clients.json carries no such field. The gate ALWAYS sends one (internal/controlapi/oidcprovider.go:257-267). So on IDIP the end-session leg can never succeed, for the gate or for any service that does RP-initiated logout (Nextcloud user_oidc, Paperless, …).

Consequence — security

The operator or a member cannot end their IdP session. If the gate clears its own cookie before redirecting, the next visit to the apex silently signs them straight back in off the surviving bridge session; on a shared computer the next person is them. Check and state in the close-report which of the two it is (cookie cleared or not) — and whether the bridge session is actually destroyed when the URI IS valid.

Fix

  1. clients.json gains post_logout_redirect_uris per client; internal/clan/idssidp.go renders them from the same facts as redirect_uris (gate: https://<apex>/; each service: its door origin / its documented logout return), and client.PostLogoutRedirectURIs() returns them. Exact-match only.
  2. end_session with no/invalid URI still ENDS the session and lands on the bridge's own branded "You are signed out" page — a bad redirect must never keep a session alive, and never answers raw JSON to a browser.
  3. Tests: seam — gate sign-out against the bridge ends the bridge session and returns to the apex, which then asks for the phrase again; drive — the IDIP prove-it drive (#1688) signs out and proves the next visit is challenged. (No drive signs out on IDIP today — that is why this was never seen.)

Sign-in trust surface → ready-for-human: proposed default ruling = items 1–3 as written.

Why human

One-way-ish door on a member-facing trust surface (which return addresses the sign-in service will redirect to, and what sign-out guarantees). Proposed default above.

Relates to #1712 (the button), #1711. Found on the hand re-founding of Whakatōhea Demo 2026-09-21, build source 5b910ef3.

## What happened Whakatōhea Demo (rented + IDIP). `GET https://<apex>/authz/signout` (the gate's real sign-out — and what the panel's button calls once #1712 lands) → 302 to `https://id.<apex>/end_session?client_id=gate-oidc&post_logout_redirect_uri=https%3A%2F%2F<apex>%2F` → the bridge answers raw JSON: ``` error "invalid_request" error_description "post_logout_redirect_uri invalid" ``` ## Cause `internal/idp/client.go:34`: `func (c *client) PostLogoutRedirectURIs() []string { return nil }` — hard-coded empty for every client, and the rendered `idss-idp-clients.json` carries no such field. The gate ALWAYS sends one (`internal/controlapi/oidcprovider.go:257-267`). So on IDIP the end-session leg can never succeed, for the gate or for any service that does RP-initiated logout (Nextcloud user_oidc, Paperless, …). ## Consequence — security The operator or a member cannot end their IdP session. If the gate clears its own cookie before redirecting, the next visit to the apex silently signs them straight back in off the surviving bridge session; on a shared computer the next person is them. **Check and state in the close-report which of the two it is** (cookie cleared or not) — and whether the bridge session is actually destroyed when the URI IS valid. ## Fix 1. `clients.json` gains `post_logout_redirect_uris` per client; `internal/clan/idssidp.go` renders them from the same facts as `redirect_uris` (gate: `https://<apex>/`; each service: its door origin / its documented logout return), and `client.PostLogoutRedirectURIs()` returns them. Exact-match only. 2. `end_session` with no/invalid URI still ENDS the session and lands on the bridge's own branded "You are signed out" page — a bad redirect must never keep a session alive, and never answers raw JSON to a browser. 3. Tests: seam — gate sign-out against the bridge ends the bridge session and returns to the apex, which then asks for the phrase again; drive — the IDIP prove-it drive (#1688) signs out and proves the next visit is challenged. (No drive signs out on IDIP today — that is why this was never seen.) Sign-in trust surface → `ready-for-human`: proposed default ruling = items 1–3 as written. ## Why human One-way-ish door on a member-facing trust surface (which return addresses the sign-in service will redirect to, and what sign-out guarantees). Proposed default above. Relates to #1712 (the button), #1711. Found on the hand re-founding of Whakatōhea Demo 2026-09-21, build source `5b910ef3`.
Author
Owner

RULED by Ben 2026-09-21 — the proposed default stands, build items 1–3 as written

  1. Every client in idss-idp-clients.json carries post_logout_redirect_uris, rendered in internal/clan/idssidp.go from the same facts as its redirect_uris (gate: https://<apex>/; each service: its door origin / documented logout return). Exact-match only; client.PostLogoutRedirectURIs() returns them.
  2. end_session with a missing or non-matching URI still ends the bridge session and lands on the bridge's own branded "You are signed out" page (kit-worn, like /login). Never raw JSON to a browser; a bad redirect never keeps a session alive.
  3. Seam test: gate sign-out ⇒ bridge session gone ⇒ next apex visit is challenged for the phrase. Drive: the IDIP prove-it drive (#1688) gains a sign-out leg proving the same live. Close-report states whether the gate clears its cookie before the redirect today.

Sign-in trust surface — ruled by Ben directly, not under ADR 0174. Relabelled ready-for-agent.

## RULED by Ben 2026-09-21 — the proposed default stands, build items 1–3 as written 1. Every client in `idss-idp-clients.json` carries `post_logout_redirect_uris`, rendered in `internal/clan/idssidp.go` from the same facts as its `redirect_uris` (gate: `https://<apex>/`; each service: its door origin / documented logout return). Exact-match only; `client.PostLogoutRedirectURIs()` returns them. 2. `end_session` with a missing or non-matching URI **still ends the bridge session** and lands on the bridge's own branded "You are signed out" page (kit-worn, like /login). Never raw JSON to a browser; a bad redirect never keeps a session alive. 3. Seam test: gate sign-out ⇒ bridge session gone ⇒ next apex visit is challenged for the phrase. Drive: the IDIP prove-it drive (#1688) gains a sign-out leg proving the same live. Close-report states whether the gate clears its cookie before the redirect today. Sign-in trust surface — ruled by Ben directly, not under ADR 0174. Relabelled `ready-for-agent`.

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

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

close-report for #1713 — status success

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

envelope
{
  "issue": 1713,
  "status": "success",
  "commits": [
    "66e6eb4cc1f95cd5891d83c768c71230f2f10d86"
  ],
  "changed_files": [
    "STATUS.md",
    "app/tests/e2e/fixtures/idip.ts",
    "app/tests/e2e/journey.idip.spec.ts",
    "docs/GOTCHAS.md",
    "internal/clan/idssidp.go",
    "internal/clan/idssidp_test.go",
    "internal/idp/brand.go",
    "internal/idp/client.go",
    "internal/idp/config.go",
    "internal/idp/provider.go",
    "internal/idp/seam_test.go",
    "internal/idp/signout.go",
    "internal/idp/signout_seam_test.go",
    "internal/idp/storage.go"
  ],
  "tests": [
    {
      "command": "go build ./...",
      "exit_code": 0
    },
    {
      "command": "go vet ./internal/idp/... ./internal/clan/...",
      "exit_code": 0
    },
    {
      "command": "go test ./internal/idp/... ./internal/clan/... -count=1",
      "exit_code": 0
    },
    {
      "command": "app: vue-tsc -p tsconfig.json",
      "exit_code": 0
    },
    {
      "command": "app: vitest run tests/e2e/fixtures/idip.test.ts",
      "exit_code": 0
    },
    {
      "command": "eslint app/tests/e2e/fixtures/idip.ts app/tests/e2e/journey.idip.spec.ts",
      "exit_code": 0
    }
  ],
  "criteria": {
    "Item 1 — every client in idss-idp-clients.json carries post_logout_redirect_uris, rendered from the same facts as redirect_uris (gate https://<apex>/; each service its door origin); client.PostLogoutRedirectURIs() returns them, exact-match only": "internal/clan/idssidp.go renders post_logout_redirect_uris per client (gate https://<apex>/, files https://files.<apex>/, netbird https://<apex>/); internal/idp/config.go ClientConfig+clientsDoc+loadClients carry the field; internal/idp/client.go PostLogoutRedirectURIs() returns c.cfg.PostLogoutRedirectURIs; validated exact-match via op's ValidateEndSessionPostLogoutRedirectURI. Tests: TestRenderIdssIdp_ClientsCarryPostLogoutRedirectURIs (internal/clan).",
    "Item 2 — end_session with no/invalid URI STILL ends the session and lands on the bridge's own branded 'You are signed out' page; never raw JSON, a bad redirect never keeps a session alive": "internal/idp/signout.go handleEndSession always calls store.endSession + clears the idss_idp_session cookie BEFORE deciding the landing; a missing/non-matching/unknown-client URI renders signInPage.renderSignedOut (200 HTML, brand kit), never op raw JSON, never a redirect. Tests: TestSeam_IDIPSignOut_InvalidRedirect_BrandedPageStillEndsSession, TestSeam_IDIPSignOut_NoRedirect_BrandedPage.",
    "Item 3 seam — gate sign-out ends the bridge session and the next apex visit is challenged for the phrase": "TestSeam_IDIPSignOut_ValidRedirect_EndsBridgeSession: sign-out 302s to the declared apex, clears the cookie, and a subsequent silent hop on the old cookie falls to the sign-in form (bridge session gone). TestSeam_IDIPSignOut_DiscoveryAdvertisesEndSession asserts discovery points at the bridge handler.",
    "Item 3 drive — the IDIP prove-it drive (#1688) gains a sign-out leg proving the same live": "app/tests/e2e/journey.idip.spec.ts adds the operator-signout leg calling assertSignOutEndsBridgeSession (app/tests/e2e/fixtures/idip.ts): signs out via /authz/signout, asserts no raw JSON, cookie cleared, and re-opening the front door re-challenges for the phrase. Ships for the next IDIP rehearsal cycle (live proof owed).",
    "Consequence check — state whether the gate clears its cookie before the redirect, and whether the bridge session is destroyed when the URI IS valid": "The gate DOES clear its own idss_session cookie before the redirect (internal/controlapi/signin.go signout: http.SetCookie(w, ClearSessionCookie(...)) before the end_session hop). Before this fix op's end_session did NOT destroy the bridge's native sign-in session (idss_idp_session cookie + held cache) even with a valid URI — that is now fixed by store.endSession in the bridge-owned handler."
  },
  "summary": "IDIP sign-out now ends the bridge session: clients declare exact-match post_logout_redirect_uris and a bridge-owned end_session clears the sign-in session and cache before it redirects, landing a bad/missing URI on a branded signed-out page instead of raw JSON.",
  "blockers": []
}
**close-report** for #1713 — status `success` :white_check_mark: **close-report gates passed** — every claim verified against main; issue closed. <details><summary>envelope</summary> ```json { "issue": 1713, "status": "success", "commits": [ "66e6eb4cc1f95cd5891d83c768c71230f2f10d86" ], "changed_files": [ "STATUS.md", "app/tests/e2e/fixtures/idip.ts", "app/tests/e2e/journey.idip.spec.ts", "docs/GOTCHAS.md", "internal/clan/idssidp.go", "internal/clan/idssidp_test.go", "internal/idp/brand.go", "internal/idp/client.go", "internal/idp/config.go", "internal/idp/provider.go", "internal/idp/seam_test.go", "internal/idp/signout.go", "internal/idp/signout_seam_test.go", "internal/idp/storage.go" ], "tests": [ { "command": "go build ./...", "exit_code": 0 }, { "command": "go vet ./internal/idp/... ./internal/clan/...", "exit_code": 0 }, { "command": "go test ./internal/idp/... ./internal/clan/... -count=1", "exit_code": 0 }, { "command": "app: vue-tsc -p tsconfig.json", "exit_code": 0 }, { "command": "app: vitest run tests/e2e/fixtures/idip.test.ts", "exit_code": 0 }, { "command": "eslint app/tests/e2e/fixtures/idip.ts app/tests/e2e/journey.idip.spec.ts", "exit_code": 0 } ], "criteria": { "Item 1 — every client in idss-idp-clients.json carries post_logout_redirect_uris, rendered from the same facts as redirect_uris (gate https://<apex>/; each service its door origin); client.PostLogoutRedirectURIs() returns them, exact-match only": "internal/clan/idssidp.go renders post_logout_redirect_uris per client (gate https://<apex>/, files https://files.<apex>/, netbird https://<apex>/); internal/idp/config.go ClientConfig+clientsDoc+loadClients carry the field; internal/idp/client.go PostLogoutRedirectURIs() returns c.cfg.PostLogoutRedirectURIs; validated exact-match via op's ValidateEndSessionPostLogoutRedirectURI. Tests: TestRenderIdssIdp_ClientsCarryPostLogoutRedirectURIs (internal/clan).", "Item 2 — end_session with no/invalid URI STILL ends the session and lands on the bridge's own branded 'You are signed out' page; never raw JSON, a bad redirect never keeps a session alive": "internal/idp/signout.go handleEndSession always calls store.endSession + clears the idss_idp_session cookie BEFORE deciding the landing; a missing/non-matching/unknown-client URI renders signInPage.renderSignedOut (200 HTML, brand kit), never op raw JSON, never a redirect. Tests: TestSeam_IDIPSignOut_InvalidRedirect_BrandedPageStillEndsSession, TestSeam_IDIPSignOut_NoRedirect_BrandedPage.", "Item 3 seam — gate sign-out ends the bridge session and the next apex visit is challenged for the phrase": "TestSeam_IDIPSignOut_ValidRedirect_EndsBridgeSession: sign-out 302s to the declared apex, clears the cookie, and a subsequent silent hop on the old cookie falls to the sign-in form (bridge session gone). TestSeam_IDIPSignOut_DiscoveryAdvertisesEndSession asserts discovery points at the bridge handler.", "Item 3 drive — the IDIP prove-it drive (#1688) gains a sign-out leg proving the same live": "app/tests/e2e/journey.idip.spec.ts adds the operator-signout leg calling assertSignOutEndsBridgeSession (app/tests/e2e/fixtures/idip.ts): signs out via /authz/signout, asserts no raw JSON, cookie cleared, and re-opening the front door re-challenges for the phrase. Ships for the next IDIP rehearsal cycle (live proof owed).", "Consequence check — state whether the gate clears its cookie before the redirect, and whether the bridge session is destroyed when the URI IS valid": "The gate DOES clear its own idss_session cookie before the redirect (internal/controlapi/signin.go signout: http.SetCookie(w, ClearSessionCookie(...)) before the end_session hop). Before this fix op's end_session did NOT destroy the bridge's native sign-in session (idss_idp_session cookie + held cache) even with a valid URI — that is now fixed by store.endSession in the bridge-owned handler." }, "summary": "IDIP sign-out now ends the bridge session: clients declare exact-match post_logout_redirect_uris and a bridge-owned end_session clears the sign-in session and cache before it redirects, landing a bad/missing URI on a branded signed-out page instead of raw JSON.", "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.

Dependencies

No dependencies set.

Reference
Matou/idss#1713
No description provided.