Skip to content

Commit ee2892e

Browse files
bug #26173 [Security] fix accessing request values (xabbuh)
This PR was merged into the 2.8 branch. Discussion ---------- [Security] fix accessing request values | Q | A | ------------- | --- | Branch? | 2.8 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #26172 | License | MIT | Doc PR | Commits ------- 1fc5df6 fix accessing request values
2 parents 245dd72 + 1fc5df6 commit ee2892e

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/Symfony/Component/Security/Http/Firewall/SimpleFormAuthenticationListener.php

+7-3
Original file line numberDiff line numberDiff line change
@@ -119,9 +119,13 @@ protected function attemptAuthentication(Request $request)
119119
}
120120
}
121121

122-
$requestBag = $this->options['post_only'] ? $request->request : $request;
123-
$username = ParameterBagUtils::getParameterBagValue($requestBag, $this->options['username_parameter']);
124-
$password = ParameterBagUtils::getParameterBagValue($requestBag, $this->options['password_parameter']);
122+
if ($this->options['post_only']) {
123+
$username = ParameterBagUtils::getParameterBagValue($request->request, $this->options['username_parameter']);
124+
$password = ParameterBagUtils::getParameterBagValue($request->request, $this->options['password_parameter']);
125+
} else {
126+
$username = ParameterBagUtils::getRequestParameterValue($request, $this->options['username_parameter']);
127+
$password = ParameterBagUtils::getRequestParameterValue($request, $this->options['password_parameter']);
128+
}
125129

126130
if (!\is_string($username) || (\is_object($username) && !\method_exists($username, '__toString'))) {
127131
throw new BadRequestHttpException(sprintf('The key "%s" must be a string, "%s" given.', $this->options['username_parameter'], \gettype($username)));

0 commit comments

Comments
 (0)