Failure mode
The load-bearing realization: age gives you confidentiality, not authorship. Because the recipients file is public, anyone can craft ciphertext that decrypts for the whole team — so decrypting a file proves nothing about who wrote it. That gap, plus a path-traversal hole in an early build, drove most of the hardening work.
WHY THIS PROJECT EXISTS
EnvGuardian is an open-source tool I build in the open — CI, a changelog, a
security policy, decision records, and a public roadmap. It is honest about its stage: the README leads with a
warning that it is still in security hardening and should not hold real secrets yet. I would rather ship a tool
that names its own sharp edges than one that hides them, and the point of the project is to get the trust model
exactly right before it gets convenient.
The idea is small enough to state in a sentence: encrypt .env to every developer's
age/SSH
public key, commit the ciphertext, and let a plaintext
recipients file
decide who can read it. Cloning the repo then gives you working config. But the interesting engineering is
entirely in the failure cases, and there were three that mattered.
First, authorship. age proves a file can be decrypted, never who
sealed it — and since the recipients list is public, a malicious contributor can forge ciphertext that
decrypts cleanly for everyone. So every ciphertext carries a
detached SSH signature
that is checked against current recipients before a single byte of plaintext is written. Invalid,
non-recipient, and missing signatures all fail closed.
Second, diff churn. age is randomized, so re-encrypting unchanged content would produce a
brand-new blob every time and bury the team in phantom merge conflicts. Sealing is therefore
idempotent:
it decrypt-compares first and only writes when the content or the recipient set truly changed.
Third, and most sobering, path traversal. An early development tag let a
repository-controlled file mapping write decrypted output outside the repository. The fix confines every
managed path to the repo, resolved through symlinks, before any read or transactional write happens — and
the hole is documented openly in the security policy rather than quietly patched.
WHAT BROKE
The subtle one: a successful decrypt feels like proof the file is trustworthy, but with a public
recipients list it proves nothing about authorship. Treating "it decrypted" as "it's authentic" would let
a malicious contributor slip in forged secrets. The answer was a separate signature layer that fails
closed — confidentiality and authorship are two different guarantees, and age only gives one of them.
QUICKSTART · commit encrypted, clone to decrypt
# repo owner — first-time setup
$ envguardian init # scaffold config, seed your key, update .gitignore
$ envguardian add-recipient --github alice # authorize a teammate by public key
$ envguardian encrypt # .env → .env.age (+ .env.age.sig)
$ git add .envguardian/ .env.age .env.age.sig # commit the PUBLIC, encrypted files — never .env
$ git commit -m "chore: add encrypted env config"
# teammate — after cloning or pulling
$ envguardian decrypt # .env.age → local .env at mode 0600
the full loop. If upstream changed the config, recipients, or ciphertext,
decrypt refuses to silently overwrite your .env; you review the change and accept it
with decrypt --accept-changes. Git hooks, and semantic diff/merge
drivers that report key-level changes without ever printing a value, are installed separately.