-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[FrameworkBundle] secrets:decrypt-to-local
shows hard error if invalid secret is found
#42038
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
Status: Reviewed I was able to reproduce this bug using the supplied code. The problem also exists in Symfony 5.3. However, it produces the error message If there is a secret that exists above the non-existent bottom one in the array, then the error message is For example: Given
If any combination of If any combination of |
The fix for symfony#42038 did a bit too much. Not only did it fix the PHP error that wasn't caught before, but also changed the exit code of the command. With this change the PHP error will still be prevented, but the command will terminate with a non-zero exit code to indicate the failure that occurred while reading the stored secrets.
…hen a secret could not be read (xabbuh) This PR was merged into the 7.2 branch. Discussion ---------- [FrameworkBundle] terminate with non-zero exit code when a secret could not be read | Q | A | ------------- | --- | Branch? | 7.2 | Bug fix? | no | New feature? | yes | Deprecations? | no | Issues | | License | MIT The fix for #42038 did a bit too much. Not only did it fix the PHP error that wasn't caught before, but also changed the exit code of the command. With this change the PHP error will still be prevented, but the command will terminate with a non-zero exit code to indicate the failure that occurred while reading the stored secrets. Commits ------- 1d1ab26 terminate with non-zero exit code when a secret could not be read
Symfony version(s) affected: 4.4
Description
If I wrongly remove a secret (i.e. I don't use
secrets:remove
and only remove the file and don't update the list), you get a hard error insecrets:decrypt-to-local
:How to reproduce
I created an app in this state: https://github.com/wouterj/sf-reproducer/tree/secrets-bad-remove
Run the above command and you'll get the hard error.
Possible Solution
Vault::list()
reveals all keys usingVault::reveal()
. This method resets the last error message each call. Thesecrets:decrypt-to-local
command expects there to be a last error message if the value is null, but this is not the case if a valid secrets is available in the vault after the bad one.We should either fail in
Vault::list()
as soon as a bad secret is found, or allowlastMessage
to be an array of messages.Additional context
n/a
The text was updated successfully, but these errors were encountered: