-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
Unable to resolve env() in (Security) configuration #26747
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
ping @ro0NL |
The question is would it work if symfony/src/Symfony/Bundle/SecurityBundle/DependencyInjection/Security/Factory/RememberMeFactory.php Lines 129 to 131 in e6302e2
What removing the empty check pre-compile? And check emptyness during runtime? Im not really convinced this is a bug, to me it's new 4.1 behavior really. |
There will be more cases where |
Because any env can be empty. Not sure what "non-empty" string to test for? Either way.. it still might end up being empty during runtime. IMHO Im still thinking about some other ways :) |
Maybe That would be in line with type validation, given you use |
that's not the most likely situation, so I would not target this as the default one...
it doesn't today, so accepting this statement means accepting a BC break, no-go
All referenced envvars are already required. You mean non empty I suppose. Not sure it's needed. At some point, users are responsible for what they do. So let's find a way to pass cannotBeEmpty. |
for the wrong reasons yes :)
Yes, but i thought EIther way.. im 👍 for something pragmatic also. Basically we suggest to skip empty-validation for placeholders right? |
What about using |
I tend to prefer some explicit config too =/ technically should be something like: secret: '%env(not_empty:APP_SECRET)%' |
looks sensible to me
there is already a way to define default values for env placeholder. |
This PR was merged into the 4.1-dev branch. Discussion ---------- [DI][Config] Fix empty env validation | Q | A | ------------- | --- | Branch? | master | Bug fix? | yes | New feature? | no | BC breaks? | no <!-- see https://symfony.com/bc --> | Deprecations? | no | Tests pass? | yes <!-- please add some, will be required by reviewers --> | Fixed tickets | #26747 | License | MIT | Doc PR | symfony/symfony-docs#... <!-- required for new features --> <!-- Write a short README entry for your feature/bugfix here (replace this comment block.) This will help people understand your PR and can be used as a start of the Doc PR. Additionally: - Bug fixes must be submitted against the lowest branch where they apply (lowest branches are regularly merged to upper ones so they get the fixes too). - Features and deprecations must be submitted against the master branch. --> Commits ------- d40a4f4 [DI][Config] Fix empty env validation
Since (I suspect) #23888 using
env()
in a firewall configuration no longer works.The path "security.firewalls.main.remember_me.secret" cannot contain an empty value, but got "".
To reproduce:
Now update config/packages/security.yaml with:
And run
bin/console cache:clear
.I tried debugging the system, but somewhere along execution the Configuration Resolver looses the value. All env variables are present, there are placeholders, and framework.secret works without any issues but the firewall remember_me fails for some unknown reason 🤔
The text was updated successfully, but these errors were encountered: