-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Security] don't do nested calls to serialize() #30006
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
[Security] don't do nested calls to serialize() #30006
Conversation
src/Symfony/Component/Security/Core/Exception/CustomUserMessageAuthenticationException.php
Outdated
Show resolved
Hide resolved
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 think this is the best approach we can achieve for 3.4.
For master, we should deprecate extending serialize/unserialize and provide another API that returns/accepts arrays instead.
@stof I'd be happy to have your 👍 here :) |
@nicolas-grekas Would this |
I suggest looking at what the PHP RFC for |
That's correct, For master:
I thought of a slightly different plan: we should mark |
But they probably cannot add an actual parameter there. We don't even expect them to do it (we expect them to add it when doing the |
So, we remove the annotation and we plan for master. Works for me. OK for you with my proposal for master? |
So in your plan, switching to |
Correct. @renanbr could you please remove the added docblocks? |
Thank you @renanbr. |
…rekas, Renan) This PR was merged into the 3.4 branch. Discussion ---------- [Security] don't do nested calls to serialize() | Q | A | ------------- | --- | Branch? | 3.4 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #29951 | License | MIT | Doc PR | n/a The problem (originally reported as `Symfony\Component\Security\Core\Authentication\Token\AbstractToken` issue), may occur also in classes extending `Symfony\Component\Security\Core\Exception\AuthenticationException` Tasks: - [x] Skip native serializer (workaround itself) - [x] Token test - [x] Exception test Commits ------- 10256fc skip native serialize among child and parent serializable objects 41000f1 [Security] dont do nested calls to serialize()
]); | ||
return serialize([parent::serialize(true), $this->messageKey, $this->messageData]); | ||
|
||
return $this->doSerialize($serialized, \func_num_args() ? \func_get_arg(0) : null); |
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.
Problem: double return!
(seeing the others changes, I guess the first line should be $serialized = [...];
)
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.
thanks @guilliamxavier , see #30044
…icolas-grekas) This PR was merged into the 3.4 branch. Discussion ---------- [Security\Guard] bump lowest version of security-core | Q | A | ------------- | --- | Branch? | 3.4 | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | - | License | MIT | Doc PR | - Forgotten in #30006 so that `PostAuthenticationGuardToken` can call `AbstractToken::doSerialize()`. Commits ------- 93cfd5b [Security\Guard] bump lowest version of security-core
The problem (originally reported as
Symfony\Component\Security\Core\Authentication\Token\AbstractToken
issue), may occur also in classes extendingSymfony\Component\Security\Core\Exception\AuthenticationException
Tasks: