Skip to content
This repository has been archived by the owner on Sep 19, 2024. It is now read-only.

Write integration test for ensuring that logins can't redirect to unsafe urls #48

Open
alexander-bauer opened this issue Apr 17, 2017 · 4 comments
Assignees
Labels

Comments

@alexander-bauer
Copy link
Member

No description provided.

@alexander-bauer
Copy link
Member Author

A common exploit is sending users to legitimate login forms, and then redirect from them to a malicious site. We need to ensure that our is_safe_url() function in collegejump/forms.py correctly refuses to redirect to URLs that are not the same as our site.

@ichniow1
Copy link
Contributor

need an example of context for a call to is_safe_url(target), just get errors any time I try to invoke it from inside of test

@alexander-bauer
Copy link
Member Author

@ichniow1 You probably can't call the function directly with the context that's available from the test app, which is a problem if we want to write unit tests. I think it's too late in the game for those to be worthwhile, so I'm advocating integration tests. Rather than testing is_safe_url send a valid login to /login with your redirectto information set to some other domain, like https://google.com. If is_safe_url works, it will not redirect you there, but instead send you back to the front page of the app.

@ichniow1
Copy link
Contributor

yeah... yet to make any real progress here.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants