Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.6k
[Security] Return null instead of empty username to fix deprecation notice#59586
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
Therelease page shows |
alexandre-daubois commentedJan 24, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
This should be a bug fix, not a security fix. Security fixes corresponds to modifications that address CVEs or vulnerability that endangers apps security, likethese reports. |
phasdev commentedJan 24, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
@alexandre-daubois Thanks for the clarification; I've changed the base branch to 6.4. |
Can you please add a test case to cover this? |
@@ -45,6 +45,6 @@ protected function extractUsername(Request $request): ?string | |||
throw new BadCredentialsException(sprintf('User key was not found: "%s".', $this->userKey)); | |||
} | |||
return $request->server->get($this->userKey); | |||
return $request->server->get($this->userKey) ?: null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Looking at how the method is used I wonder if we shouldn’t throw aBadCredentialsException
here then.
Apologies; I ran into some trouble rebasing the commit for a test case so I created a new branch/PR to be safe:#59640 |
Uh oh!
There was an error while loading.Please reload this page.
RemoteUserAuthenticator
may return an empty string when extracting a username from the configured$_SERVER
parameter (e.g.REMOTE_USER
).An empty username triggers the
User Deprecated: Since symfony/security-http 7.2: Using an empty string as user identifier is deprecated and will throw an exception in Symfony 8.0.
Return
null
instead of empty username to skip authenticator when username is empty and fix Symfony 8 deprecation notice.