-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
The given value "127.0.0.1,127.0.0.2" in the "security.access_control" config option is not a valid IP address #40864
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
The documentation is misleading (the code example does it right though). Your config should be like this: security:
access_control:
-
path: "^/some/path/.*$"
ips: ['127.0.0.1', '127.0.0.2']
roles: ["IS_AUTHENTICATED_ANONYMOUSLY"]
methods: ["POST"] Closing here as there is no bug in the code. Can you please open an issue in the documentation repository about this or send a PR that improves the current wording? |
But in fact, you can specify ips as a string (through envs) and it works correctly (if ips = "%env(APP_IP_ADDRESSES)%"). That is, the problem occurs only when validating the bundle configuration. |
… 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
Uh oh!
There was an error while loading. Please reload this page.
Symfony version(s) affected: 5.2.6
Description
https://symfony.com/doc/current/security/access_control.html#matching-options
ip or ips: netmasks are also supported (can be a comma-separated string)
But if you specify ip with a comma separator, then we get an error: "The given value "127.0.0.1,127.0.0.2" in the "security.access_control" config option is not a valid IP address" in \Symfony\Bundle\SecurityBundle\DependencyInjection\SecurityExtension::createRequestMatcher
How to reproduce
config/packages/security.yaml
Validate security bundle configuration.
The text was updated successfully, but these errors were encountered: