Repository navigation
Add option to have gpg decrypt failures treated as errors - #61418
Conversation
6d0df42 to
369e062
Compare
|
Something like the following in |
71c1530 to
5068690
Compare
This is defaulted `false` for compatibility, and is controlled via a `gpg_decrypt_must_succeed` option. If this is true- and the ciphertext couldn't be decrypted- then it's treated as an error rather than just passing the raw ciphertext through. Sending the ciphertext through basically is *never* desired- the point of the gpg renderer is to decrypt the secret, not send the cipher text through.
Test that: 1. Pillar registers an error when `gpg_decrypt_must_succeed` is `True` and decryption fails 2. The GPG renderer fails silently when `gpg_decrypt_must_succeed` is `False` Also mock `__opts__["gpg_decrypt_must_succeed"]` for gpg renderer unit pytests.
- Normalize module-global data into pytest fixtures. It is not the least opaque option but we work within the constraints of pytest. - Also rescope gpg pillar fixtures to module. If they are needed in a larger context, they should be defined in an appropriately prominent file.
5068690 to
256ca9d
Compare
|
@Ch3LL anything else that needs to be done on this? |
|
Apologies for the delay, I was out sick most of last week. Thanks it looks good :) |
No problem, thanks for the review. |
|
I guess it is too late to fix, but Salt has two configuration namespaces for feature toggles:
This means that instead of a global or P.S. It would be nice to deprecate the non-strict way in future (or flip the default). These feature flags tend to accumulate in various master/minion bootstrap scripts I'm working on. I'm always torn between enabling better defaults ( |
@max-arnold, this was my intention. It's clearly the obvious thing to do. Let the option bake a couple of releases and then there's no reason to change the default behavior. You're welcome to submit the pull request, otherwise I will get around to actioning it from my backlog at some point.
Yes, change the default and burn the config. |
Flip the default of gpg_decrypt_must_succeed from False to True so that a GPG decryption failure raises SaltRenderError instead of silently returning the encrypted ciphertext. Without this, a locked keychain or missing private key causes file.managed (contents_pillar) to write the raw GPG-armored ciphertext to disk in place of the decrypted secret, exposing encrypted-at-rest data. 3007.x, 3008.x, and master shipped this default via PR saltstack#64471 (2023-06-21). PR saltstack#61418 backported the option to 3006.x but the default flip was not. This change brings 3006.x in line. The warn_until("Chlorine", ...) deprecation block in the gpg renderer is removed; Chlorine (3007) has shipped and the deprecation is now realized via the default. Behavior change: users who relied on silent decrypt failures must explicitly set "gpg_decrypt_must_succeed: False" in their minion or master config. Fixes saltstack#41846
What does this PR do?
This is defaulted
falsefor compatibility, and is controlled via agpg_decrypt_must_succeedoption.Previous Behavior
If this is
True- and the ciphertext couldn't be decrypted- then it's treated as an error rather than just passing the raw ciphertext through.Sending the ciphertext through basically is never desired- the point of the gpg renderer is to decrypt the secret, not send the cipher text through.
New Behavior
Explicitly error if gpg does not decrypt the ciphertext.
Merge requirements satisfied?
Commits signed with GPG?
Yes