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

Appearance settings

[SecurityBundle] ExpressionCacheWarmer uses wrong attributes #40087

Copy link
Copy link
Closed
@wickedOne

Description

@wickedOne
Issue body actions

Symfony version(s) affected: 5.2.2

Description
when using the role_names attribute in an expression of your access control configuration, warming the cache will fail with an Variable "role_names" is not valid around position... message because the cache warmer expects a roles attribute.

$this->expressionLanguage->parse($expression, ['token', 'user', 'object', 'subject', 'roles', 'request', 'trust_resolver']);

the documentation on this feature also is confusing as the given example uses role_names while the description uses the roles attribute: https://symfony.com/doc/current/security/expressions.html

How to reproduce
add the following in your acces_control config of the security config and run a bin/console cache:clear:

    access_control:
        - { path: '^/', allow_if: "'ROLE_ADMIN' in role_names"}

Possible Solution
change the roles attribute to role_names in the ExpressionCacheWarmer and correct the documentation accordingly.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.