Skip to content

[Security] Fixed being logged out on failed attempt in guard #26014

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 22, 2018
Merged

[Security] Fixed being logged out on failed attempt in guard #26014

merged 1 commit into from
Apr 22, 2018

Conversation

linaori
Copy link
Contributor

@linaori linaori commented Feb 2, 2018

Q A
Branch? 2.8
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets #25992
License MIT
Doc PR ~

This fixes the issue described in the ticket. After this fix, guard will no longer "forget" your authentication when your next attempt fails.

@chalasr chalasr added this to the 2.8 milestone Feb 2, 2018
@nicolas-grekas
Copy link
Member

ping @weaverryan

@weaverryan
Copy link
Member

I agree with @xabbuh #25992 (comment) that the current behavior is not the correct behavior. I even checked Amazon further: I can (A) login, (B) go back to the login page and enter an incorrect password and (C) go back to my account area and even update my password. So, let's fix this :).

So now the question: is this change a BC break? Because this deals with security... and specifically it's something that relaxes security, I think it is a BC break. That sucks, but... I think it's correct.

The fix, then, means adding a BC layer. I can only think of one way: adding a new option to opt into this behavior. I was thinking an option under security, but a container parameter - e.g. security.logout_on_auth_failure: false, would be a bit easier for the deprecation layer.

If not set (or set to anything except false), we would keep the current behavior but trigger a deprecation warning. If the parameter is set to false, we could call a new internal setLogoutOnAuthFailure() method on GuardAuthenticationHandler, and change the behavior based on this. I think we should fix it as a "feature" on 4.1, versus trying to backport it to 2.8.

This change would also need to be made to:

  • AbstractAuthenticationListener
  • AbstractPreAuthenticatedListener
  • BasicAuthenticationListener
  • SimplePreAuthenticationListener
  • UsernamePasswordJsonAuthenticationListener

Really, the change is not that huge, so I think we should do it. @iltar are you up for it? I'm in support of this.

@linaori
Copy link
Contributor Author

linaori commented Feb 11, 2018

As it's currently an issue, I'm not sure if I can wait till the release of 4.1, but I can always fix it for 4.1 and "backport" it via file autoloading in composer for my local project.

@weaverryan
Copy link
Member

In theory, you could fix on 2.7 if you’d like :). It shouldn’t make a huge difference, except that I’m not sure how our deprecation policy works. As I understand it, you would not include the deprecation warnings for the parameter NOT being set in 2.7. Those would be added in 4.1 (but I’m not 100% sure here - I don’t know if a time it’s come up)

@fabpot
Copy link
Member

fabpot commented Feb 19, 2018

My opinion on the matter:

  • if guard is the only part of the security component behaving like this, it would qualify as a bug IMHO

  • I would not deprecate the behavior as there is no security issue impact with the change. I would just consider this as either a bug fix or a behavior change (I also don't think this should be configurable).

  • if we fix it as a bug fix, it should be on 2.7, not 2.8

@linaori
Copy link
Contributor Author

linaori commented Feb 19, 2018

If we fix it as a bug in guard (because the Simple* variant didn't show this behavior for me), it should be on 2.8 as this is where guard was introduced.

@nicolas-grekas nicolas-grekas changed the title Fixed being logged out on failed attempt in guard [Security] Fixed being logged out on failed attempt in guard Mar 19, 2018
@nicolas-grekas
Copy link
Member

so, is this ready?

@linaori
Copy link
Contributor Author

linaori commented Apr 16, 2018

In theory this can be merged, there just needs to be a consensus on whether it should be merged 😅

Copy link
Member

@wouterj wouterj left a comment

Choose a reason for hiding this comment

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

Reading the issue and the all comments, I think this makes perfectly sense.

It doesn't reduce any security (you still can't access resources you aren't allowed to access), so I would just merge it as a bug fix.

Copy link
Member

@weaverryan weaverryan left a comment

Choose a reason for hiding this comment

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

+1 Let's merge it as a bug fix then

@fabpot
Copy link
Member

fabpot commented Apr 22, 2018

Thank you @iltar.

@fabpot fabpot merged commit 4fc0ecb into symfony:2.8 Apr 22, 2018
fabpot added a commit that referenced this pull request Apr 22, 2018
…rd (iltar)

This PR was merged into the 2.8 branch.

Discussion
----------

[Security] Fixed being logged out on failed attempt in guard

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

This fixes the issue described in the ticket. After this fix, guard will no longer "forget" your authentication when your next attempt fails.

Commits
-------

4fc0ecb Fixed being logged out on failed attempt in guard
This was referenced Apr 30, 2018
@linaori linaori deleted the fix/deauthentication-on-failed-attempt branch February 8, 2019 13:38
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