Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A better fix for open redirect vulnerability. #906

Merged
merged 1 commit into from
Jan 22, 2024
Merged

Conversation

jwag956
Copy link
Collaborator

@jwag956 jwag956 commented Jan 21, 2024

In the few cases where user input is used for redirecting (via the 'next' parameter) pull apart the URL and quote the path. This will render any of the bizarre URLs that are relative according to the spec, but interpreted as absolute by many browsers definitely relative (and harmless).

Remove the previous fix including REDIRECT_VALIDATE_MODE and REDIRECT_VALIDATE_RE configuration variables. The Werkzeug default of sending relative URLs in Location header was restored as well.

closes #893

In the few cases where user input is used for redirecting (via the 'next' parameter) pull apart the URL and quote the path. This will render any of
the bizarre URLs that are relative according to the spec, but interpreted as absolute by many browsers definitely relative (and harmless).

Remove the previous fix including REDIRECT_VALIDATE_MODE and REDIRECT_VALIDATE_RE configuration variables.
The Werkzeug default of sending relative URLs in Location header was restored as well.
Copy link

codecov bot commented Jan 22, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (5725f70) 98.37% compared to head (53e9d5b) 98.38%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #906      +/-   ##
==========================================
+ Coverage   98.37%   98.38%   +0.01%     
==========================================
  Files          34       34              
  Lines        4487     4465      -22     
==========================================
- Hits         4414     4393      -21     
+ Misses         73       72       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@jwag956 jwag956 merged commit 3f959d7 into master Jan 22, 2024
19 checks passed
@jwag956 jwag956 deleted the 893p2redirect branch January 22, 2024 16:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Open redirect possibility with newer werkzeug
1 participant