Skip to content

Sign-in can return to the page check: safeNext allows /scan - #234

Open
MeharPro wants to merge 1 commit into
mainfrom
fix/signin-back-to-scan
Open

MeharPro wants to merge 1 commit into
mainfrom
fix/signin-back-to-scan

Conversation

@MeharPro

Copy link
Copy Markdown
Contributor

What

genclass.dev/scan now shows the whole report to any signed-in account (genclass-dev/genclass-site#56). Its "Sign in to see it all" and "Create a free account" buttons send people to /login and /signup with ?next=/scan?url=<encoded page>. But safeNext only allowed /account… and /login/device, so after signing in people landed on /account instead of back on the report.

safeNext now also allows:

  • /scan
  • /scan?url= followed by 1 to 280 URL-safe characters (letters, digits, % . _ ~ ! * ' ( ) / : + -)

It still refuses &, #, quotes, angle brackets, other query keys, other paths (/scanner, /scan/../account) and anything over 300 characters. All the existing sign-in paths (password, passkey, Google, GitHub, and an already signed-in visit to /login) already run their next through safeNext, so nothing else changes.

Checks

  • cd telemetry-worker && npx vitest run --maxWorkers=2: 873 of 873. The safeNext test gains 3 good and 9 bad /scan cases.
  • The strict typecheck of telemetry-worker/src/index.ts is clean.

Not deployed. It can ride with the next collector deploy. The scanner change works without it: until this ships, signing in from a report just lands on /account.

🤖 Generated with Claude Code

…?url=

genclass.dev/scan now opens the whole report to any signed-in account (the
owner's call, 2026-11-13, genclass-site PR on deploy/scan-page-light). Its
"Sign in to see it all" and "Create a free account" buttons go to /login and
/signup with ?next=/scan?url=<encoded page>. safeNext refused that, so people
landed on /account instead of back on the report. It now also allows /scan,
or /scan?url= followed by up to 280 URL-safe characters (no &, #, quotes or
angle brackets); every other next is refused as before.

Tests: telemetry-worker 873 of 873; strict typecheck clean.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
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