Skip to content

Commit adcd3d0

Browse files
committed
bug #51858 [Security] Fix resetting traceable listeners (chalasr)
This PR was merged into the 5.4 branch. Discussion ---------- [Security] Fix resetting traceable listeners | Q | A | ------------- | --- | Branch? | 5.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | Fix #49532 | License | MIT Commits ------- 98c41e0 [Security] Fix resetting traceable listeners
2 parents 8dc9fee + 98c41e0 commit adcd3d0

File tree

6 files changed

+22
-5
lines changed

6 files changed

+22
-5
lines changed

src/Symfony/Bundle/SecurityBundle/Debug/TraceableFirewallListener.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,14 @@
1717
use Symfony\Component\HttpKernel\Event\RequestEvent;
1818
use Symfony\Component\Security\Http\Authenticator\Debug\TraceableAuthenticatorManagerListener;
1919
use Symfony\Component\Security\Http\Firewall\FirewallListenerInterface;
20+
use Symfony\Contracts\Service\ResetInterface;
2021

2122
/**
2223
* Firewall collecting called security listeners and authenticators.
2324
*
2425
* @author Robin Chalas <robin.chalas@gmail.com>
2526
*/
26-
final class TraceableFirewallListener extends FirewallListener
27+
final class TraceableFirewallListener extends FirewallListener implements ResetInterface
2728
{
2829
private $wrappedListeners = [];
2930
private $authenticatorsInfo = [];
@@ -38,6 +39,12 @@ public function getAuthenticatorsInfo(): array
3839
return $this->authenticatorsInfo;
3940
}
4041

42+
public function reset(): void
43+
{
44+
$this->wrappedListeners = [];
45+
$this->authenticatorsInfo = [];
46+
}
47+
4148
protected function callListeners(RequestEvent $event, iterable $listeners)
4249
{
4350
$wrappedListeners = [];

src/Symfony/Bundle/SecurityBundle/DependencyInjection/SecurityExtension.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -544,6 +544,7 @@ private function createFirewall(ContainerBuilder $container, string $id, array $
544544
->register('debug.security.firewall.authenticator.'.$id, TraceableAuthenticatorManagerListener::class)
545545
->setDecoratedService('security.firewall.authenticator.'.$id)
546546
->setArguments([new Reference('debug.security.firewall.authenticator.'.$id.'.inner')])
547+
->addTag('kernel.reset', ['method' => 'reset'])
547548
;
548549
}
549550

src/Symfony/Bundle/SecurityBundle/Resources/config/security_debug.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
service('security.logout_url_generator'),
3737
])
3838
->tag('kernel.event_subscriber')
39+
->tag('kernel.reset', ['method' => 'reset'])
3940
->alias('security.firewall', 'debug.security.firewall')
4041
;
4142
};

src/Symfony/Bundle/SecurityBundle/composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@
2929
"symfony/security-core": "^5.4|^6.0",
3030
"symfony/security-csrf": "^4.4|^5.0|^6.0",
3131
"symfony/security-guard": "^5.3",
32-
"symfony/security-http": "^5.4.20|~6.0.20|~6.1.12|^6.2.6"
32+
"symfony/security-http": "^5.4.30|^6.3.6",
33+
"symfony/service-contracts": "^1.10|^2|^3"
3334
},
3435
"require-dev": {
3536
"doctrine/annotations": "^1.10.4|^2",

src/Symfony/Component/Security/Http/Authenticator/Debug/TraceableAuthenticatorManagerListener.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,14 @@
1616
use Symfony\Component\Security\Http\Firewall\AbstractListener;
1717
use Symfony\Component\Security\Http\Firewall\AuthenticatorManagerListener;
1818
use Symfony\Component\VarDumper\Caster\ClassStub;
19+
use Symfony\Contracts\Service\ResetInterface;
1920

2021
/**
2122
* Decorates the AuthenticatorManagerListener to collect information about security authenticators.
2223
*
2324
* @author Robin Chalas <robin.chalas@gmail.com>
2425
*/
25-
final class TraceableAuthenticatorManagerListener extends AbstractListener
26+
final class TraceableAuthenticatorManagerListener extends AbstractListener implements ResetInterface
2627
{
2728
private $authenticationManagerListener;
2829
private $authenticatorsInfo = [];
@@ -78,4 +79,9 @@ public function getAuthenticatorsInfo(): array
7879
{
7980
return $this->authenticatorsInfo;
8081
}
82+
83+
public function reset(): void
84+
{
85+
$this->authenticatorsInfo = [];
86+
}
8187
}

src/Symfony/Component/Security/Http/composer.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,13 @@
1818
"require": {
1919
"php": ">=7.2.5",
2020
"symfony/deprecation-contracts": "^2.1|^3",
21-
"symfony/security-core": "^5.4.19|~6.0.19|~6.1.11|^6.2.5",
2221
"symfony/http-foundation": "^5.3|^6.0",
2322
"symfony/http-kernel": "^5.3|^6.0",
2423
"symfony/polyfill-mbstring": "~1.0",
2524
"symfony/polyfill-php80": "^1.16",
26-
"symfony/property-access": "^4.4|^5.0|^6.0"
25+
"symfony/property-access": "^4.4|^5.0|^6.0",
26+
"symfony/security-core": "^5.4.19|~6.0.19|~6.1.11|^6.2.5",
27+
"symfony/service-contracts": "^1.10|^2|^3"
2728
},
2829
"require-dev": {
2930
"symfony/cache": "^4.4|^5.0|^6.0",

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy