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

Unvalidated Redirect Unit Test too Strict #317

Open
nvisium-john-poulin opened this issue Feb 21, 2018 · 0 comments
Open

Unvalidated Redirect Unit Test too Strict #317

nvisium-john-poulin opened this issue Feb 21, 2018 · 0 comments

Comments

@nvisium-john-poulin
Copy link
Contributor

The Unvalidated Redirect test is too tight, as it accepts only /dashboard/home. The current code in Railsgoat sets a default path to home_dashboard_index_path (https://github.com/OWASP/railsgoat/blob/master/app/controllers/sessions_controller.rb#L12)

After successfully mitigating the vulnerability, the test still fails with the following error:

  1) unvalidated redirect attack
Tutorial: https://github.com/OWASP/railsgoat/wiki/A10-Unvalidated-Redirects-and-Forwards-(redirect_to)
     Failure/Error: expect(current_url).to eq("/dashboard/home")

       expected: "/dashboard/home"
            got: "http://127.0.0.1:55981/dashboard/home"

I was able to fix this test by modifying it to compare two things. #1) That the current_url starts_with http://127.0.0.1, and #2) that the current path matches /dashboard/home, as seen below:

    expect(current_url).to start_with("http://127.0.0.1")
    expect(current_path).to eq("/dashboard/home")
nvisium-john-poulin added a commit to nvisium-john-poulin/railsgoat that referenced this issue Feb 21, 2018
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

No branches or pull requests

1 participant