Commit graph

125 commits

Author SHA1 Message Date
Eliot Sykes
1cd4a1cd79
Mitigate login throttle bypasses in docs
This commit mitigates rate limit bypasses in the configuration
docs by normalizing the email throttle key. (The normalization process
used is the same as used by the Clearance gem.)

---

Often an authentication process normalizes email addresses and usernames
before look up, say by downcasing and removing any whitespace.

Throttles that do not perform the same normalization are vulnerable
to rate limit bypasses.

For example, an attacker can bypass a vulnerable throttle by using
unlimited case and whitespace variants for the same email address:

- Variant 1: `victim@example.org`
- Variant 2: `victim@example. org` (one whitespace)
- Variant 3: `victim@example.  org` (two whitespaces)
- Variant 4: `ViCtIm@eXaMpLe.org`
- etc, etc.

All of these variants resolve to the same email address, but allow
an attacker to bypass a vulnerable throttle. To mitigate, the email
throttle key should be normalized using the same logic the
authentication process uses for normalizing emails.

(cherry picked from commit 03926e0b75)
2021-01-23 13:55:47 -03:00
Tristan Toye
48531f546c
Clarify Calling HTTP_APIKey header in example (#488)
* Clarify Calling HTTP_ header in example

In trying to track down a bug here turns out I was trying to reference the wrong header shown in the readme.

Printing our `request.env` it becomes clear this is just the full request object:

```
{"rack.version"=>[1, 3],
 "rack.errors"=>#<IO:<STDERR>>,
 "rack.multithread"=>true,
 "rack.multiprocess"=>false,
 "rack.run_once"=>false,
 "SCRIPT_NAME"=>"",
 "QUERY_STRING"=>"",
 "SERVER_PROTOCOL"=>"HTTP/1.1",
 "SERVER_SOFTWARE"=>"puma 4.3.5 Mysterious Traveller",
 "GATEWAY_INTERFACE"=>"CGI/1.2",
 "REQUEST_METHOD"=>"POST",
 "REQUEST_PATH"=>"/api/v1/....",
 "REQUEST_URI"=>"/api/v1/...",
 "HTTP_VERSION"=>"HTTP/1.1",
 "HTTP_HOST"=>"example.com",
 "HTTP_APIKEY"=>"secret_key",
 "CONTENT_TYPE"=>"application/json",
 "HTTP_USER_AGENT"=>"PostmanRuntime/7.25.0",
 "HTTP_ACCEPT"=>"*/*",
 "HTTP_CACHE_CONTROL"=>"no-cache",
...
```

* Update README.md

(cherry picked from commit f92889b360)
2021-01-23 13:55:47 -03:00
Ryan Laughlin
9da0bb7712
Consolidate #testing section of README
(cherry picked from commit 029b5481fe)
2021-01-23 13:55:46 -03:00
Lukas Spieß
614e10aa9c
Use gender-neutral pronoun in Readme
(cherry picked from commit 58b4042e35)
2021-01-23 13:55:45 -03:00
Gonzalo Rodriguez
35e4983400
doc: add Testing section to the README 2020-04-26 13:09:13 -03:00
fatkodima
a34c187dda Allow to configure Retry-After header for default throttled_response handler 2019-10-17 00:26:13 +03:00
Gonzalo Rodriguez
1167c65ba6
Don't autoplug middleware for untested rails versions 2019-10-12 18:10:10 -03:00
Gonzalo Rodriguez
2d1de4ac62
docs: add note about README contents gotcha 2019-10-11 16:00:01 -03:00
fatkodima
f22b24cbc5 Do not auto-plug for rails < 5 2019-10-08 13:08:07 +03:00
fatkodima
b512e05786 Auto plug middleware for simpler installation 2019-10-08 12:29:25 +03:00
Gonzalo Rodriguez
f86632f386
docs: add gitter chat badge 2019-08-01 14:23:30 -03:00
Gonzalo Rodriguez
58ba650e6b
feat: provide discriminator in throttle_data 2019-07-10 17:21:48 -03:00
Lucas Mansur
93fa023322 Use namespaced event 2019-05-23 19:01:50 -03:00
Gonzalo Rodriguez
6c6dfb06e3
feat: match ActiveSupport Instrumentation event name format spec 2019-02-24 20:19:38 -03:00
Gonzalo Rodriguez
ef7fe67b5e
docs: fix typo 2018-10-30 10:27:46 -03:00
Leo Arnold
b0da52a1bd Move Wiki examples into version control. Closes #324 2018-10-28 19:21:43 +01:00
Leo Arnold
95d536414a Add table of contents to README. Closes #335 2018-10-08 18:15:07 +02:00
Gonzalo Rodriguez
ef21932760
Update README: Mailing list no longer user 2018-09-03 18:35:08 -03:00
Kurtis Rainbolt-Greene
ea58ccbb6a
Forgot to match the header 2018-08-16 10:32:02 -07:00
Kurtis Rainbolt-Greene
3e5a4607cd
Prefer to not use X- style headers for clarity
The IETF decided the X- style custom headers have caused more headache than the value: https://tools.ietf.org/html/rfc6648 so this tool (which is very popular and much loved) shouldn't suggest using an old style.
2018-08-16 08:11:30 -07:00
Carlos Contreras
711ba9bf99 Fix copy on safelist description 2018-07-31 15:38:16 -05:00
Gonzalo Rodriguez
73bc739d5a
Merge remote-tracking branch 'doliveirakn/master' 2018-06-29 11:17:19 -03:00
Gonzalo Rodriguez
8802ebfbaf
Merge branch '255-correct-object-for-instrumentation' 2018-06-28 16:40:08 -03:00
Spencer Norman
f56967f923 fixed spelling issue, returna to return (#334)
* fixed spelling issue, returna to returns

* fixed the spelling properly this time, returns to return
2018-04-06 10:19:53 -03:00
Gonzalo Rodriguez
2d6ad830ac
docs: provide some advice for users willing to contribute to the project 2018-03-30 15:29:16 -03:00
Koen Rouwhorst
0457bf22f9 Updated all non-secure HTTP URLs to HTTPS. 2018-03-29 18:41:40 +02:00
Gonzalo Rodriguez
4c1aa8b312
[Fixes #318] Attempt to improve README a bit (#323)
* docs: Improve Getting Started section

* docs: Following Getting Started show Usage to the README reader

* docs: Move the configuration tip to the Usage section

* docs: Move the cache store configuration comment to Usage

* docs: Clarify Responses title

* docs: allow2ban also uses the cache store

* docs: Improve Usage docs for blocking, safelisting and throttling

* docs: Don't give the impression that the gem is not being maintained when it actually is

* docs: Be a bit more clear about cache store in README

* docs: Attempt to be a bit more concise in the README intro

* docs: Clarify sentence
2018-03-29 11:42:27 -03:00
Domenoth
5004b04ac7 Change object type yielded to ActiveSupport::Subscribers
https://github.com/kickstarter/rack-attack/issues/255

Change the object type from instances of type Rack::Attack::Request to
instances of type Hash. (`req` becomes `request: req`).
2018-03-21 11:32:09 -07:00
Gonzalo Rodriguez
43eec3ab78
Merge pull request #248 from amirshadaab/add-requires-to-README
add require lines in README.md file
2018-03-12 11:47:50 -03:00
Amir Shadaab Mohammed
83ac0f7b0d add require lines in README.md file 2018-03-09 15:04:27 -06:00
Gonzalo Rodriguez
71c10d1ebe
Merge pull request #279 from tjnet/surpress_rubocop_complains_about_initalizer_file_name
fix rubocop complains about initializer file name (use snake_case)
2018-03-07 20:27:41 -03:00
Alex Taylor
993d724b64
Mention 'match_discriminator' in README.md 2018-03-05 17:21:36 -08:00
Kyle d'Oliveira
9dbece5272 Add an reader for the epoch_time variable in the cache so that it can also be returned in the data from the throttle.
This is allows access to the same time that the cache uses for the count. This can be important for clients that want to provide rate limit information for well-behaved clients
2018-02-15 14:45:35 -08:00
jun_tanaka555
70a4c1f933 fix rubocop complains about initializer file name 2018-02-04 16:18:54 +09:00
Gonzalo Rodriguez
16af283d28 Don't make README examples depend on activesupport 2018-01-31 19:12:52 -03:00
Gonzalo Rodriguez
34ee066eac Drop support for Rails 3 2018-01-23 16:12:16 -03:00
Gonzalo
aeca8e52b3 Update to new ruby hash syntax in docs 2018-01-17 11:05:22 -03:00
Aaron Suggs
dc308add10 README: add section for maintainers 2017-02-09 22:26:57 -05:00
Olle Jonsson
7285e721aa README: Badges as SVG not PNG 2017-01-16 12:24:25 +01:00
Julian Doherty (madlep)
2c853bae9d it's minitest, not rspec 2016-08-04 22:51:14 +10:00
Julian Doherty (madlep)
9402908db9 added discussion about how to run test suite 2016-08-04 21:49:43 +10:00
Aaron Suggs
b07537d51e README: add example for returning X-RateLimit-* headers 2016-08-03 14:04:00 -04:00
Aaron Suggs
eb9331fb8c whitespace 2016-07-04 21:42:44 -04:00
Aaron Suggs
f5f08d56e5 More safelist/blocklist refactoring
- Add Rack::Attack namespace to deprecation warning.
- Add deprecated Rack::Attack.blacklisted_response attr methods.
2016-07-04 21:42:41 -04:00
Renée Hendricksen
e1a0c804e1 suggesting changing whitelist/blacklist language to less controversial safelist/blocklist language
add deprication warnings

fix the method signatures
2016-07-01 21:44:45 -04:00
Aaron Suggs
3bbf9b0b5b Copyright Kickstarter, PBC 2016-05-18 06:27:47 -04:00
Leslie Zhang
7af55447cc Fix typo in README.md 2016-01-08 15:33:44 +08:00
Aaron Suggs
2b75edacfd Merge pull request #149 from watsonbox/readme-scoping-fail2ban
Add note to README.md about scoping of Fail2Ban filters
2015-12-18 09:00:03 -05:00
Aaron Suggs
b32148e0be README: add ipv6 example
Per #151
2015-11-30 10:52:15 -05:00
Howard Wilson
4d5e859a12 Add note to README.md about scoping of Fail2Ban filters 2015-11-09 13:43:50 +01:00