-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Security] Prevent creating session in stateless firewalls #51320
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
Conversation
Hey! Thanks for your PR. You are targeting branch "6.4" but it seems your PR description refers to branch "6.3". Cheers! Carsonbot |
@@ -91,7 +91,9 @@ public function onAuthenticationFailure(Request $request, AuthenticationExceptio | |||
|
|||
$this->logger?->debug('Authentication failure, redirect triggered.', ['failure_path' => $options['failure_path']]); | |||
|
|||
$request->getSession()->set(SecurityRequestAttributes::AUTHENTICATION_ERROR, $exception); | |||
if ($request->hasPreviousSession()) { |
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.
Better if we could check if !$options['stateless']
here, but that option is not passed
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.
We cannot check on $request->hasPreviousSession()
this is the reason why the test is failing...
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.
hasPreviousSession is absolutely not the same than stateless.
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.
So we need a way to access the stateless
option from the firewall.
If someone has an idea how to do this, please help on that. I will close that PR for now.
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.
@Seb33300 You can check if the _stateless
attribute is set to true
instead
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.
Good point! I modified my PR and reopened it.
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.
Oups cannot reopen because I force pushed...
Here is the new PR: #51350
… (Seb33300) This PR was squashed before being merged into the 6.3 branch. Discussion ---------- [Security] Prevent creating session in stateless firewalls | Q | A | ------------- | --- | Branch? | 6.3 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | Fix #51319 | License | MIT | Doc PR | <!-- Replace this notice by a short README for your feature/bugfix. This will help reviewers and should be a good start for the documentation. Additionally (see https://symfony.com/releases): - Always add tests and ensure they pass. - Bug fixes must be submitted against the lowest maintained branch where they apply (lowest branches are regularly merged to upper ones so they get the fixes too). - Features and deprecations must be submitted against the latest branch. - For new features, provide some code snippets to help understand usage. - Changelog entry should follow https://symfony.com/doc/current/contributing/code/conventions.html#writing-a-changelog-entry - Never break backward compatibility (see https://symfony.com/bc). --> Please check related issue for details. Same as #51320 with `@chalasr` suggestion: #51320 (comment) Commits ------- 4efd50e [Security] Prevent creating session in stateless firewalls
… (Seb33300) This PR was squashed before being merged into the 6.3 branch. Discussion ---------- [Security] Prevent creating session in stateless firewalls | Q | A | ------------- | --- | Branch? | 6.3 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | Fix symfony/symfony#51319 | License | MIT | Doc PR | <!-- Replace this notice by a short README for your feature/bugfix. This will help reviewers and should be a good start for the documentation. Additionally (see https://symfony.com/releases): - Always add tests and ensure they pass. - Bug fixes must be submitted against the lowest maintained branch where they apply (lowest branches are regularly merged to upper ones so they get the fixes too). - Features and deprecations must be submitted against the latest branch. - For new features, provide some code snippets to help understand usage. - Changelog entry should follow https://symfony.com/doc/current/contributing/code/conventions.html#writing-a-changelog-entry - Never break backward compatibility (see https://symfony.com/bc). --> Please check related issue for details. Same as symfony/symfony#51320 with `@chalasr` suggestion: symfony/symfony#51320 (comment) Commits ------- 4efd50e34c [Security] Prevent creating session in stateless firewalls
Please check related issue for details.