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

Ability to force host used when redirecting #371

Merged
merged 2 commits into from
Dec 1, 2017
Merged

Ability to force host used when redirecting #371

merged 2 commits into from
Dec 1, 2017

Conversation

alanhamlett
Copy link
Collaborator

Flask-Login's default unauthorized handler uses Flask.redirect to redirect to the login page. When a request is made to a route decorated with @login_required, then Flask.redirect correctly uses the Host or X-Forwarded-For as the host part of the redirect url.

This is fine, except in SSO applications or pen-tests. For those who don't mind breaking proxies, this PR adds a new config FORCE_HOST_FOR_REDIRECTS that always overwrites the host in flask_login.utils.login_url which is used when redirecting to the login url.

@coveralls
Copy link

coveralls commented Dec 1, 2017

Coverage Status

Coverage remained the same at 100.0% when pulling ebf83b1 on alanhamlett:force-host-for-redirects into 61d0848 on maxcountryman:master.

@alanhamlett
Copy link
Collaborator Author

alanhamlett commented Dec 1, 2017

Related to #353 and #354 and pallets/werkzeug#609.

@alanhamlett alanhamlett merged commit f9adafa into maxcountryman:master Dec 1, 2017
@alanhamlett alanhamlett deleted the force-host-for-redirects branch December 1, 2017 07:06
@github-actions github-actions bot locked and limited conversation to collaborators Apr 2, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants