Conversation
Signed-off-by: Boris Kreitchman <bkreitch@gmail.com>
Signed-off-by: Boris Kreitchman <bkreitch@gmail.com>
Signed-off-by: Boris Kreitchman <bkreitch@gmail.com>
fc1f6d3 to
8dce48a
Compare
We can't have the CLI import a controller main package, we need to extract the
Storing the GPG keys on disk would result in a CVE in Flux, I'm not for doing this. Also what happens with KMS encrypted secrets? |
@stefanprodan With AWS KMS - if user running diff has access to the KMS key (via role or creds in env vars or .aws/credentials) then secret is decrypted and compared. Or if there are AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY in sops.aws-kms field of secret in decryption.secretRef.name then these are used instead. So there shouldn't be issues here. I suppose the situation is similar with GCP and Azure, but I can check if needed. |
This PR will add
--decrypt-secretsflag to decrypt SOPS secrets in diff command so the changes could be detected also in values:Changes in metadata like replicator annotations, etc are also detected since decrypted secrets are compared in full and not only by keys. The output of diff command is still being sanitized by
ssapackage, so the actual values are not shown. Build command is not affected and it still masks secrets in the output.It uses the key from decryption.secretRef of the Kustomization and depends on
decryptpackage fromkustomize-controllerbeing exported or maybe moved topkgrepo? So till then it won't compile.I've tried it with age, gpg and hcvault keys/tokens. Currently diff command will give an error if
--decrypt-secretsflag is used but SOPS secret cannot be decrypted. This could be changed to still pass encrypted secret with addition of another flag like--strict-decryptto control the behavior.There is potential issue with GPG keys since they are being imported into temporary directory on disk and if application is killed the key may remain there. I can think of two options to approach this. First is to add HasGPG() function that will return true if there is GPG key in SOPS secret and then application will refuse to proceed with
--decrypt-secretsflag. Or add an option to filter out GPG keys in decryptor.ImportKeys() before calling d.gnuPGHome.Import().WDYT?