-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
SecurityBundle configuration via environment variables #28051
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 unresolved value is normal at this stage: these placeholders are resolved later on, when the container is dumped. The solution you suggest doesn't work as one would expect: it generates a compiled container that will hold the static value that was set a compile time, while the very nature of env vars is to be configurable at run time with a call to getenv() or similar. |
inability to set
at least it respects the actual values. |
Maybe we can move the logic to runtime for this case? Lines 33 to 37 in f834c92
|
We would definitely need a runtime check to allow using an env var here. |
@zerkms Are you working on this? I can pick it up if you're busy |
@gonzalovilaseca I'm moving a house and expecting a newborn in couple weeks - I definitely won't be able to do any opensource soon :-D |
@zerkms For a looooong time :-) |
I've done this: https://github.com/symfony/symfony/compare/master...gonzalovilaseca:gv-28051?expand=1 But I'm getting |
The compiled container has |
Oh, I just picked it up because it had the |
I've personally seen applications that should have had authentication done via https and the rest of the application accessed through http. |
I had the code almost done, so I've created the PR, if it doesn't go ahead it can always be closed: #28651 |
Symfony version(s) affected: 4.1
Description
Security bundle configuration does not resolve environment variables (at least
cookie_secure
)How to reproduce
This config looks good, whereas
Symfony\Bundle\SecurityBundle\DependencyInjection\Compiler\AddSessionDomainConstraintPass
does not take it into account and uses$sessionOptions['cookie_secure']
as-is, which holds theenv_b5fff47290c287c9_bool_APP_SECURE_93dabfcdbc8f9f7829f1a29cd3d2d083
value.Possible Solution
Instead of YAML use the following ugly php-based configuration (or its variations)
Additional context
The text was updated successfully, but these errors were encountered: