Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

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

Sign up
Appearance settings

[SecurityBundle][Profiler] Give info about called security listeners in profiler#23105

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
fabpot merged 1 commit intosymfony:3.4fromchalasr:secu-record-listeners
Jun 13, 2017

Conversation

@chalasr
Copy link
Member

QA
Branch?3.4
Bug fix?no
New feature?yes
BC breaks?no
Deprecations?no
Tests pass?yes
Fixed tickets#11134
LicenseMIT
Doc PRn/a

Currently the profiler gives no info about security listeners (see fixed ticket), this displays each called listener with the time spent at calling it and its response if any.

preview

ro0NL, ogizanagi, yceruto, and linaori reacted with thumbs up emoji
}

/**
* @internal

Choose a reason for hiding this comment

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

I think it's OK to not atg this as internal (same below)

@chalasrchalasrforce-pushed thesecu-record-listeners branch 2 times, most recently from493097e to813ce0aCompareJune 8, 2017 13:23
* @paramTraceableFirewallListener|null$firewall
*/
publicfunction__construct(TokenStorageInterface$tokenStorage =null,RoleHierarchyInterface$roleHierarchy =null,LogoutUrlGenerator$logoutUrlGenerator =null,AccessDecisionManagerInterface$accessDecisionManager =null,FirewallMapInterface$firewallMap =null)
publicfunction__construct(TokenStorageInterface$tokenStorage =null,RoleHierarchyInterface$roleHierarchy =null,LogoutUrlGenerator$logoutUrlGenerator =null,AccessDecisionManagerInterface$accessDecisionManager =null,TraceableFirewallListener$firewall =null)
Copy link
Contributor

Choose a reason for hiding this comment

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

This is a BC break, right? What about removing the typehint for now with proper deprecation and BC support, and re-add it on 4.0?

Copy link
MemberAuthor

@chalasrchalasrJun 8, 2017
edited
Loading

Choose a reason for hiding this comment

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

Seems like. We could also inject bothFirewallMap andTraceableFirewallListener distinctively, removing the getter added here. WDYT?

Copy link
Contributor

Choose a reason for hiding this comment

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

Looks good to me to inject both and remove the getter, yes.


publicfunctiongetInfo()
{
$pretty =get_class($this->listener);
Copy link
Contributor

Choose a reason for hiding this comment

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

- $pretty+ $class

? (I spotted this comes fromSymfony\Component\EventDispatcher\Debug\WrappedListener, but there isn't the same treatment here. Let's be more explicit). Do you even need it ?

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

I started suffixing by::handle() for finally removing it, ok for$class

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

I don't need it :) good catch

@chalasrchalasrforce-pushed thesecu-record-listeners branch 3 times, most recently from48f5e96 to1f36aa8CompareJune 8, 2017 21:37
@chalasr
Copy link
MemberAuthor

Comments addressed. Build failure on deps=high is normal because the security component is updated here.

<argumenttype="service"id="security.logout_url_generator" />
<argumenttype="service"id="security.access.decision_manager" />
<argumenttype="service"id="security.firewall.map" />
<argumenttype="service"id="security.firewall" />
Copy link
Contributor

Choose a reason for hiding this comment

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

If you don't inject explicitlydebug.security.firewall here, you can't typehintTraceableFirewallListener, but should add aninstanceof check in the collector, otherwise it'll break in non debug mode when theTraceableFirewallListener does not decoratessecurity.firewall (I still don't get why we would have collectors in non-debug mode though...).

IMHO, it's better to keep your collector as you did, but injectdebug.security.firewall withon-invalid="null" here.

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

updated to injectdebug.security.firewall or null as suggested

@nicolas-grekasnicolas-grekas added this to the3.4 milestoneJun 9, 2017
@chalasrchalasrforce-pushed thesecu-record-listeners branch 3 times, most recently fromb549295 to6065367CompareJune 9, 2017 13:08
@chalasr
Copy link
MemberAuthor

This is ready.

@chalasrchalasrforce-pushed thesecu-record-listeners branch 2 times, most recently fromf4be835 toaef1b6fCompareJune 11, 2017 12:32
*
* @author Robin Chalas <robin.chalas@gmail.com>
*
* @final since version 3.4
Copy link
Member

Choose a reason for hiding this comment

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

Why are you using the tag here instead of marking the class as being final directly?

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

To ease maintenance while keeping extensibility: one could add more info per listener and if a day we don't need this method for dumping the object, the breaking change would be free

Copy link
Member

Choose a reason for hiding this comment

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

I don't get it. This class could even be marked as being internal. I would definitely mark it as final.

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

done

*
* @author Robin Chalas <robin.chalas@gmail.com>
*
* @final since version 3.4
Copy link
Member

Choose a reason for hiding this comment

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

same here

*/
class WrappedListenerimplements ListenerInterface
{
public$response;
Copy link
Member

Choose a reason for hiding this comment

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

Why is it public?

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

It is not anymore

@chalasrchalasrforce-pushed thesecu-record-listeners branch fromaef1b6f toa7514fcCompareJune 12, 2017 08:10
<argumenttype="service"id="debug.security.access.decision_manager.inner" />
</service>

<serviceid="debug.security.firewall"class="Symfony\Bundle\SecurityBundle\Debug\TraceableFirewallListener"decorates="security.firewall"public="true">
Copy link
Member

Choose a reason for hiding this comment

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

this service should not be public. There is no reason to do a `$container->get('debug.security.firewall')

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

done but that means the bundle needs a conflict for the dispatcher as event subscribers must be public before 3.3

<argumenttype="service"id="debug.security.access.decision_manager.inner" />
</service>

<serviceid="debug.security.firewall"class="Symfony\Bundle\SecurityBundle\Debug\TraceableFirewallListener"decorates="security.firewall"public="true">
Copy link
Member

Choose a reason for hiding this comment

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

Using a decorator is weird here, as it does not perform decoration actually (it never uses the inner service).

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

fixed

@chalasrchalasrforce-pushed thesecu-record-listeners branch 3 times, most recently fromc72a273 to3ff46f1CompareJune 13, 2017 00:18
@chalasrchalasrforce-pushed thesecu-record-listeners branch from3ff46f1 toe767231CompareJune 13, 2017 00:24
@chalasrchalasrforce-pushed thesecu-record-listeners branch frome767231 to369f19fCompareJune 13, 2017 08:31
@chalasr
Copy link
MemberAuthor

rebased

@fabpot
Copy link
Member

Thank you@chalasr.

@fabpotfabpot merged commit369f19f intosymfony:3.4Jun 13, 2017
fabpot added a commit that referenced this pull requestJun 13, 2017
…rity listeners in profiler (chalasr)This PR was merged into the 3.4 branch.Discussion----------[SecurityBundle][Profiler] Give info about called security listeners in profiler| Q             | A| ------------- | ---| Branch?       | 3.4| Bug fix?      | no| New feature?  | yes| BC breaks?    | no| Deprecations? | no| Tests pass?   | yes| Fixed tickets |#11134| License       | MIT| Doc PR        | n/aCurrently the profiler gives no info about security listeners (see fixed ticket), this displays each called listener with the time spent at calling it and its response if any.![preview](https://image.prntscr.com/image/Wx-n-Ni_RQK5JGTdTZsdGw.png)Commits-------369f19f Give info about called security listeners in profiler
@chalasrchalasr deleted the secu-record-listeners branchJune 13, 2017 16:29
This was referencedOct 18, 2017
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@nicolas-grekasnicolas-grekasnicolas-grekas left review comments

@stofstofstof requested changes

@fabpotfabpotfabpot approved these changes

+1 more reviewer

@ogizanagiogizanagiogizanagi left review comments

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Projects

None yet

Milestone

3.4

Development

Successfully merging this pull request may close these issues.

6 participants

@chalasr@fabpot@nicolas-grekas@stof@ogizanagi@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp