Commit graph

758 commits

Author SHA1 Message Date
Eliot Sykes
03926e0b75
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.
2020-07-28 11:33:52 +01:00
Tristan Toye
f92889b360
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
2020-06-07 13:11:30 -03:00
Gonzalo Rodriguez
e148cf2a73
Merge pull request #486 from olleolleolle/rubocop-084
Use RuboCop 0.84.0
2020-06-03 19:37:41 -03:00
Olle Jonsson
c07fcdde43 Use RuboCop 0.84.0
- this enables each of the new Cops and marks each with the version
they appeared in
2020-05-24 17:50:56 +02:00
Gonzalo Rodriguez
493157d555
Merge branch '6-stable' 2020-05-20 23:53:44 -03:00
Gonzalo Rodriguez
3a5d10c8b3
Bump gem version to v6.3.1 2020-05-20 23:19:26 -03:00
Gonzalo Rodriguez
02f56979f1
Merge pull request #482 from splitwise/rofreg/avoid-rails-5.2.4.3-deprecation-warning
Fix deprecation warning in Rails 5.2.4.3
2020-05-20 23:03:29 -03:00
Gonzalo Rodriguez
91596db90f
Merge pull request #482 from splitwise/rofreg/avoid-rails-5.2.4.3-deprecation-warning
Fix deprecation warning in Rails 5.2.4.3
2020-05-20 21:33:13 -03:00
Ryan Laughlin
31dd7a8d17 Override RedisCacheStoreProxy#read to always use raw: true 2020-05-20 10:34:58 -04:00
Gonzalo Rodriguez
d92f66c8d9
Merge pull request #483 from splitwise/rofreg/clean-up-documentation
Consolidate #testing section of README
2020-05-18 20:24:53 -03:00
Ryan Laughlin
029b5481fe Consolidate #testing section of README 2020-05-18 17:41:58 -04:00
Ryan Laughlin
d5a240d9d2 Fix deprecation warning in Rails 5.2.4.3 2020-05-18 17:14:12 -04:00
Gonzalo Rodriguez
fe5deb9093
Merge branch '6-stable' 2020-04-26 13:09:29 -03:00
Gonzalo Rodriguez
35e4983400
doc: add Testing section to the README 2020-04-26 13:09:13 -03:00
Gonzalo Rodriguez
33b7c3b233
Merge branch '6-stable' 2020-04-26 12:39:42 -03:00
Gonzalo Rodriguez
aa071aa5df
Bump gem version to v6.3.0 2020-04-26 11:57:31 -03:00
Gonzalo Rodriguez
76bbada48f
ci: update rubies 2020-04-25 16:30:34 -03:00
Gonzalo Rodriguez
4c33737ed3
build: update rubocop to v0.78 2020-04-25 16:29:17 -03:00
Gonzalo
8787f7db5a
ci: test against latest rack minor versions 2020-04-25 16:28:48 -03:00
Gonzalo
aeac2d4887
ci: update to final ruby 2.7 2020-04-25 16:28:34 -03:00
Gonzalo Rodriguez
fadb98f25c
ci: update Travis dist to bionic 2020-04-25 16:28:27 -03:00
Gonzalo
8bbd0ab702
ci: test against ruby 2.7.0
- don't test ruby 2.7.0 with incompatible rails versions
2020-04-25 16:28:17 -03:00
fatkodima
9923012fe8
Allow to reset state between tests 2020-04-25 16:22:55 -03:00
Gonzalo Rodriguez
64f879395d
Merge commit '8fcd6c855915c802adeeb1784c503fc74115f5a3' into 6-stable 2020-04-25 16:17:37 -03:00
Gonzalo Rodriguez
53c1d93fd1
style: avoid multiline ternary operator 2020-04-25 15:42:30 -03:00
Gonzalo Rodriguez
8ededbc738
ci: update rubies 2020-04-25 15:31:19 -03:00
Gonzalo Rodriguez
1c0c232a63
Revert "docs: help users write more clear bug reports with a template"
This reverts commit 0a80e30f46.
2020-04-25 15:29:45 -03:00
Gonzalo Rodriguez
688fee3046
build: update rubocop to v0.78 2020-04-05 19:21:59 -03:00
Gonzalo Rodriguez
580368fadd
Merge pull request #473 from kickstarter/ci
ci: test against latest rack minor versions
2020-02-10 14:17:45 -03:00
Gonzalo
9f93d34492
ci: test against latest rack minor versions 2020-02-10 13:16:10 -03:00
Gonzalo
0a80e30f46
docs: help users write more clear bug reports with a template 2020-01-27 16:03:41 -03:00
Gonzalo
addadf6b31
ci: update to final ruby 2.7 2020-01-06 13:09:04 -03:00
Gonzalo Rodriguez
fa5ef552d3 ci: update Travis dist to bionic 2019-12-18 15:06:24 -03:00
Gonzalo
f413efc796 ci: test against ruby 2.7.0
- don't test ruby 2.7.0 with incompatible rails versions
2019-12-18 15:03:54 -03:00
Gonzalo
626eb8e133 Merge branch '6-stable' 2019-12-18 13:24:56 -03:00
Gonzalo Rodriguez
da41880663 Bump gem version to v6.2.2 2019-12-18 11:44:15 -03:00
Gonzalo Rodriguez
d7b67011b7 ci: fix rubygems install step 2019-12-18 11:43:42 -03:00
Gonzalo Rodriguez
30898d8caf
ci: fix rubygems install step 2019-12-17 18:24:38 -03:00
fatkodima
6cca2467d2
Fix rescuing errors in RedisProxy#increment 2019-12-17 17:54:18 -03:00
Nikolay Rys
f79759717a Feature proposal: Request instead of Env in callbacks (#419)
feat: allow easy access to the request object in the callbacks
2019-12-17 14:44:08 -03:00
Gonzalo Rodriguez
c4b15500dc
Merge pull request #463 from lumaxis/patch-1
Use gender-neutral pronoun in Readme
2019-12-12 14:25:26 -03:00
Lukas Spieß
58b4042e35
Use gender-neutral pronoun in Readme 2019-12-12 18:13:13 +01:00
Gonzalo Rodriguez
5a767f8736
Merge pull request #458 from fatkodima/older-rails-auto-use
Auto include middleware for older railses
2019-10-31 10:15:01 -03:00
fatkodima
2527b37221 Auto include middleware for older railses 2019-10-31 14:35:29 +02:00
Gonzalo Rodriguez
9c774b5eeb
Merge branch '6-stable' 2019-10-30 16:21:49 -03:00
Gonzalo Rodriguez
3654293085
Bump gem version to v6.2.1 2019-10-30 15:26:58 -03:00
Gonzalo Rodriguez
a103ff4819
Merge pull request #457 from kickstarter/fix_load
fix: avoid unintended effects on load_config_initializers and other gems load order
2019-10-30 15:13:05 -03:00
Gonzalo Rodriguez
e3056e737f
fix: avoid unintended effects on load_config_initializers and other gems load order
Because of the sort algorithm rails uses to satisfy `after` and `before`
constraints, gems can have unintended effects on others. See
0a120a818d

Prefer making rack-attack middleware idempotent instead of relying on
the load order and the contents of the middleware stack too much.

closes #452
closes #456
2019-10-29 15:45:26 -03:00
Gonzalo Rodriguez
a7ce9a89fe
Merge pull request #449 from fatkodima/ruby-2.3
Remove support for ruby 2.3
2019-10-25 11:11:09 -03:00
Gonzalo Rodriguez
129e970d42
Merge pull request #453 from fatkodima/dynamic-proxies
Make store proxies lookup dynamic
2019-10-25 11:05:37 -03:00