matrix-axon

Apple browser OAuth internal review follow-up

Response to the internal review of the three local Apple browser OAuth commits. All changes remain in the server silo except documentation and the mechanically generated web API schema.

Findings

  1. Bind URL reloads and prefetches: generate the immutable nonce when inserting the CLI bind request, before printing its URL. GET and HEAD only read and redirect; repeated requests return the same state and nonce. Completion and cancellation remain single-use. Legacy pending rows without a nonce require a fresh CLI attempt, not a migration.
  2. Apple cancellation: recognize user_cancelled_authorize for Apple, as documented in Apple’s authorization endpoint reference. Unknown provider errors receive neutral retry guidance, not an outage diagnosis.
  3. Callback hardening: the HTML/no-store/no-referrer response layer now wraps the rate limiter as well as the handler. Regression tests cover body-size rejection, per-state and per-IP throttling, and a stalled request body.
  4. Bearer warning amplification: one fixed-size, process-wide warning slot is shared by HTTP and WebSocket rejection paths. It emits at most one warning per 30 seconds; additional events are debug-only. A concurrent test covers contention and reopening the warning window.
  5. OpenAPI: document GET query parameters and POST form input separately, both with HTML failure responses. Regenerate the spec and web schema; a dedicated test asserts both methods and media types. ADR 0054 records the existing GET error-envelope change.
  6. Retry messaging: the CLI reports cancellation, failure, or expiry without guessing which occurred, and explicitly requests a new bind attempt. Provider-error text also specifies a new attempt; an upstream exchange cannot safely be resumed after its code may have been consumed.

Smaller findings

PR review follow-up

Verification commands

Use the commands in the verification guide, plus:

cargo test -p axon-api --lib auth::tests
cargo test -p axon-api --lib routes::oauth
cargo test -p axon-server oauth_runtime_tests
pnpm --dir clients/web check:api

Live cancellation and bootstrap acceptance remain operator follow-ups; unit and mock-provider tests do not replace those checks.