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

[Security] Documented new IS_IMPERSONATOR, IS_ANONYMOUS and IS_REMEMBERED attributes#11487

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
wouterj merged 1 commit intosymfony:masterfromwouterj:security/is-impersonator
Feb 28, 2020

Conversation

wouterj
Copy link
Member

Changes the documentation to no longer use security attributes/functions that will be deprecated insymfony/symfony#31189 . It's funny to see how the docs were also confusing about the old attributes, as wrong attributes were used.

While doing these changes, I've also rewritten some parts to no longer talk about attributes as something the users have (like roles), but instead as something the user is matched against.

fabpot added a commit to symfony/symfony that referenced this pull requestFeb 24, 2020
…MEMBERED (HeahDude)This PR was merged into the 5.1-dev branch.Discussion----------[Security] Add IS_IMPERSONATOR, IS_ANONYMOUS and IS_REMEMBERED| Q             | A| ------------- | ---| Branch?       | master| Bug fix?      | no| New feature?  | yes| BC breaks?    | no| Deprecations? | yes| Tests pass?   | yes| Fixed tickets |#29848| License       | MIT| Doc PR        |symfony/symfony-docs#11487This continues work of@HeahDude and finally finishes one of the code PRs I've been working on during the ⭐️ EUFOSSA Hackathon.Changes---The PRs modifies some of the attributes used by the `AuthenticatedVoter`:* New `IS_IMPERSONATOR`, `IS_ANONYMOUS` and `IS_REMEMBERED` attributes are introduced to indicate the user either impersonated, anonymous or rembered.* <s>`IS_AUTHENTICATED_ANONYMOUSLY` actually meant "is authenticated, either anonymous or fully". As this is confusing, it is replaced by `IS_AUTHENTICATED`.</s>* <s>All `is_*()` functions in expressions are deprecated in favor of `is_granted('IS_*')`. It's not worth duplicating the `AuthenticatedVoter` logic in two places now we have shorter `IS_*` attributes</s>**Before**```phpif ($authorizationChecker->isGranted('ROLE_PREVIOUS_ADMIN')) {    // ...}```<s>```yamlsecurity:  # ...  access_control:    - { path: ^/protected, roles: 'IS_AUTHENTICATED_ANONYMOUSLY' }```</s>**After**```phpif ($authorizationChecker->isGranted('IS_IMPERSONATOR')) {    // ...}```<s>```yamlsecurity:  # ...  access_control:    - { path: ^/protected, roles: 'IS_AUTHENTICATED' }```</s><s>Discussion---The only thing I'm wondering is how we combine this with the `is_authenticated()` expression function:https://github.com/symfony/symfony/blob/98929dc2927c59ba3e36b5547f2eae6316aa4740/src/Symfony/Component/Security/Core/Authorization/ExpressionLanguageProvider.php#L33-L37As you can see, the `IS_AUTHENTICATED` attribute and `is_authenticated()` expression function do not have the same meaning. Should we somehow deprecate the current behavior of `is_authenticated()` or should we find another name for `IS_AUTHENTICATED` (that would be a shame imo).</s>Commits-------6c522a7 Added IS_ANONYMOUS, IS_REMEMBERED, IS_IMPERSONATOR
symfony-splitter pushed a commit to symfony/security-core that referenced this pull requestFeb 24, 2020
…MEMBERED (HeahDude)This PR was merged into the 5.1-dev branch.Discussion----------[Security] Add IS_IMPERSONATOR, IS_ANONYMOUS and IS_REMEMBERED| Q             | A| ------------- | ---| Branch?       | master| Bug fix?      | no| New feature?  | yes| BC breaks?    | no| Deprecations? | yes| Tests pass?   | yes| Fixed tickets |symfony/symfony#29848| License       | MIT| Doc PR        |symfony/symfony-docs#11487This continues work of@HeahDude and finally finishes one of the code PRs I've been working on during the ⭐️ EUFOSSA Hackathon.Changes---The PRs modifies some of the attributes used by the `AuthenticatedVoter`:* New `IS_IMPERSONATOR`, `IS_ANONYMOUS` and `IS_REMEMBERED` attributes are introduced to indicate the user either impersonated, anonymous or rembered.* <s>`IS_AUTHENTICATED_ANONYMOUSLY` actually meant "is authenticated, either anonymous or fully". As this is confusing, it is replaced by `IS_AUTHENTICATED`.</s>* <s>All `is_*()` functions in expressions are deprecated in favor of `is_granted('IS_*')`. It's not worth duplicating the `AuthenticatedVoter` logic in two places now we have shorter `IS_*` attributes</s>**Before**```phpif ($authorizationChecker->isGranted('ROLE_PREVIOUS_ADMIN')) {    // ...}```<s>```yamlsecurity:  # ...  access_control:    - { path: ^/protected, roles: 'IS_AUTHENTICATED_ANONYMOUSLY' }```</s>**After**```phpif ($authorizationChecker->isGranted('IS_IMPERSONATOR')) {    // ...}```<s>```yamlsecurity:  # ...  access_control:    - { path: ^/protected, roles: 'IS_AUTHENTICATED' }```</s><s>Discussion---The only thing I'm wondering is how we combine this with the `is_authenticated()` expression function:https://github.com/symfony/symfony/blob/98929dc2927c59ba3e36b5547f2eae6316aa4740/src/Symfony/Component/Security/Core/Authorization/ExpressionLanguageProvider.php#L33-L37As you can see, the `IS_AUTHENTICATED` attribute and `is_authenticated()` expression function do not have the same meaning. Should we somehow deprecate the current behavior of `is_authenticated()` or should we find another name for `IS_AUTHENTICATED` (that would be a shame imo).</s>Commits-------6c522a7d98 Added IS_ANONYMOUS, IS_REMEMBERED, IS_IMPERSONATOR
@wouterjwouterjforce-pushed thesecurity/is-impersonator branch from4092f06 to154aebeCompareFebruary 24, 2020 19:09
@wouterjwouterj changed the title[Security] Removed all deprecated attributes from the docs[Security] Documented new IS_IMPERSONATOR, IS_ANONYMOUS and IS_REMEMBERED attributesFeb 24, 2020
@wouterjwouterj removed the Waiting Code MergeDocs for features pending to be merged labelFeb 24, 2020
@wouterjwouterj modified the milestones:next,5.1Feb 24, 2020
@wouterj
Copy link
MemberAuthor

The feature is now merged. I've updated this PR (completely), as the scope of the feature PR was also completely changed. Please give it another review & merge when you're happy! :)

fabpot added a commit to symfony/symfony that referenced this pull requestFeb 25, 2020
This PR was merged into the 5.1-dev branch.Discussion----------[Security] Deprecated ROLE_PREVIOUS_ADMIN| Q             | A| ------------- | ---| Branch?       | master| Bug fix?      | no| New feature?  | no| Deprecations? | yes| Tickets       | n/a| License       | MIT| Doc PR        |symfony/symfony-docs#11487`ROLE_PREVIOUS_ADMIN` is added to the token roles if the session is an impersonation. Since#31189 we have the `IS_IMPERSONATOR` attribute which can be used for the same reason. I propose to deprecate the `ROLE_PREVIOUS_ADMIN`:* This is not what roles are for ([resulting in hacking this exception in `AbstractToken`](https://github.com/symfony/symfony/blob/5.0/src/Symfony/Component/Security/Core/Authentication/Token/AbstractToken.php#L275-L277))* The role isn't very descriptive* I don't like having 2 ways of doing exactly the same thing* While every application with impersonation enabled probably needs to be updated, the update is as simple as replacing `ROLE_PREVIOUS_ADMIN` with `IS_IMPERSONATOR`: `find ./ -type f -exec sed -i 's/ROLE_PREVIOUS_ADMIN/IS_IMPERSONATOR/g' {} +`---I'm a bit unsure on how to deprecate this role, but I think having it in `RoleVoter` is probably the safest (`isGranted()` and variants + `AccessDecisionManager#decide()` all use this voter to check if the token has this role).Commits-------dce55f3 Deprecated ROLE_PREVIOUS_ADMIN
symfony-splitter pushed a commit to symfony/security-core that referenced this pull requestFeb 25, 2020
This PR was merged into the 5.1-dev branch.Discussion----------[Security] Deprecated ROLE_PREVIOUS_ADMIN| Q             | A| ------------- | ---| Branch?       | master| Bug fix?      | no| New feature?  | no| Deprecations? | yes| Tickets       | n/a| License       | MIT| Doc PR        |symfony/symfony-docs#11487`ROLE_PREVIOUS_ADMIN` is added to the token roles if the session is an impersonation. Sincesymfony/symfony#31189 we have the `IS_IMPERSONATOR` attribute which can be used for the same reason. I propose to deprecate the `ROLE_PREVIOUS_ADMIN`:* This is not what roles are for ([resulting in hacking this exception in `AbstractToken`](https://github.com/symfony/symfony/blob/5.0/src/Symfony/Component/Security/Core/Authentication/Token/AbstractToken.php#L275-L277))* The role isn't very descriptive* I don't like having 2 ways of doing exactly the same thing* While every application with impersonation enabled probably needs to be updated, the update is as simple as replacing `ROLE_PREVIOUS_ADMIN` with `IS_IMPERSONATOR`: `find ./ -type f -exec sed -i 's/ROLE_PREVIOUS_ADMIN/IS_IMPERSONATOR/g' {} +`---I'm a bit unsure on how to deprecate this role, but I think having it in `RoleVoter` is probably the safest (`isGranted()` and variants + `AccessDecisionManager#decide()` all use this voter to check if the token has this role).Commits-------dce55f352a Deprecated ROLE_PREVIOUS_ADMIN
@wouterjwouterjforce-pushed thesecurity/is-impersonator branch from154aebe tof158df2CompareFebruary 28, 2020 12:06
@wouterjwouterjforce-pushed thesecurity/is-impersonator branch fromf158df2 to0e2b406CompareFebruary 28, 2020 12:08
@wouterj
Copy link
MemberAuthor

Thanks@HeahDude for the extensive review!

@wouterjwouterj merged commit96ac468 intosymfony:masterFeb 28, 2020
@wouterjwouterj deleted the security/is-impersonator branchFebruary 28, 2020 12:11
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@HeahDudeHeahDudeHeahDude left review comments

@OskarStarkOskarStarkOskarStark approved these changes

@javiereguiluzjaviereguiluzAwaiting requested review from javiereguiluz

Assignees
No one assigned
Projects
None yet
Milestone
5.1
Development

Successfully merging this pull request may close these issues.

4 participants
@wouterj@OskarStark@HeahDude@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp