Public: anyone can read this; the crew can change it.

/login and /sign-in send you to /signin, keeping where you were going #6055

Parked opened this
Closed without merging

GET /login and GET /sign-in now answer 308 to /signin instead of a 404. bun test passes for the new file and the sign-in page tests. I couldn't run the type check here, because tsc couldn't find the bun type definitions.

Notes

stopped parked by the crew deploy 27d0217

opened this

GET /login and GET /sign-in now answer 308 to /signin instead of a 404. bun test passes for the new file and the sign-in page tests. I couldn't run the type check here, because tsc couldn't find the bun type definitions.

  • What changed: both aliases share one handler, signinAlias in src/web/pages/site.ts, registered next to /signin in src/http/server.ts.
  • next handling: it reuses the existing safeNext check that /signin already applies, so there is no second validator. A value like /settings becomes /signin?next=%2Fsettings. //evil.test and https://evil.test are dropped, so the redirect goes to plain /signin.
  • Test: test/signin-alias.test.ts covers both aliases for the bare redirect, next=/settings surviving, and both off-site values being dropped. It also checks that /signup is not redirected.
  • Left out: no other aliases (/signin/ with a trailing slash, /log-in), and no /signup alias.

To try it, open /login?next=/settings and you land on /signin?next=%2Fsettings.

Closes #6038

2 earlier comments
commented

No feedback is on the pull: it has no comments, and the working tree is clean. I made no changes and pushed nothing.

The pull stands as described: /login and /sign-in answer 308 to /signin, and a same-origin next is kept. Off-site next values are dropped. I did not run the type check, because tsc couldn't find the bun type definitions.

Closes #6038

commented

GET /login and GET /sign-in now answer 308 to /signin, and next survives only when it is a same-origin path. The alias test passes (7 tests). I did not run the full suite or the type check. Nothing new needed pushing: the commit was already on the branch, and the issue has no new comments.

  • Redirect: signinAlias in src/web/pages/site.ts handles both paths, and src/http/server.ts routes them. next=/settings comes through as /signin?next=%2Fsettings.
  • Open redirect: the alias calls the same safeNext check /signin already uses, so there is no second check. next=//evil.test and next=https://evil.test are dropped and you land on plain /signin.
  • Left alone: /signup is untouched, and no other path became an alias.
  • Tests: test/signin-alias.test.ts covers both aliases, next=/settings kept, and both evil values dropped.

To try it, run curl -i <host>/login?next=/settings and look for 308 and location: /signin?next=%2Fsettings.

commented

Parked by the crew: the check failed ("every GET page names session and render in Server-Timing, bar the listed debt") and the decider saw no point in another try try 1: src/http/server.ts, src/web/pages/site.ts, test/signin-alias.test.ts

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs