Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Symfony can changing the 'secret' parameter break anything?

In the parameters.yml file there is a parameter named secret which defaults to ThisTokenIsNotSoSecretChangeIt but it should be changed to something else.

What happens if the value of this parameter is changed in production? Can it break anything?

like image 917
Francesco Borzi Avatar asked Nov 17 '16 09:11

Francesco Borzi


People also ask

How does Symfony decrypt work?

Symfony will decrypt existing secrets with the old key, generate new cryptographic keys and re-encrypt secrets with the new key. In order to decrypt previous secrets, the developer must have the decryption key.

How can I safely store sensitive values in Symfony?

When these values are sensitive and need to be kept private, you can safely store them by using Symfony's secrets management system - sometimes called a "vault". The Secrets system requires the Sodium PHP extension.

How do I regenerate the cryptographic keys in Symfony?

The secrets:generate-keys command provides a --rotate option to regenerate the cryptographic keys. Symfony will decrypt existing secrets with the old key, generate new cryptographic keys and re-encrypt secrets with the new key. In order to decrypt previous secrets, the developer must have the decryption key.

How can I change the behavior of a Symfony application?

In other words, you can change the application behavior by changing which configuration files are loaded. That's the idea of Symfony's configuration environments. A typical Symfony application begins with three environments: dev (for local development), prod (for production servers) and test (for automated tests ).


1 Answers

It does not break anything. Changing the value secret parameter from time to time is even considered a good practice, suggested by the official documentation:

http://symfony.com/doc/current/reference/configuration/framework.html#secret

The only thing to be aware of is:

However, keep in mind that changing this value will invalidate all signed URIs and Remember Me cookies. That's why, after changing this value, you should regenerate the application cache and log out all the application users.

like image 59
Francesco Borzi Avatar answered Oct 16 '22 10:10

Francesco Borzi