[tor-commits] [donate/master] Added subscription details to limiter error
peterh at torproject.org
peterh at torproject.org
Wed Jun 10 22:48:37 UTC 2020
commit 465154fb17d483f1db7e30fa2c4ec323989237f3
Author: peterh <peterh at giantrabbit.com>
Date: Mon Feb 3 17:28:38 2020 -0800
Added subscription details to limiter error
We're actually getting results that indicate someone is sending lots of
requests to the /subscription-request thing. I want to print out more
details in the log to see if we can get an idea if this is legitimate
traffic or not.
Issue #44700
---
src/IpRateLimiter.php | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/src/IpRateLimiter.php b/src/IpRateLimiter.php
index dd69c82e..969c1fc9 100644
--- a/src/IpRateLimiter.php
+++ b/src/IpRateLimiter.php
@@ -25,7 +25,11 @@ class IpRateLimiter {
if ($allowance < 1) {
$this->setIpData($keyName, $allowance, $now);
$ipAddress = $request->getAttribute('ip_address');
- throw new IpRateExceeded("There have been more than {$this->maxRequestsPerTimeSpan} requests from $ipAddress in the last {$this->timeSpan} seconds.");
+ $parsedBody = $request->getParsedBody();
+ $email = ArrayExt::fetch($parsedBody, 'email', '');
+ $firstName = ArrayExt::fetch($parsedBody, 'firstName', '');
+ $lastName = ArrayExt::fetch($parsedBody, 'lastName', '');
+ throw new IpRateExceeded("There have been more than {$this->maxRequestsPerTimeSpan} requests from $ipAddress in the last {$this->timeSpan} seconds. ($email, $firstName, $lastName)");
} elseif ($allowance > $this->maxRequestsPerTimeSpan) {
$allowance = $this->maxRequestsPerTimeSpan;
}
More information about the tor-commits
mailing list