fix(caddy): end the bitborg id session when forgejo v17 answers sign-out with 303 #762

Sammanfogat
supernaut sammanfogade 2 incheckningar från fix/716-signout-303 in i main 2026-10-17 13:29:04 +00:00
Ägare

Forgejo v17 submits sign-out as a form and answers POST /user/logout with 303 to / (v16: 200 JSON for fetch()). The git.* intercept only matched 200, so on v17 the bitborg_sso_logout cookie and the Keycloak end-session redirect (#646) would be skipped. Refs #716.

What

  • Caddyfile.j2: a 303 branch in the sign-out intercept adds the same cookie and redirects to /user/sso-logout. The 200 branch stays while prod runs v16.
  • test_frontchannel_logout.sh: a second stub answers 303 with a cookie-clearing Set-Cookie. The test asserts 303, Location: /user/sso-logout, bitborg_sso_logout=1, and that the upstream cookie is kept.

Checks

  • Test ok on the pinned Caddy image. Removing the 303 branch makes it fail on the Location assertion.
  • shellcheck 0.10.0 (pinned): clean.

After merge

  • --tags caddy on staging and prod (v16 keeps using the 200 branch).
  • After the v17 bump on staging: browser sign-out from Forgejo reaches Keycloak's logout and the next "Sign in" shows the form.
  • After prod runs v17: remove the 200 branch.
Forgejo v17 submits sign-out as a form and answers `POST /user/logout` with `303` to `/` (v16: `200` JSON for `fetch()`). The `git.*` intercept only matched `200`, so on v17 the `bitborg_sso_logout` cookie and the Keycloak end-session redirect (#646) would be skipped. Refs #716. ## What - `Caddyfile.j2`: a `303` branch in the sign-out intercept adds the same cookie and redirects to `/user/sso-logout`. The `200` branch stays while prod runs v16. - `test_frontchannel_logout.sh`: a second stub answers `303` with a cookie-clearing `Set-Cookie`. The test asserts `303`, `Location: /user/sso-logout`, `bitborg_sso_logout=1`, and that the upstream cookie is kept. ## Checks - Test `ok` on the pinned Caddy image. Removing the `303` branch makes it fail on the `Location` assertion. - shellcheck 0.10.0 (pinned): clean. ## After merge - [x] `--tags caddy` on staging and prod (v16 keeps using the `200` branch). - [x] After the v17 bump on staging: browser sign-out from Forgejo reaches Keycloak's logout and the next "Sign in" shows the form. - [ ] After prod runs v17: remove the `200` branch.
supernaut lade till 1 incheckning 2026-10-17 13:13:28 +00:00
fix(caddy): end the bitborg id session when forgejo v17 answers sign-out with 303
En del kontroller misslyckades
ci / ci (pull_request) Failing after 52s
a2ab7fb02a
v17 submits sign-out as a form and answers 303 to /, so the 200-only intercept never set the cookie. Keep the 200 branch while prod runs v16.

Refs #716.
supernaut schemalade den här ändringsförfrågan för automatisk sammanfogning när alla kontroller lyckas 2026-10-17 13:14:24 +00:00
supernaut lade till 1 incheckning 2026-10-17 13:25:40 +00:00
test(caddy): read the v17 sign-out response with nc, not wget
Alla kontroller lyckades
ci / ci (pull_request) Successful in 2m50s
4bdf185847
CI runs the test with BusyBox wget, which has no --max-redirect, follows every redirect and hides Set-Cookie. Refs #716.
supernaut sammanfogade incheckning 1e0d72e8d3 till main 2026-10-17 13:29:04 +00:00
supernaut tog bort grenen fix/716-signout-303 2026-10-17 13:29:04 +00:00
supernaut refererade denna ändringsförfrågan från en incheckning 2026-10-17 15:18:36 +00:00
Logga in för att delta i denna konversation.
Inga granskare
Ingen milstolpe
Inget projekt
Inga tilldelade
1 deltagare
Notiser
Förfallodatum
Förfallodatumet är ogiltigt eller utanför gränserna. Använd formatet "åååå-mm-dd".

Inget förfallodatum satt.

Beroenden

Inga beroenden satta

Referens
bitborg/bitborg-infra!762
Ingen beskrivning angiven.