Skip to content

[Security] Cannot use env in RememberMe config #44978

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

Closed
bradycargle opened this issue Jan 11, 2022 · 8 comments
Closed

[Security] Cannot use env in RememberMe config #44978

bradycargle opened this issue Jan 11, 2022 · 8 comments

Comments

@bradycargle
Copy link

Symfony version(s) affected

4.4

Description

It seems like this was fixed for Symfony 3.4 but it still exists on 4.4+ and is causing problems for us (mautic/mautic#9011)

How to reproduce

Inside security.php:

lifetime: (int) $container->getParameter('env.rememberme_lifetime'),

Possible Solution

Remove these lines

https://github.com/symfony/symfony/blob/4.4/src/Symfony/Bundle/SecurityBundle/DependencyInjection/Security/Factory/RememberMeFactory.php#L159-L160

Additional Context

No response

@escopecz
Copy link

Original issue where it was fixed for Symfony 3 for reference: #36271

@carsonbot
Copy link

Hey, thanks for your report!
There has not been a lot of activity here for a while. Is this bug still relevant? Have you managed to find a workaround?

@escopecz
Copy link

There is this ugly workaround, but I don't get why it was fixed in Symfony 3 but not in the newer versions.

@carsonbot carsonbot removed the Stalled label Jul 12, 2022
@xabbuh
Copy link
Member

xabbuh commented Jul 12, 2022

In #36271 (comment) it was said that the reproducer app for the 3.4 branch did not have the same issue when updating to 4.4. So it seems that your app might be different. Can you provide a full example application that allows to reproduce your issue?

@xabbuh
Copy link
Member

xabbuh commented Jul 21, 2022

I am going to close here for now due to the lack of feedback. Please let us know when you have more information and we can consider to reopen.

@xabbuh xabbuh closed this as completed Jul 21, 2022
@escopecz
Copy link

Can you provide a full example application that allows to reproduce your issue?

@xabbuh it is provided in the description. See mautic/mautic#9011. Mautic is an open source app where you can reproduce it.

@xabbuh
Copy link
Member

xabbuh commented Jul 21, 2022

If you refer to mautic/mautic@9568806, this looks like an issue in Mautic to me. As far as I understand the code it is trying to evaluate the value at compile time which does not work (well) with environment variables.

@escopecz
Copy link

@xabbuh that is very good information. Do you have a suggestion how to fix it? rememberme_lifetime is set as an int:

https://github.com/mautic/mautic/blob/5.x/app/bundles/CoreBundle/Config/config.php#L1341

But it's failing because it's expecting an int but getting string.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants