[fix] botdetection: return error, do not fail silently
Returns 429 (too many requests) when too many suspicious requests,
instead of returning to homepage with 302 (found). This is in line
with how other botdetections are handled. This partially reverts
b8c7c2c
where this was changed without reason.
Without this commit, users in the blocked state, upon searching,
will see that their query disappear without further explanation.
Refer: #3191
This commit is contained in:
parent
28ead13eb9
commit
3e409047e5
@ -122,8 +122,7 @@ def filter_request(
|
||||
redis_client, 'ip_limit.SUSPICIOUS_IP_WINDOW' + network.compressed, SUSPICIOUS_IP_WINDOW
|
||||
)
|
||||
if c > SUSPICIOUS_IP_MAX:
|
||||
logger.error("BLOCK: too many request from %s in SUSPICIOUS_IP_WINDOW (redirect to /)", network)
|
||||
return flask.redirect(flask.url_for('index'), code=302)
|
||||
return too_many_requests(network, "too many request in SUSPICIOUS_IP_WINDOW (SUSPICIOUS_IP_MAX)")
|
||||
|
||||
c = incr_sliding_window(redis_client, 'ip_limit.BURST_WINDOW' + network.compressed, BURST_WINDOW)
|
||||
if c > BURST_MAX_SUSPICIOUS:
|
||||
|
Loading…
Reference in New Issue
Block a user