Skip to content

fix(auth): prevent open redirect via login 'next' parameter; fix npm audit vulnerabilities - #49

Open
jarrah31 wants to merge 2 commits into
knep:masterfrom
jarrah31:fix/login-open-redirect-and-deps
Open

jarrah31 wants to merge 2 commits into
knep:masterfrom
jarrah31:fix/login-open-redirect-and-deps

Conversation

@jarrah31

@jarrah31 jarrah31 commented Oct 14, 2026 •

Copy link
Copy Markdown

Where these changes come from

Both changes are new work in this PR, not ports from upstream. They came out of a security review of this fork.

Change Origin Status in bugy/script-server
Open redirect fix Bug inherited from upstream: the startswith('http') check dates from bugy 0434941 (2018), and the client-side validateURL() has the same gap Still unfixed upstream as of 62bd38a (2026-08-21)
npm audit fixes Fork-specific: this fork's Vue 3 / Vite dependency tree Not applicable (upstream still uses Vue 2 / Vue CLI)

Summary

Open redirect after login

TornadoAuth only rejected a next target that started with lowercase http, so a crafted login link could send users off-site after they logged in:

next value Before After
//evil.com http://evil.com /
HTTP://evil.com http://evil.com /
/\evil.com host-relative, but browsers treat /\ as // /
/index.html /index.html /index.html
  • New sanitize_next_path() in src/auth/tornado_auth.py accepts only same-site absolute paths (no scheme, no netloc, no backslashes, no // prefix); anything else falls back to /.
  • validateURL() in web-src/src/login/login.js applies the same rule on the client (it previously passed through any http… URL).

Dependency vulnerabilities

npm audit fix, plus vue → ^3.5.44 and vitest / @vitest/coverage-v8 → ^4.1.11 (same majors). Clears the advisories in axios, dompurify, @vue/server-renderer, nanoid, postcss, source-map-js and @vitest/mocker; npm audit now reports 0 vulnerabilities.

Testing

  • New src/tests/auth/test_tornado_auth_redirect.py (18 cases).
  • Backend: full pytest tests/ passes (1752 tests).
  • Frontend: vitest run passes (1048 tests); npm run build clean.
  • Manual: ran the server with htpasswd auth and logged in with each malicious next value; all redirect to /, legitimate paths still work.

🤖 Generated with Claude Code

jarrah31 and others added 2 commits October 14, 2026 20:24
The post-login redirect only rejected targets starting with lowercase
'http', so '//evil.com', 'HTTP://evil.com' and '/\evil.com' redirected
users off-site. Only same-site absolute paths are now accepted (any
scheme or netloc, protocol-relative and backslash variants fall back to
'/'). The login page's client-side validateURL applies the same rule.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
npm audit fix plus bumps of vue (^3.5.44) and vitest /
@vitest/coverage-v8 (^4.1.11) within their current majors. Clears
advisories in axios, dompurify, @vue/server-renderer, nanoid, postcss,
source-map-js and @vitest/mocker; npm audit now reports 0.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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