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

Skip to content

[Security] allow arbitrary types in VoterInterface::vote() #16754

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
Nov 30, 2015

Conversation

xabbuh
Copy link
Member

@xabbuh xabbuh commented Nov 30, 2015

Q A
Bug fix? no
New feature? yes
BC breaks? yes
Deprecations? no
Tests pass? yes
Fixed tickets #16600
License MIT
Doc PR TODO

@@ -85,7 +85,7 @@ private function getVariables(TokenInterface $token, $object)
$variables = array(
'token' => $token,
'user' => $token->getUser(),
'object' => $object,
'object' => $subject,
Copy link
Member Author

Choose a reason for hiding this comment

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

The object variable should probably be renamed to subject too. But that should be done in 2.8 and we should throw a deprecation when accessing object. Would that actually be possible?

Copy link
Member

Choose a reason for hiding this comment

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

Adding subject along side object in 2.8 is a good idea. Throwing a deprecation notice is possible, but not trivial.

Copy link
Member Author

Choose a reason for hiding this comment

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

Okay, renamed object to subject here and introduced a new subject variable in #16755.

@@ -31,10 +31,10 @@
* ACCESS_GRANTED, ACCESS_DENIED, or ACCESS_ABSTAIN.
*
* @param TokenInterface $token A TokenInterface instance
* @param object|null $object The object to secure
* @param mixed $subject The subject to secure
Copy link
Member

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 for existing voters, as they must now be written in a way accepting any kind of value here, not just object|null. So if we do it, we must document it as a BC break.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, that BC break is intended so that the interface actually allows to be used like the new Voter class introduced in 2.8.

Copy link
Member Author

Choose a reason for hiding this comment

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

and by the way, it's added to the upgrade file

@fabpot
Copy link
Member

fabpot commented Nov 30, 2015

Thank you @xabbuh.

@fabpot fabpot merged commit 9054bdf into symfony:master Nov 30, 2015
fabpot added a commit that referenced this pull request Nov 30, 2015
…te() (xabbuh)

This PR was merged into the 3.0-dev branch.

Discussion
----------

[Security] allow arbitrary types in VoterInterface::vote()

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | yes
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #16600
| License       | MIT
| Doc PR        | TODO

Commits
-------

9054bdf allow arbitrary types in VoterInterface::vote()
@xabbuh xabbuh deleted the issue-16600 branch November 30, 2015 12:47
@fabpot fabpot mentioned this pull request Nov 30, 2015
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.

5 participants