1
0
Fork 0
mirror of https://github.com/Mic92/sops-nix.git synced 2024-12-14 11:57:52 +00:00
sops-nix/pkgs
Jeremy Fleischman eee831aadb Do not render templates when decrypting neededForUsers secrets
This fixes https://github.com/Mic92/sops-nix/issues/659

In https://github.com/Mic92/sops-nix/pull/649, we started rendering
templates twice:

1. When rendering `neededForUsers` secrets (if there are any
   `neededForUsers` secrets).
2. When decrypting "regular" secrets.

This alone was weird and wrong, but didn't cause issues
for people until https://github.com/Mic92/sops-nix/pull/655, which
triggered https://github.com/Mic92/sops-nix/issues/659. The cause is not
super obvious:

1. When rendering `neededForUsers` secrets, we'd generate templates in
   `/run/secrets-for-users/rendered`.
2. However, the `path` for these templates is in
   `/run/secrets/rendered`, which is not inside of the
   `/run/secrets-for-users` directory we're dealing with, so we'd
   generate a symlink from `/run/secrets/rendered/<foo>` to
   `/run/secrets-for-users/rendered/<foo>`, which required making
   the parent directory of the symlink (`/run/secrets/rendered/`).
3. This breaks sops-nix's assumption that `/run/secrets` either doesn't
   exist, or is a symlink, and you get the symptoms described in
   <https://github.com/Mic92/sops-nix/issues/659>.

Reproducing this in a test was straightforward: just expand our existing
template test to also have a `neededForUsers` secret.

Fixing this was also straightforward: don't render templates during the
`neededForUsers` phase (if we want to add support for `neededForUsers`
templates in the future, that would be straightforward to do, but I
opted not do that here).
2024-11-17 06:19:41 +00:00
..
sops-import-keys-hook Lint fixes (#539) 2024-04-18 16:19:26 +02:00
sops-init-gpg-key Update pkgs/sops-init-gpg-key/sops-init-gpg-key 2023-01-11 10:00:33 +01:00
sops-install-secrets Do not render templates when decrypting neededForUsers secrets 2024-11-17 06:19:41 +00:00
sops-pgp-hook reformat with gofumpt 2023-11-03 14:49:21 +01:00
cross-build.nix move all nix expressions to pkgs 2022-05-15 08:19:33 +02:00
lint.nix move all nix expressions to pkgs 2022-05-15 08:19:33 +02:00
sops-pgp-hook-test.nix vendorHash: make it overridable 2023-07-15 06:49:20 +00:00
unit-tests.nix no longer use out-dated aliases 2022-09-26 16:28:23 +02:00