Skip to content

app/: signing out lands on the site; signing in never returns to an API path (sc-8900) - #122

Merged
ndbroadbent merged 2 commits into
mainfrom
app-signout-site
Dec 3, 2026
Merged

ndbroadbent merged 2 commits into
mainfrom
app-signout-site

Conversation

@ndbroadbent

@ndbroadbent ndbroadbent commented Dec 3, 2026 •

Copy link
Copy Markdown
Member

Two sign-in bugs Nathan hit in production on 3 Dec 2026.

Signing out showed the landing page at app.visualci.com

The app's / sent visitors to the site only when they had no session cookie. Signing out leaves a new, signed-out session (and its cookie), so the SPA was served, and it rendered the landing page for a signed-out visitor.

  • The check moved from route_by_host, which runs before sessions start, into app_shell, which reads the session: on the app's host, a signed-out / is a 307 to VISUALCI_SITE_URL.
  • Sign-out navigates to the site (siteUrl('/')), not the app's /.
  • The app's own host never renders Landing: signed out there, Home goes to the site. The landing page shows only on the site's host and on a single-origin server (dev, self-hosted).

"Sign in" landed on the JSON of /api/ui/me

The page's signed-out GET /api/ui/me, sent without Accept: application/json (#120 fixes the client), went through Laravel's Authenticate, which redirected it and remembered it as url.intended. Signing in from the site (no return_to) then returned there.

  • The return address after sign-in, from return_to or the remembered page, must be a page on the app. /api, /auth, /mcp, /webhooks, /internal, /.well-known and the OAuth server's endpoints are refused, judged as the router reads the path (/%61pi/... is /api); the consent page, /oauth/authorize, is still a page. A remembered URL must be on the app's host. Anything else lands on /.

Tests

Written first and seen failing on main (200 instead of 307; redirects to /api/ui/me), then passing:

  • signing_out_lands_on_the_site: four hosts, sign in, sign out, then the app's / with the cookies the browser keeps is a 307 to the site, and /auth/session says signed out.
  • signing_in_never_returns_to_an_api_path: a signed-out /api/ui/me that asks for HTML, then sign-in from the site, lands on / (200).
  • an_unsafe_return_address_is_ignored: also /api/ui/me, /%2561pi/ui/me, /auth/github, /oauth/token, /mcp, /webhooks/github.
  • home.test.tsx: the landing page renders off the app's host, and never on it, where the page goes to the site.

App tests pass on the build box, except the blob tests, which need S3 (CI has it). clippy is clean, and the frontend build and vitest pass.


Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

…an API path (sc-8900)

- The app's / decides on the session, not the cookie: signing out leaves a new, signed-out session, so the check moved
  from route_by_host (before sessions) to app_shell, which reads it.
- Sign-out navigates to the site (visualci.com), and the app's host never renders the landing page (Home goes to the
  site instead).
- After sign-in, the return address (return_to, or the page Laravel remembered) must be a page on the app: never
  /api, /auth, /mcp, /webhooks, /internal or the OAuth server's endpoints (the consent page is a page).
@ndbroadbent
ndbroadbent merged commit 0ef3a9c into main Dec 3, 2026
12 checks passed
@ndbroadbent
ndbroadbent deleted the app-signout-site branch December 3, 2026 07:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant