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

marshal nested secrets value to string #454

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

iosmanthus
Copy link

This pull request marshals nested secret values according to the format of the secret file.

Signed-off-by: iosmanthus <myosmanthustree@gmail.com>
Signed-off-by: iosmanthus <myosmanthustree@gmail.com>
@iosmanthus
Copy link
Author

Seem the serialized yaml value has some newline, I should trim the output string.

Signed-off-by: iosmanthus <myosmanthustree@gmail.com>
@Mic92
Copy link
Owner

Mic92 commented Dec 13, 2023

So the idea is that we can have yaml and json encrypted without having to put them in strings? Would be nice to extend the test case those those as well: https://github.com/Mic92/sops-nix/blob/master/pkgs/sops-install-secrets/nixos-test.nix

The script to update secrets is here: https://github.com/Mic92/sops-nix/blob/master/pkgs/sops-install-secrets/test-assets/sops-edit

@iosmanthus
Copy link
Author

iosmanthus commented Dec 14, 2023

So the idea is that we can have yaml and json encrypted without having to put them in strings? Would be nice to extend the test case those those as well: master/pkgs/sops-install-secrets/nixos-test.nix

The script to update secrets is here: master/pkgs/sops-install-secrets/test-assets/sops-edit

The basic idea is to support any value in a nested secret. However, I found some edge cases for this pull request:

  1. It supports the value of the secret to be a number but shows as a string in the template rendering, I might add some type of information into the placeholder.
  2. If the secret is a string formed by numbers, like "113", the rendered template would be like: ""123"".

I would add some tests to nixos-test.nix, and some unit tests for recurseSecretKey.

@Mic92
Copy link
Owner

Mic92 commented Dec 14, 2023

Maybe it should only render arrays and hashmaps?

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

Successfully merging this pull request may close these issues.

None yet

2 participants