You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+7-5Lines changed: 7 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -32,12 +32,13 @@ Classes
32
32
### ExpressBrute(store, options)
33
33
-`store` An instance of `ExpressBrute.MemoryStore` or `ExpressBrute.MemcachedStore`
34
34
-`options`
35
-
- `freeRetries` The number of retires the user has before they need to start waiting (default: 2)
36
-
- `minWait` The initial wait time (in milliseconds) after the user runs out of retries (default: 500 milliseconds)
37
-
- `maxWait` The maximum amount of time (in milliseconds) between requests the user needs to wait (default: 15 minutes). The wait for a given request is determined by adding the time the user needed to wait for the previous two requests.
38
-
- `lifetime` The length of time (in seconds since the last request) to remember the number of requests that have been made by an IP. By default it will be set to `maxWait * the number of attempts before you hit maxWait` to discourage simply waiting for the lifetime to expire before resuming an attack. With default values this is about 6 hours.
35
+
- `freeRetries` The number of retires the user has before they need to start waiting (default: 2)
36
+
- `minWait` The initial wait time (in milliseconds) after the user runs out of retries (default: 500 milliseconds)
37
+
- `maxWait` The maximum amount of time (in milliseconds) between requests the user needs to wait (default: 15 minutes). The wait for a given request is determined by adding the time the user needed to wait for the previous two requests.
38
+
- `lifetime` The length of time (in seconds since the last request) to remember the number of requests that have been made by an IP. By default it will be set to `maxWait * the number of attempts before you hit maxWait` to discourage simply waiting for the lifetime to expire before resuming an attack. With default values this is about 6 hours.
39
39
- `failCallback` gets called with (`req`, `resp`, `next`, `nextValidRequestDate`) when a request is rejected (default: ExpressBrute.FailForbidden)
40
-
- `proxyDepth` Specifies how many levels of the `X-Forwarded-For` header to trust. If your web server is behind a CDN and/or load balancer you'll need to set this to however many levels of proxying it's behind to get a valid IP. Setting this too high allows attackers to get around brute force protection by spoofing the `X-Forwarded-For` header, so don't set it higher than you need to (default: 0)
40
+
- `proxyDepth` Specifies how many levels of the `X-Forwarded-For` header to trust. If your web server is behind a CDN and/or load balancer you'll need to set this to however many levels of proxying it's behind to get a valid IP. Setting this too high allows attackers to get around brute force protection by spoofing the `X-Forwarded-For` header, so don't set it higher than you need to (default: 0)
41
+
- `attachResetToRequest` Specify whether or not a simplified reset method should be attached at `req.brute.reset`. The simplified method takes only a callback, and resets all `ExpressBrute` middleware that was called on the current request. If multiple instances of `ExpressBrute` have middleware on the same request, only those with `attachResetToRequest` set to true will be reset (default: true)
41
42
42
43
### ExpressBrute.MemoryStore()
43
44
An in-memory store for persisting request counts. Don't use this in production.
@@ -108,6 +109,7 @@ var userBruteforce = new ExpressBrute(store, {
108
109
var globalBruteforce =newExpressBrute(store, {
109
110
freeRetries:1000,
110
111
proxyDepth:1,
112
+
attachResetToRequest:false,
111
113
winWait:25*60*60*1000, // 1 day 1 hour (should never reach this wait time)
112
114
maxWait:25*60*60*1000, // 1 day 1 hour (should never reach this wait time)
0 commit comments