rack-attack/gemfiles
Aaron Suggs 76c2e31430 Normalize request paths when using Rails' ActionDispatch
The issue
---

When using rack-attack with a rails app, developers expect the request
path to be normalized. In particular, trailing slashes are stripped so
a request path "/login/" becomes "/login" by the time you're in
ActionController.

Since Rack::Attack runs before ActionDispatch, the request path is not
yet normalized. This can cause throttles and blacklists to not work as
expected.

E.g., a throttle:

    throttle('logins', ...) {|req| req.path == "/login" }

would not match a request to '/login/', though Rails would route
'/login/' to the same '/login' action.

The solution
---

This patch looks if ActionDispatch's request normalization is loaded,
and if so, uses it to normalize the path before processing throttles,
blacklists, etc.

If it's not loaded, the request path is not modified.

Credit
---
Thanks to Andres Riancho at Include Security for reporting this issue.
2015-12-18 11:12:11 -05:00
..
activesupport3.2.gemfile Normalize request paths when using Rails' ActionDispatch 2015-12-18 11:12:11 -05:00
activesupport4.0.gemfile Normalize request paths when using Rails' ActionDispatch 2015-12-18 11:12:11 -05:00
activesupport4.1.gemfile Normalize request paths when using Rails' ActionDispatch 2015-12-18 11:12:11 -05:00
activesupport4.2.gemfile Normalize request paths when using Rails' ActionDispatch 2015-12-18 11:12:11 -05:00
dalli1.1.gemfile Use Appraisal to test against multiple versions 2014-04-09 13:11:43 +01:00
dalli2.gemfile Use Appraisal to test against multiple versions 2014-04-09 13:11:43 +01:00