Skip to content

Commit a4416ca

Browse files
committed
Rate limiting improvement
1 parent 775b5a1 commit a4416ca

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

Model/FrontControllerPlugin.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ public function aroundDispatch(FrontControllerInterface $subject, callable $proc
135135
return $proceed(...$args);
136136
}
137137

138-
$path = strtolower($this->request->getPathInfo());
138+
$path = strtolower($this->request->getRequestUri());
139139

140140
if ($isRateLimitingEnabled && $this->sensitivePathProtection($path)) {
141141
return $this->response;
@@ -167,7 +167,8 @@ private function sensitivePathProtection($path)
167167

168168
$limit = false;
169169
foreach ($limitedPaths as $key => $value) {
170-
if (preg_match('{' . $value->path . '}i', $path) == 1) {
170+
$value->path = str_replace("#", "\#", $value->path);
171+
if (preg_match('#' . $value->path . '#i', $path)) {
171172
$limit = true;
172173
break;
173174
}

0 commit comments

Comments
 (0)