Skip to content

[Security] Deprecate callable firewall listeners #60614

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

Open
wants to merge 1 commit into
base: 7.4
Choose a base branch
from

Conversation

MatTheCat
Copy link
Contributor

@MatTheCat MatTheCat commented Jun 1, 2025

Q A
Branch? 7.4
Bug fix? no
New feature? no
Deprecations? yes
Issues N/A
License MIT

After spending some time in the Security component it occurred to me callable firewall listeners are obsolete now that we got the FirewallListenerInterface. Their deprecation has already been suggested (like in #34627 (comment) or #38751 (review)), so this PR does it.

Copy link
Contributor

@Spomky Spomky left a comment

Choose a reason for hiding this comment

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

Looks good. Just one remark about the changlog.

@MatTheCat MatTheCat force-pushed the deprecate-callable-firewall-listener branch 2 times, most recently from f2b8c5e to 311c89f Compare June 5, 2025 08:40
@MatTheCat MatTheCat force-pushed the deprecate-callable-firewall-listener branch from 311c89f to 253ed34 Compare June 11, 2025 08:34
if (!$listener instanceof FirewallListenerInterface) {
trigger_deprecation('symfony/security-http', '7.4', 'Using a callable as firewall listener is deprecated, extend "%s" or implement "%s" instead.', AbstractListener::class, FirewallListenerInterface::class);
}

$listener($event);
Copy link
Member

Choose a reason for hiding this comment

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

is this still fine given __invoke() is not specified by FirewallListenerInterface? Has it ever been or should it be authenticate()? Just wondering as I feel like something's been lost in my memory

Copy link
Contributor Author

@MatTheCat MatTheCat Jun 12, 2025

Choose a reason for hiding this comment

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

For now every implementation of FirewallListenerInterface is supposed to extend the AbstractListener which makes it callable.

@MatTheCat MatTheCat force-pushed the deprecate-callable-firewall-listener branch 3 times, most recently from 225e787 to fd98438 Compare June 12, 2025 21:11
@MatTheCat
Copy link
Contributor Author

Just noticed that the LazyFirewallContext can also run the firewall listeners so I added the deprecation in there. I also moved the changelog entry to the security-http’s instead of the security-bundle’s.

@MatTheCat MatTheCat force-pushed the deprecate-callable-firewall-listener branch from fd98438 to 2b96194 Compare June 12, 2025 21:24
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.

4 participants