Skip to content

[Security] Skip user checks if not implementing UserInterface #27044

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

Merged
merged 1 commit into from
Apr 25, 2018

Conversation

chalasr
Copy link
Member

@chalasr chalasr commented Apr 25, 2018

Q A
Branch? 2.7
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets #26871
License MIT
Doc PR n/a

@@ -44,6 +45,10 @@ public function authenticate(TokenInterface $token)
throw new AuthenticationException('Simple authenticator failed to return an authenticated token.');
}

if ($authToken instanceof AnonymousToken) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the right check would be !$user instanceof UserInterface, to cover all cases where calling the user checker is not possible.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@chalasr chalasr force-pushed the simple-auth-anonymous-bc branch from fa20fe1 to 384acf9 Compare April 25, 2018 11:44
@chalasr chalasr changed the title [Security] Skip user checks for anonymous tokens [Security] Skip user checks if not implementing UserInterface Apr 25, 2018
@fabpot
Copy link
Member

fabpot commented Apr 25, 2018

Thank you @chalasr.

@fabpot fabpot merged commit 384acf9 into symfony:2.7 Apr 25, 2018
fabpot added a commit that referenced this pull request Apr 25, 2018
…ace (chalasr)

This PR was merged into the 2.7 branch.

Discussion
----------

[Security] Skip user checks if not implementing UserInterface

| Q             | A
| ------------- | ---
| Branch?       | 2.7
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #26871
| License       | MIT
| Doc PR        | n/a

Commits
-------

384acf9 [Security] Skip user checks if not implementing UserInterface
@chalasr chalasr deleted the simple-auth-anonymous-bc branch April 25, 2018 13:01
@leofeyer
Copy link
Contributor

leofeyer commented Apr 26, 2018

It seems that the changes have not been merged correctly into the 2.8 branch (and higher).

2.7
https://github.com/symfony/symfony/blob/2.7/src/Symfony/Component/Security/Core/Authentication/Provider/SimpleAuthenticationProvider.php#L50-L52

2.8, 3.4, 4.0
https://github.com/symfony/symfony/blob/2.8/src/Symfony/Component/Security/Core/Authentication/Provider/SimpleAuthenticationProvider.php#L52-L67

I can confirm that the error no longer occurs in version 2.7, however, it still does occur in the versions 2.8, 3.4 and 4.0.

@nicolas-grekas
Copy link
Member

But tests pass, so there is a missing test case.
@leofeyer would you like to submit a fix?

@chalasr
Copy link
Member Author

chalasr commented Apr 26, 2018

I can see what happened, I'm on it

@leofeyer
Copy link
Contributor

Here you go: #27059

nicolas-grekas added a commit that referenced this pull request Apr 26, 2018
… (leofeyer)

This PR was merged into the 2.8 branch.

Discussion
----------

Make the simple auth provider the same as in Symfony 2.7

| Q             | A
| ------------- | ---
| Branch?       | 2.8
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #27044
| License       | MIT

This PR adds the `SimpleAuthenticationProvider` changes made in Symfony 2.7 to Symfony 2.8. See #27044 (comment)

Commits
-------

9afad9d Make the simple auth provider the same as in Symfony 2.7.
@fabpot fabpot mentioned this pull request Apr 27, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants