Logout (session cookie clear, RP-initiated end-session, 302 back) #28

Merged
ginjiruu merged 4 commits from feat/oidc-logout into master 2026-09-15 17:29:34 +00:00
Owner

Closes #19

Adds the OIDC logout on the :8082 listener (/logout path; the non-/logout path keeps the stub until the callback ticket lands):

  • Clears the Session cookie (Set-Cookie with Max-Age=0, Path=/) — the App's cookie name when the App resolves by Host, the API default otherwise; never an error status.
  • EndSession=true (opt-in) with a resolved end_session_endpoint and a readable Session → 302 to the end_session_endpoint with id_token_hint (RP-initiated). EndSession=true with an empty endpoint (discovery-omitted) or no readable Session → 302 back (local-only, per policy).
  • EndSession=false (default) → clear + 302 back (local-only, zero-config); "back" is the Referer only when same-host (a cross-host Referer must not become an open redirect), else /. The request Host's port is stripped before App resolution so a direct :8082 access still resolves (EndSession is not silently degraded).

Verified TDD-first: 9 tests (default/local with+without Referer, foreign-Referer not-an-open-redirect, Host-with-port still resolves, custom cookie name, RP-initiated with hint, EndSession without endpoint, EndSession without readable session, unknown Host clears the default name, the dispatcher keeps the stub), RED before implementation and GREEN after. Full suite green (-p 1). Two-axis code review: the open-redirect finding was fixed in this branch (same-host Referer gate + regression test) before review sign-off.

Closes #19 Adds the OIDC logout on the `:8082` listener (`/logout` path; the non-`/logout` path keeps the stub until the callback ticket lands): - Clears the Session cookie (`Set-Cookie` with `Max-Age=0`, `Path=/`) — the App's cookie name when the App resolves by Host, the API default otherwise; never an error status. - `EndSession=true` (opt-in) with a resolved `end_session_endpoint` and a readable Session → 302 to the `end_session_endpoint` with `id_token_hint` (RP-initiated). `EndSession=true` with an empty endpoint (discovery-omitted) or no readable Session → 302 back (local-only, per policy). - `EndSession=false` (default) → clear + 302 back (local-only, zero-config); "back" is the Referer only when same-host (a cross-host Referer must not become an open redirect), else `/`. The request Host's port is stripped before App resolution so a direct `:8082` access still resolves (EndSession is not silently degraded). Verified TDD-first: 9 tests (default/local with+without Referer, foreign-Referer not-an-open-redirect, Host-with-port still resolves, custom cookie name, RP-initiated with hint, EndSession without endpoint, EndSession without readable session, unknown Host clears the default name, the dispatcher keeps the stub), RED before implementation and GREEN after. Full suite green (`-p 1`). Two-axis code review: the open-redirect finding was fixed in this branch (same-host Referer gate + regression test) before review sign-off.
fix logout unknown-host test for the same-host referer gate
Some checks failed
Lint / Run on Ubuntu (push) Has been cancelled
Lint / Run on Ubuntu (pull_request) Has been cancelled
E2E Tests / Run on Ubuntu (push) Has been cancelled
E2E Tests / Run on Ubuntu (pull_request) Has been cancelled
Tests / Run on Ubuntu (push) Has been cancelled
Tests / Run on Ubuntu (pull_request) Has been cancelled
28d71e2ef5
Merge remote-tracking branch 'origin/master' into feat/oidc-logout
Some checks failed
Lint / Run on Ubuntu (push) Has been cancelled
Lint / Run on Ubuntu (pull_request) Has been cancelled
E2E Tests / Run on Ubuntu (push) Has been cancelled
E2E Tests / Run on Ubuntu (pull_request) Has been cancelled
Tests / Run on Ubuntu (push) Has been cancelled
Tests / Run on Ubuntu (pull_request) Has been cancelled
a02e7588bd
# Conflicts:
#	internal/serve/serve.go
ginjiruu merged commit c6843b044b into master 2026-09-15 17:29:34 +00:00
Sign in to join this conversation.
No reviewers
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.

Dependencies

No dependencies set.

Reference
lab/authz-bridge!28
No description provided.