From f2ff19dc81fff3fc42ce930f20b77165e9757db4 Mon Sep 17 00:00:00 2001 From: Ryan Mulligan Date: Sat, 2 Apr 2022 15:10:25 -0700 Subject: [PATCH] doc: add readFile anti-pattern --- README.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/README.md b/README.md index cfddee4..cabf531 100644 --- a/README.md +++ b/README.md @@ -304,6 +304,18 @@ authentication code (MAC) like other implementations like GPG or [sops](https://github.com/Mic92/sops-nix) have, however this was left out for simplicity in `age`. +### builtins.readFile anti-pattern + +```nix +{ + # Do not do this! + config.password = builtins.readFile config.age.secrets.secret1.path; +} +``` + +This can cause the cleartext to be placed into the world-readable Nix +store. Instead, have your services read the cleartext path at runtime. + ## Acknowledgements This project is based off of [sops-nix](https://github.com/Mic92/sops-nix) created Mic92. Thank you to Mic92 for inspiration and advice.