Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[Security] Fix logout#24805

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

Merged
nicolas-grekas merged 1 commit intosymfony:2.7fromMatTheCat:ticket_7104
May 15, 2018
Merged

[Security] Fix logout#24805

nicolas-grekas merged 1 commit intosymfony:2.7fromMatTheCat:ticket_7104
May 15, 2018

Conversation

@MatTheCat
Copy link
Contributor

@MatTheCatMatTheCat commentedNov 3, 2017
edited
Loading

QA
Branch?2.7
Bug fix?yes
New feature?no
BC breaks?no
Deprecations?no
Tests pass?no
Fixed tickets#6751,#7104
LicenseMIT

ebuildy, grifx, and MrMitch reacted with hooray emoji
@chalasr
Copy link
Member

chalasr commentedNov 3, 2017
edited
Loading

👎 because#7104 (comment), sorry


$listener->handle($event);

$hasResponse =$event->hasResponse();
Copy link
Member

Choose a reason for hiding this comment

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

this means that it won't stop at the first listener setting the response anymore, allowing others to set the response

Copy link
ContributorAuthor

@MatTheCatMatTheCatNov 3, 2017
edited
Loading

Choose a reason for hiding this comment

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

Nope onlyLogoutListener can override the response if it has been set (seehttps://github.com/symfony/symfony/pull/24805/files#diff-31ca8a8ce837591218082b00363149fcR65). Andhandle is called so#7104 (comment) doesn't apply.

chalasr reacted with thumbs up emoji
Copy link
Member

Choose a reason for hiding this comment

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

Can you add a test case for this? with multiple listeners if possible

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

I'll try but I don't know how to do it yet

@chalasrchalasr requested a review fromstofNovember 3, 2017 13:00
$listeners[] =newReference('security.access_listener');

// Logout listener
if (isset($logoutListener)) {

Choose a reason for hiding this comment

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

comment should be removed (low value)
the "isset" shold be replaced bynull !== $logoutListener (which implies setting the var to null when appropriate)

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Done

@MatTheCat
Copy link
ContributorAuthor

I guessTraceableFirewallListener will need to be updated when merging in 3.4/4.0

@MatTheCat
Copy link
ContributorAuthor

Is there something missing for this PR to be merged?

// Access listener
$listeners[] =newReference('security.access_listener');

if (null !==$logoutListenerId) {
Copy link
Member

Choose a reason for hiding this comment

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

Can't we just move the whole block that starts withif (isset($firewall['logout'])) { here?

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Nope because factories rely on the definition being in the container so we must create it before but still register last.

}

// Determine default entry point
$configuredEntryPoint =isset($firewall['entry_point']) ?$firewall['entry_point'] :null;
Copy link
Member

Choose a reason for hiding this comment

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

should probably be moved back as this is not needed

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Done


if ($event->hasResponse()) {
break;
}elseif ($hasResponse) {
Copy link
Member

Choose a reason for hiding this comment

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

justif as the previousif stops the execution path withbreak already.

$exceptionListener->register($this->dispatcher);
}

$hasResponse =false;
Copy link
Member

Choose a reason for hiding this comment

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

You don't need to create this variable. Just use$event->hasResponse() in the right place.

@stof
Copy link
Member

Note that this will defeat the lazy-loading added in 3.4, as the loop will always iterate until it reaches the logout listener, and it is at the end.

@MatTheCat
Copy link
ContributorAuthor

@chalasr@nicolas-grekas@stof@xabbuh I tried to exclude the logout listener from others to allow lazy-loading. I guess it introduced BC breaks so I would like you to review this.

@MatTheCat
Copy link
ContributorAuthor

MatTheCat commentedDec 3, 2017
edited
Loading

I don't understand why tests fail on PHP > 7.0, seems like a routing issue... Tests pass on my computer with PHP 7.1.12

@MatTheCat
Copy link
ContributorAuthor

Should I duplicate this PR to get more visibility? The logout listener never did work so I thought this would have got more attention.

ebuildy and grifx reacted with thumbs up emojisstok reacted with thumbs down emoji

@chalasr
Copy link
Member

@MatTheCat No need for reopening a new one.
Sorry for not giving you more feedback yet, but be sure that this has my attention.
That's an important bug which exists for a long time, if we can fix it, we need to do it right.
I think it's close to be ok, you tried a lot of approaches and that's great. What prevents me to approve is the fact we need to change some public api, hence I want to review it more throughly, check it out and see if we can do that more transparently.
Note that as of 3.3FirewallContext::getContext() is deprecated in favor of separatedgetListeners() andgetExceptionListener(), which means we would need to add a new public method when merging this up to 3.3, hence I'm not comfortable with this as is. Please be a bit more a patient, I will give more inputs as soon as I have time.
Thanks for your understanding.

@MatTheCat
Copy link
ContributorAuthor

I rebased one last time. People impacted by this issue will have to disablelogout in their configuration and call their handler in the controller of their logout route.


$this->assertNull($cookieJar->get('REMEMBERME'));
}
}

This comment was marked as resolved.

@chalasr
Copy link
Member

chalasr commentedDec 27, 2017
edited
Loading

Given that this implies public API changes in patch releases, I think that the previous version would be better (passing a fake token to logout handlers if no one exists in the token storage).
@stof@xabbuh what do you think?

@chalasr
Copy link
Member

Does that mean mean I have to increment symfony/security version?

yea, SecurityBundle'ssymfony/security requirement should be"~2.7.47|~2.8.40" (#24805 (review))

/**
* Returns the authentication listeners,andthe exception listenerto use
* for the given request.
* Returns the authentication listeners, the exception listenerand the logout
Copy link
Member

Choose a reason for hiding this comment

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

just chatted a bit with@nicolas-grekas, let's revert the interface changes now (changelog update not needed anymore), we need to change this on 4.1 with proper deprecation.

Choose a reason for hiding this comment

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

agreed: should be reverted and reintroduced in 4.1 with a deprecation notice

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

okay done

Copy link
Member

@chalasrchalasr left a comment

Choose a reason for hiding this comment

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

👍

@stof
Copy link
Member

After merging this (and once it is propagated until master), we should get another PR against master to deprecate the case of returning only 2 elements in the firewall map. This can be checked in the Firewall class.

@nicolas-grekas
Copy link
Member

Thank you@MatTheCat.

@nicolas-grekasnicolas-grekas merged commit9e88eb5 intosymfony:2.7May 15, 2018
nicolas-grekas added a commit that referenced this pull requestMay 15, 2018
This PR was squashed before being merged into the 2.7 branch (closes#24805).Discussion----------[Security] Fix logout| Q             | A| ------------- | ---| Branch?       | 2.7| Bug fix?      | yes| New feature?  | no| BC breaks?    | no| Deprecations? | no| Tests pass?   | no| Fixed tickets |#6751,#7104| License       | MITCommits-------9e88eb5 [Security] Fix logout
@chalasr
Copy link
Member

I'll take care of the master PR.

}

if (null !==$logoutListener) {
$logoutListener->handle($event);
Copy link
Contributor

Choose a reason for hiding this comment

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

😍

@MatTheCat
Copy link
ContributorAuthor

Yay thanks!

private$logoutListener;

publicfunction__construct(array$listeners,ExceptionListener$exceptionListener =null)
publicfunction__construct(array$listeners,ExceptionListener$exceptionListener =null,LogoutListener$logoutListener =null)

Choose a reason for hiding this comment

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

fun fact: on 3.4 & up, this classalready has a 3rd argument:FirewallConfig $config
To prevent any funnier things, I suggest adding this argument in 2.7 (but ignoring its value).
WDYT? Any better idea?

Copy link
ContributorAuthor

@MatTheCatMatTheCatMay 15, 2018
edited
Loading

Choose a reason for hiding this comment

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

Can we do this on concerned branches only?

Copy link
Member

Choose a reason for hiding this comment

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

we could change for a setter on 2.7, not sure it's better. Here is what you propose#27280

Choose a reason for hiding this comment

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

I finally managed to merge, see86a9c73#diff-cf0390616c24425d612bcf9ee1555111
@chalasr when doing your PR against master, please also deprecate passing a FirewallConfig as 3rd arg there.

@MatTheCatMatTheCat deleted the ticket_7104 branchMay 15, 2018 21:57
This was referencedMay 21, 2018
@fabpotfabpot mentioned this pull requestMay 21, 2018
nicolas-grekas added a commit that referenced this pull requestMay 25, 2018
… deprecations (chalasr)This PR was merged into the 4.2-dev branch.Discussion----------[Security][SecurityBundle] FirewallMap/FirewallContext deprecations| Q             | A| ------------- | ---| Branch?       | master| Bug fix?      | no| New feature?  | no| BC breaks?    | no| Deprecations? | yes/no <!-- don't forget to update UPGRADE-*.md and src/**/CHANGELOG.md files -->| Tests pass?   | yes    <!-- please add some, will be required by reviewers -->| Fixed tickets | #...   <!-- #-prefixed issue number(s), if any -->| License       | MIT| Doc PR        | symfony/symfony-docs#... <!-- required for new features -->Next to#24805.Commits-------a71ba78 [Security][SecurityBundle] FirewallMap/FirewallContext deprecations
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@nicolas-grekasnicolas-grekasnicolas-grekas left review comments

@xabbuhxabbuhxabbuh left review comments

@chalasrchalasrchalasr approved these changes

@stofstofstof approved these changes

+2 more reviewers

@MacDadaMacDadaMacDada left review comments

@linaorilinaorilinaori requested changes

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Projects

None yet

Milestone

2.7

Development

Successfully merging this pull request may close these issues.

9 participants

@MatTheCat@chalasr@stof@linaori@alexwilson@nicolas-grekas@MacDada@xabbuh@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp