Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[SecurityBundle] Make firewalls event dispatcher traceable on debug mode #49021

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
Jan 26, 2023

Conversation

MatTheCat
Copy link
Contributor

@MatTheCat MatTheCat commented Jan 18, 2023

Q A
Branch? 6.3
Bug fix? no
New feature? yes
Deprecations? no
Tickets Fix #42973
License MIT
Doc PR N/A

This PR decorates firewalls event dispatcher with TraceableEventDispatcher on debug mode. This will display security events and listeners in the profiler’s time panel.

Before
After

They still won’t appear in the events panel (because the EventDataCollector is only injected debug.event_dispatcher) but I think it will be best handled in a separate PR.

@chalasr
Copy link
Member

chalasr commented Jan 19, 2023

Could you illustrate what this brings to userland with e.g. a screenshot?

@MatTheCat
Copy link
Contributor Author

@chalasr done!

chalasr
chalasr previously approved these changes Jan 26, 2023
@chalasr
Copy link
Member

chalasr commented Jan 26, 2023

Can you add some test? Also can you double check that there is no existing compiler pass that could be patched instead of adding a new one?

@MatTheCat
Copy link
Contributor Author

Can you add some test

Done

can you double check that there is no existing compiler pass that could be patched instead of adding a new one

Did not find anything related, which kind of surprised me because what I’m doing here feels like it could be generic 🤔

@MatTheCat
Copy link
Contributor Author

Damn I broke low-deps tests. Investigating.

Copy link
Member

@nicolas-grekas nicolas-grekas left a comment

Choose a reason for hiding this comment

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

LGTM once tests are green :)

@MatTheCat
Copy link
Contributor Author

MatTheCat commented Jan 26, 2023

Looks like #49021 (comment) was the cause of the failing test, which is weird? How could it register debug.stopwatch if Stopwatch does not exist 🤔

@nicolas-grekas
Copy link
Member

Thank you @MatTheCat.

@nicolas-grekas nicolas-grekas merged commit 42c1e90 into symfony:6.3 Jan 26, 2023
@MatTheCat MatTheCat deleted the ticket_42973 branch January 27, 2023 09:22
nicolas-grekas added a commit that referenced this pull request Apr 19, 2023
…(MatTheCat)

This PR was merged into the 6.3 branch.

Discussion
----------

[HttpKernel] Collect data from every event dispatcher

| Q             | A
| ------------- | ---
| Branch?       | 6.3
| Bug fix?      | no
| New feature?  | yes
| Deprecations? | no
| Tickets       | N/A
| License       | MIT
| Doc PR        | N/A

Follow-up of #49021: instead of only passing the main event dispatcher to the `EventDataCollector`, we pass them all (thanks to the `event_dispatcher.dispatcher` tag).

![](https://user-images.githubusercontent.com/1898254/215503546-9a223574-1d70-445a-931e-2fa80f0a588a.png)
(The heading is now “Dispatched Events”.)

Check “Hide whitespace” when reviewing.

Commits
-------

7a77b3a [HttpKernel] Collect data from every event dispatcher
@fabpot fabpot mentioned this pull request May 1, 2023
fabpot added a commit that referenced this pull request Mar 17, 2024
…firewall event dispatcher (danielburger1337)

This PR was squashed before being merged into the 7.1 branch.

Discussion
----------

[SecurityBundle] Use "event" monolog channel in traceable firewall event dispatcher

| Q             | A
| ------------- | ---
| Branch?       | 7.1
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Issues        | n/a
| License       | MIT

I think since #49021 was merged, security events in debug mode are logged inside the "app" (default) channel.

This is very annoying in an API use case as every request generates about 10 _useless_ log entries.

This PR changes the monolog channel of the traceable event dispatcher to `event` and also tags it with `kernel.reset`. This matches the behavior of `debug.event_dispatcher`.

Commits
-------

3995c71 [SecurityBundle] Use "event" monolog channel in traceable firewall event dispatcher
symfony-splitter pushed a commit to symfony/security-bundle that referenced this pull request Mar 17, 2024
…firewall event dispatcher (danielburger1337)

This PR was squashed before being merged into the 7.1 branch.

Discussion
----------

[SecurityBundle] Use "event" monolog channel in traceable firewall event dispatcher

| Q             | A
| ------------- | ---
| Branch?       | 7.1
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Issues        | n/a
| License       | MIT

I think since symfony/symfony#49021 was merged, security events in debug mode are logged inside the "app" (default) channel.

This is very annoying in an API use case as every request generates about 10 _useless_ log entries.

This PR changes the monolog channel of the traceable event dispatcher to `event` and also tags it with `kernel.reset`. This matches the behavior of `debug.event_dispatcher`.

Commits
-------

3995c71b61 [SecurityBundle] Use "event" monolog channel in traceable firewall event dispatcher
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.

[Firewall dispatcher] Traceable Event Dispatcher
4 participants