Skip to content

app/: sign-in's return address refuses control characters (open redirect) - #72

Merged
ndbroadbent merged 1 commit into
mainfrom
fix-return-to
Dec 2, 2026
Merged

ndbroadbent merged 1 commit into
mainfrom
fix-return-to

Conversation

@ndbroadbent

Copy link
Copy Markdown
Member

Fixes an open redirect found in review: /auth/github?return_to=/%09/evil.com decodes to /<tab>/evil.com. Browsers strip the tab from a Location header, so after a real sign-in the person landed on //evil.com, which is another site. In the MCP sign-in flow that's a phishing step.

safe_return now matches today's check (server/src/controllers/session.rs:111-118): it refuses control characters and anything over 4000 characters, as well as // and backslashes.

The test signs in with each unsafe address (//, %09, %0a, %0d, %5C, and a 4001-character path) and checks that it lands on /. The sign-in tests pass on docspring-dev, and clippy is clean.

…g over 4000 characters, as today's server does: /%09/evil.com decoded to /\t/evil.com, which browsers turn into //evil.com after a real sign-in (an open redirect)
@visualci-com

visualci-com Bot commented Dec 2, 2026

Copy link
Copy Markdown

VisualCI

docspring/visualci · build #242 · 331 unchanged · no changes

This PR vs base: nothing since #226, across 1 build

Updated as builds change. Agents can review with VisualCI's MCP tools.

@ndbroadbent
ndbroadbent merged commit 8e519ed into main Dec 2, 2026
11 checks passed
@ndbroadbent
ndbroadbent deleted the fix-return-to branch December 2, 2026 14:18
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