Repository navigation
9.10.0
Release 9.10.0
Overview
A minor release about what happens before authentication. The brute force guard now counts every failed attempt and refuses a blocked source whatever credentials it sends; no request reads the database before it is authenticated. Upgrading from 9.9.2 needs no data migration and no configuration change. It is a minor release, not a patch, because the order of some interceptors changed: if you write plugins, read For plugin developers below.
Improvements
Brute force guard
- A blocked source is refused before authentication. It gets
429 Too Many Requestswhatever credentials it sends. Until 9.9.2 the answer of a blocked source depended on the credentials:401for wrong ones,429for the right ones, so the block could be used to test passwords. - The block holds while the attack goes on. A blocked request counts as a failed attempt too: the source is released only after it stays quiet for a whole 10 seconds window. Until 9.9.2 the window drained during the block, and
max-failed-attemptsrequests went through every 10 seconds. - Every request without an authenticated account counts, whatever its status. Until 9.9.2 only a
401did, so wrong credentials on a collection that does not exist, answered404, were never counted. - At DEBUG, each counted failure is logged with its source and the count in the window:
Failed auth counted: histogram=… count=….
Docs: Brute Force Attack Guard.
Nothing reads the database before authentication
- The properties of the db and of the collection are now read after authentication. Whether a db or a collection exists is information, and the query that answers it no longer runs for a request without valid credentials.
- An error set by an interceptor at
REQUEST_BEFORE_AUTHis sent at once. Until 9.9.2 it was held back until after authentication.
Bug Fixes
- The brute force guard lost failed attempts under concurrency: requests arriving together were counted as one. Each failure is now one entry of the sliding window, and none is lost.
- The brute force guard forgot every source each 100 failed requests overall, so a
max-failed-attemptsof 100 or more was never reached, and under a distributed attack a lower one could be missed too. Only the sources with an empty window are forgotten now.
Behavior Changes
- Brute force guard. A blocked source gets
429also with the right credentials, until it stays quiet for 10 seconds. Requests with wrong or missing credentials are counted on any path, existing or not. 404and401. A request without valid credentials for a db or a collection that does not exist gets401, as before; the difference is that the database is not queried for it.
For plugin developers
Check your interceptors against these changes.
dbPropsInjectorandcollectionPropsInjectormoved fromREQUEST_BEFORE_AUTHtoREQUEST_AFTER_AUTH, with priorityInteger.MIN_VALUEandInteger.MIN_VALUE + 1. An interceptor that readsMongoRequest.getDbProps()orgetCollectionProps()must run atREQUEST_AFTER_AUTHwith a priority value higher than those. AtREQUEST_BEFORE_AUTHthe properties are no longer there.- Each interceptor is resolved right before it is handled, in priority order, so
resolve()sees what the interceptors before it attached to the request. Until 9.9.2 everyresolve()of an intercept point ran first, then everyhandle(). An interceptor whoseresolve()relied on the request as it was before the others handled it should be checked. vectorScanInterceptormoved from priorityInteger.MIN_VALUEtoInteger.MIN_VALUE + 10, still atREQUEST_AFTER_AUTH. The priorities fromInteger.MIN_VALUE + 2to+ 9are free for interceptors that declare an aggregation for the request:$vectorScanis recognized in the stages they add.- An error set at
REQUEST_BEFORE_AUTHends the request there: authentication does not run, and the interceptors atREQUEST_AFTER_FAILED_AUTHare not called for it.