Thanks to visit codestin.com
Credit goes to github.com

Skip to content

RemoteUserAuthenticator triggers Symfony 8 deprecation notice #59584

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
phasdev opened this issue Jan 22, 2025 · 5 comments
Closed

RemoteUserAuthenticator triggers Symfony 8 deprecation notice #59584

phasdev opened this issue Jan 22, 2025 · 5 comments

Comments

@phasdev
Copy link
Contributor

phasdev commented Jan 22, 2025

Symfony version(s) affected

6.4

Description

Shibboleth may include an empty username in the REMOTE_USER $_SERVER parameter, which triggers the following deprecation notice:

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. (source)

How to reproduce

Configure a Symfony project using a remote_user authenticator. Configure the web server to set the REMOTE_USER $_SERVER parameter to an empty string. Try to authenticate. Log will show deprecation notice.

Possible Solution

Update the RemoteUserAuthenticator to return null when an empty string is detected in the REMOTE_USER $_SERVER parameter.

Additional Context

No response

@phasdev
Copy link
Contributor Author

phasdev commented Jan 22, 2025

I'm testing a PR for this and will link to issue when complete.

@xabbuh
Copy link
Member

xabbuh commented Jan 23, 2025

I fail to see how you can experience this with Symfony 5.4 (which does not receive bugfixes anymore by the way) while the deprecation was introduced in 7.2.

@phasdev
Copy link
Contributor Author

phasdev commented Jan 23, 2025

The release page shows 5.4 as accepting security fixes only. Since this is part of the Security component, I figured that's where the change should be made.

Although the deprecation was introduced in 7.2, it revealed a bug in the RemoteUserAuthenticator in that (presumably) the Authenticator should be skipped when an empty username is extracted from the $_SERVER parameter (IMO that seems to be the desired behaviour).

If I'm mistaken, please let me know which branch you'd prefer and I'll submit a new PR.

@phasdev
Copy link
Contributor Author

phasdev commented Jan 24, 2025

As per a PR comment, I've switched the PR base branch to 6.4.

@phasdev
Copy link
Contributor Author

phasdev commented Jan 30, 2025

Apologies; I ran into some trouble rebasing the commit for a test case from my previous PR so I created a new branch/PR to be safe.

nicolas-grekas added a commit that referenced this issue Feb 5, 2025
…precation notice (phasdev)

This PR was merged into the 6.4 branch.

Discussion
----------

[Security] Return null instead of empty username to fix deprecation notice

| Q             | A
| ------------- | ---
| Branch?       | 6.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Issues        | Fix #59584
| License       | MIT

`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.

Commits
-------

a8516b7 [Security] Return null instead of empty username to fix deprecation notice
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants