Skip to content
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

Request for skipping keys in YAML that match encrypted_regex but are in plaintext #1680

Closed
vlasov-y opened this issue Nov 20, 2024 · 6 comments

Comments

@vlasov-y
Copy link

Hi! Issue comes from Flux
SOPS fails if we have keys with plain text, but those keys match encrypted_regex.
Can you please make SOPS to ignore fields if they are not acttualy encrypted?

Example manifest:

apiVersion: v1
kind: Pod
metadata:
  name: pod
spec:
  containers:
    - name: main
      image: nginx:stable-alpine
      env:
        - name: ENC[AES256_GCM,data:...
          value: ENC[AES256_GCM,data:...
      resources:
        limits:
          memory: 50Mi
          cpu: 50m
    - name: patched
      image: nginx:stable-alpine
      env:
        - name: MainEnvValueIsEncrypted
          value: but this one is not
sops:
  ...
  encrypted_regex: ^env$ # There it is
  ...
@felixfontein
Copy link
Contributor

This can only happen if you manually edit files after encrypting them with SOPS. Why do you want to do this? Generally I think it is good if SOPS reports errors for such broken files.

@vlasov-y
Copy link
Author

That is a core flux functionality - to merge manifests. Basically it works fine and SOPS can decrypt such modified files, except if the issue case.

@vlasov-y
Copy link
Author

This can only happen if you manually edit files after encrypting them with SOPS. Why do you want to do this? Generally I think it is good if SOPS reports errors for such broken files.

If SOPS starts reporting mixed files instead of decrypting them, that will be a catastrophic for Flux, please, do not do that.

@felixfontein
Copy link
Contributor

SOPS does support mixed files, as long as they stick to the rules.

If you want to encrypt some env entries but not others, then maybe using encrypted_comment_regex (with appropriate comments in the right places) instead of encrypted_regex would be the better choice?

@vlasov-y
Copy link
Author

vlasov-y commented Dec 1, 2024

I did not know about this way. Will think about that. Please, do not change default behaviour, let it continue decrypt modified files for us.

@vlasov-y vlasov-y closed this as completed Dec 1, 2024
@felixfontein
Copy link
Contributor

We try to avoid breaking changes; and changing default behavior is generally a breaking change.

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

No branches or pull requests

2 participants