Skip to content

fix: validate redirect parameter to prevent open redirect#262

Merged
lukepolo merged 1 commit intomainfrom
audit/383-redirect-validation
Mar 30, 2026
Merged

fix: validate redirect parameter to prevent open redirect#262
lukepolo merged 1 commit intomainfrom
audit/383-redirect-validation

Conversation

@Flegma
Copy link
Copy Markdown
Contributor

@Flegma Flegma commented Mar 30, 2026

Summary

  • Validates redirect query parameter in auth middleware to only allow relative paths
  • Rejects absolute URLs and protocol-relative URLs (//evil.com) to prevent open redirect attacks
  • Invalid redirects fall through to default / navigation

Test plan

  • Login with ?redirect=/play — should redirect to /play
  • Login with ?redirect=https://evil.com — should redirect to /
  • Login with ?redirect=//evil.com — should redirect to /
  • Login without redirect param — should redirect to /

Closes 5stackgg/5stack-panel#383

Only allow relative paths (starting with /) as redirect targets
after login. Reject absolute URLs and protocol-relative URLs
(starting with //) to prevent open redirect attacks.

Closes 5stackgg/5stack-panel#383
@lukepolo lukepolo merged commit d25cc1f into main Mar 30, 2026
@lukepolo lukepolo deleted the audit/383-redirect-validation branch March 30, 2026 16:17
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.

[Web] Validate redirect parameter in auth middleware

2 participants