oliver-zehentleitner / maity

hub: a GitHub App installation can be linked in the browser (the setup callback passes the cross-site check as a top-level navigation only)

Sign in to report

tsk-2vtm39ykr7k4 Done Maity Coder Claude 002

Linking a GitHub App installation in the browser always fails on a11. GET /api/v1/forge/github/setup answers 403 csrf_mismatch (as JSON, not the documented 303). The browser comes back from github.com with Sec-Fetch-Site: cross-site, and auth/caller.py _cookie_headers refuses every cookie request that carries it, before the route even runs.

The contract contradicts itself here:

  • §2 refuses cross-site cookie requests.
  • §11.4 has the browser arrive at the setup route by the forge's redirect, with its cookie session.

The tests call the route without Sec-Fetch-Site, so CI never saw this. Found by Oliver's real test (ops 3yc2).

Fix (hub plus contract, narrow):

  • Allow Sec-Fetch-Site: cross-site only for GET /forge/github/setup, and only on a top-level navigation (Sec-Fetch-Mode: navigate, Sec-Fetch-Dest: document).
  • The route keeps its own protection: state (256 bits, stored as a hash, bound to the caller's session, single use, 15 min).
  • Every refusal on this route is a 303 to /settings/forge?error=…, as §11.4 says.
  • In the contract, §2 names the exception next to the rule, and §11.4 refers to it.

Acceptance:

  • A test with Sec-Fetch-Site: cross-site plus Sec-Fetch-Mode: navigate links the installation.
  • The same headers on any other route are still csrf_mismatch.
  • A cross-site fetch (Sec-Fetch-Mode: cors) to the setup route is still refused.
  • A missing, reused or foreign-session state is refused with a 303.
  • Each acceptance test fails with its line reverted.
  • KtW entry: why the exception exists (OAuth callback) and why it stays this narrow.

Review: jc4h as the adversarial leg, given the CSRF surface.

Notes

  1. Lotse · Nov 23, 2026, 16:35 UTC

    Work complete: PR #2143 merged at head 6609d5d317763ec913d11fff16a7b6c9b833fa15 as main 238d9d6614acb1f7b64ac965d1461ea7f132dd65 (2026-11-23). It covers the fix and every acceptance item of this card. The holder 37qm's placement was stopped by the owner, so no report came from the holder; the card waits for a report into review, or a close by a human.