Skip to content

Navigation Menu

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

Appearance settings

[HttpKernel] Preserve security exceptions #27515

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

Closed
wants to merge 1 commit into from
Closed

[HttpKernel] Preserve security exceptions #27515

wants to merge 1 commit into from

Conversation

ro0NL
Copy link
Contributor

@ro0NL ro0NL commented Jun 6, 2018

Q A
Branch? 4.1
Bug fix? yes
New feature? yes-ish
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets #27440
License MIT
Doc PR symfony/symfony-docs#...

This PR introduces an approach that allows for skipping certain (origin) exception classes from being logged. In this case the security related ones.

@stof
Copy link
Member

stof commented Jun 6, 2018

should we actually ignore these ?

These exceptions are handled by the exception listener registered by the firewall, so they should not reach the logging listener later. This looks like a priority issue instead.

@@ -121,6 +125,21 @@ public function load(array $configs, ContainerBuilder $container)
->addTag('security.voter');
}

public function process(ContainerBuilder $container)
Copy link
Member

Choose a reason for hiding this comment

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

I would rather put this compiler pass in a dedicated class.

We have lots of different passes in each of our bundles, and this logic is not more related to the DI extension than other passes (rather less)

$request = $event->getRequest();
do {
foreach ($this->silentIgnore as $class) {
if (is_a($exception, $class)) {
Copy link
Member

Choose a reason for hiding this comment

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

use $exception instanceof $class

return;
}
}
} while (null !== $exception = $exception->getPrevious());
Copy link
Member

Choose a reason for hiding this comment

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

use a different variable name for this loop, to avoid overriding the one containing the main exception

@nicolas-grekas
Copy link
Member

Just wondering: did #27516 change anything here?

@ro0NL
Copy link
Contributor Author

ro0NL commented Jun 6, 2018

@nicolas-grekas yes :)

@stof i'm hesitating between this approach and raising the security exception listener from 0 to 2048+1,

edit: then again.. exceptions are edge-case-ish anyway.. so perhaps we can get away with it, along with a clear changelog entry. I do prefer the priority solution.. sure

@nicolas-grekas nicolas-grekas added this to the 4.1 milestone Jun 7, 2018
@nicolas-grekas
Copy link
Member

Shouldn't we revert #25366 instead? This breaks a behavior that was accepted. Maybe only keep the early collection, but when a listener takes over handling, I see no reason to not let it decide what to do with the exception, don't you think? Especially given the comments on #27440.
I understand the original motivation, but I feel like we should look for something else.
WDYT?

@ro0NL
Copy link
Contributor Author

ro0NL commented Jun 8, 2018

status: needs work

@ro0NL
Copy link
Contributor Author

ro0NL commented Jun 9, 2018

closing in favor of #27562

@ro0NL ro0NL closed this Jun 9, 2018
@ro0NL ro0NL deleted the http-kernel/exceptionn-logging branch June 9, 2018 07:52
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
Morty Proxy This is a proxified and sanitized view of the page, visit original site.