-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
Show more information in the security profiler #17887
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
Conversation
Really awesome ! Many thanks for that feature ! |
|
||
/** | ||
* AccessDecisionManager is the base class for all access decision managers | ||
* that use decision voters. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This docblock looks wrong.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed. Thanks.
@javiereguiluz Can you rebase as tests have been fixed since your submitted the PR. |
87f474b
to
378db40
Compare
* | ||
* @author Javier Eguiluz <[email protected]> | ||
*/ | ||
class DebugAccessDecisionManager implements AccessDecisionManagerInterface //extends AccessDecisionManager |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment should probably be removed here, right?
Apart from my minor comments, 👍 |
I've made all the requested changes (thanks for the review!) ... but before merging this, it should be tested by someone which works on Symfony apps with complex security needs (maybe @iltar could help us?) |
@javiereguiluz sadly still running on 2.8 in the application I can test it on properly. The 3.0 upgrade will be done somewhere starting in 2 weeks as we are still gathering deprecations in our production env. Maybe I'll be able to upgrade just the security bundle as most (if not all) of those are already fixed. |
@javiereguiluz I've downloaded your branch as zip, extracted it and symlinked vendor/symfony/symfony to your branch. However, I cannot get it to work. The error I'm getting is issue 1Most important part of the stacktrace:
I've checked the service and it has the $container->getDefinition('security.access.decision_manager')->addMethodCall('setVoters', array(array_values($voters))); There's 2 possible solutions:
issue 2After patching either one of the above issues, I have a serialization issue "You cannot serialize or unserialize PDO instances". The @template is being cached now and causes the bug I fixed in this pending PR: sensiolabs/SensioFrameworkExtraBundle#404. However, fixing this issue didn't solve my serialization issue. After digging a bit deeper it made sense... The request also contains your session. This means that if you use a database session storage like I do, it will try to serialize this. This will also fail if you use the I've changed After fixingThe following screens are on my login page. The first thing I notice is that the Token column might be redundant. When I'm logged in, it shows more information on my dashboard. The things I notice:
When viewing a page which as a lot of Looking at a page with less different objects, it becomes a bit of a mess as well. ConclusionIt's a nice start but with lots of information it becomes a mess really quick. A possible solution would be to group the checks per object (via object hash?) and to add the ID of an object if managed by doctrine (plug & play system so people can hook in?). Additionally the last column could be removed and the attributes shown with the just attribute as comma imploded string. |
@iltar thank you very much for your incredible review!! I've made some changes as requested:
I still need to fix the |
Once the |
@iltar it should be ready for review. Thanks! |
@iltar great! We're making progress here. I've just added a special case to check if |
I agree that this covers most use-cases. In a later stage I would like to ask the entity metadata what the identifier is, but I want this done in a generic fashion as not everything is a doctrine entity for example which probably blows up the scope of this PR. |
Good to merge? ping @symfony/deciders |
// collect voters and access decision manager information | ||
if (null !== $this->accessDecisionManager) { | ||
$this->data['access_decision_log'] = $this->accessDecisionManager->getDecisionLog(); | ||
$this->data['voter_strategy'] = $this->accessDecisionManager->getStrategy(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Both the getDecisionLog()
and getStrategy()
methods may not exist.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could typehint against the DebugAccessDecisionManager
, good to let it crash if you run this incorrectly imo
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've made this change. Is this what you suggested?
-if (null !== $this->accessDecisionManager) {
+if ($this->accessDecisionManager instance of DebugAccessDecisionManager) {
That looks really nice and useful! 👍 |
Thank you @javiereguiluz. |
…eguiluz) This PR was squashed before being merged into the 3.1-dev branch (closes #17887). Discussion ---------- Show more information in the security profiler | Q | A | ------------- | --- | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #17856 | License | MIT | Doc PR | - This is an early prototype to explore the feature of displaying more information in the security panel. Example:  Commits ------- b12152d Show more information in the security profiler
Great great great!!! Congrats @javiereguiluz @iltar |
…on (xabbuh) This PR was merged into the 3.1-dev branch. Discussion ---------- [SecurityBundle] fix lowest required Security Core version | Q | A | ------------- | --- | Branch | master | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #17887 | License | MIT | Doc PR | Commits ------- 4283cd7 fix lowest required Security Core version
…(javiereguiluz) This PR was squashed before being merged into the 3.1-dev branch (closes symfony#17887). Discussion ---------- Show more information in the security profiler | Q | A | ------------- | --- | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | symfony#17856 | License | MIT | Doc PR | - This is an early prototype to explore the feature of displaying more information in the security panel. Example:  Commits ------- b12152d Show more information in the security profiler
This is an early prototype to explore the feature of displaying more information in the security panel. Example: