-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[SecurityBundle] Comma separated ips for security.access_control #40881
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
Comments
duplicates #40865 |
It's works, if trusted_ips: "%env(APP_SOME_IP_ADDRESSES)%"). The problem with using environment variables only occurs when the security bundle is validated. Without running validation, the bundle will work using environment variables as a value with comma separated string. See \Symfony\Bundle\SecurityBundle\DependencyInjection\SecurityExtension::createRequestMatcher |
right, does it duplicate #40864? (the example there doesnt use envs either) from the error with envs the validation should be bypassed as per symfony/src/Symfony/Bundle/SecurityBundle/DependencyInjection/SecurityExtension.php Line 739 in 2dd8445
Then there'd be a second issue indeed 👍 |
It's exactly the same problem than #40864 and #40865 : in the three cases, the providen parameters are replaced by their values (from ENV or from a parameter), and then the security bundle fails on its validation. I've just tried with this config, without any parameter: access_control:
- { path: ^/profile, roles: ROLE_USER, ips: [::1, '127.0.0.1,127.0.0.2'] } And the validation throws the same exception. |
@ro0NL , @xabbuh the issues #40881, #40864, #40865 are all about the same problem. We have inconsistent behavior when using plain string or environment variable as a configuration value. |
do we actually have a reproducer config that uses envs and crashes? |
@ro0NL, Well, we have some internal command which is executed before deployment to target environment and validates all configured environment variables. Under the hood the command builds another container with all environment variables resolved and checks thrown exceptions. (We also can share this code as feature request into framework bundle) |
… comma-separated string
… comma-separated string
… comma-separated string
… comma-separated string
… comma-separated string
… comma-separated string
… comma-separated string (edefimov) This PR was merged into the 5.2 branch. Discussion ---------- [Security] Allow ips parameter in access_control to accept comma-separated string | Q | A | ------------- | --- | Branch? | 5.2 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | #40881, #40864, #40865 | License | MIT PR #38149 introduced a new feature to accept a comma-separated string in ip adresses setting in `access_control` configuration section of security bundle. However the feature works in inconsistent manner: comma-separated string can be successfully passed via environment variable, but can not be passed as plain string. This PR changes this inconsistent behavior by allowing validation pass if comma-separated list of ip addresses is given in plain string. More detailed explanation about the inconsistent behavior can be found [here](#40881 (comment)) Commits ------- 8947482 [SecurityBundle] Allow ips parameter in access_control accept comma-separated string
Symfony version(s) affected: 5.2.6
Description
Hi,
I tried to use the new feature in 5.2.0 from #38149.
The comma separated value is rejected by the SecurityExtension
How to reproduce
Then, I get a LogicException
The text was updated successfully, but these errors were encountered: