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

encrypted_regex for particular nodes in yaml? #1367

Open
craighurley opened this issue Dec 7, 2023 · 4 comments
Open

encrypted_regex for particular nodes in yaml? #1367

craighurley opened this issue Dec 7, 2023 · 4 comments

Comments

@craighurley
Copy link

Hello,

For the given yaml, how can I write an encrypted_regex to only match "Default" under "B"?

A:
  Type: string
  Default: string

B:
  Type: string
  Default: string

If I use encrypted_regex: "Default", it encrypts "Default" under both "A" and "B".

Version info

$ sops -v
sops 3.8.1 (latest)

Thank you.

@felixfontein
Copy link
Contributor

This isn't possible right now. What you can do is using comments to determine what to encrypt and what not. This feature has been merged in main, but isn't available in a release yet though.

@felixfontein
Copy link
Contributor

Hmm, I'm sorry, actually it hasn't been merged yet. It's in #974.

@mitar
Copy link
Contributor

mitar commented Jan 4, 2024

#974 is about using a comment to pick what is encrypted, not field name itself. Regex by the name itself seems to be already supported: https://github.com/getsops/sops#48encrypting-only-parts-of-a-file

I think what OP is asking for is that there might need to be another flag like encrypted_regex_path which would match against A.Default and B.Default so that one could pick which exactly field to encrypt based on its name. Currently it seems we match just Default part.

Would changing existing encrypted_regex to match the whole path be a to much of a breaking change?

@felixfontein
Copy link
Contributor

Would changing existing encrypted_regex to match the whole path be a to much of a breaking change?

IMO yes. I don't think this is something we will add anytime soon though, so using comments and #974 is the best way to achieve what OP wants.

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

3 participants