Is dotenvx encryption enough to keep secrets from AI agents?

Encryption protects your values from anyone who has the repo but not the private key. It doesn't stop an agent that runs commands as you, because that agent can usually run dotenvx as you too. Against agents, it's one layer, not the whole answer.

We make fidelius, a different approach to the same problem. dotenvx facts come from its README, changelog and site, checked on October 4, 2026.

How dotenvx works

dotenvx comes from the creator of dotenv. It encrypts each value in your .env with a public key stored in the same file, so anyone can add values but only the private key can read them. You commit the encrypted file, and dotenvx run decrypts it into your app's environment:

$ dotenvx encrypt$ dotenvx run -- npm run dev

Where the private key lives changed recently. Since v2.25.0 (September 14, 2026), development keys are stored by default in your operating system's secret store, the Keychain on a Mac. v2.28.0 added a choice of .env.keys, 1Password, Bitwarden or the paid Armor service. In production you set DOTENV_PRIVATE_KEY. As the site puts it, one private key unlocks all the secrets in an encrypted file.

What encryption protects

  • A leaked repo, a fork or a backup of the code. Without the key, the values are noise.
  • Accidental commits. The encrypted file is meant to be committed.
  • Teammates and CI get the file through git and the key through a separate channel.

What it doesn't, when an agent works in your repo

This part is our reading of how the pieces fit, not a claim from dotenvx. A coding agent runs commands as your user account. If the private key is in .env.keys in the project, the agent can read that file like any other. If it's in your Keychain, the agent can run dotenvx run, dotenvx get or dotenvx decrypt, the same commands the README shows Claude and Codex running. We couldn't find documentation on whether macOS asks for permission on each Keychain access by dotenvx.

Redaction helps with accidental prints, but it's off unless you pass --redact or mark values as redacted in an Envfile, a rules file whose name changed several times in late September before settling on Envfile in v2.32.4. The README notes that matching is exact, so a transformed value isn't caught.

dotenvx's own answer is Armor, which moves the private key off the machine and can require human approval before each decrypt. Once a decrypt is approved, the command still receives the values, but with approval on, nothing decrypts without you saying so. It's a paid service: Member is $5 a month.

Encrypted .env vs no .env

dotenvxfidelius
Values in the repoYes, encryptedNo
Where the decryption key or values liveOS keychain by default, or .env.keys, a password manager, ArmorYour iCloud Keychain
Run a commanddotenvx run -- cmdaccio project cmd
Output redactionWith --redact or an EnvfileWhen Claude Code or Codex runs it, or with FIDELIUS_MASK=1
Agent can get values if it triesYes, once a decrypt is allowed; Armor can require approval for each oneYes
Share with a team through gitYesNo
PlatformsCross-platform, SDKs for 5 languagesmacOS 15 or later
PriceFree, BSD-3-Clause; Armor from $5/moFree for the shared project; Pro $24 once

Read the row about agents carefully: neither tool stops an agent that sets out to get a value. fidelius doesn't either. What fidelius changes is that there's nothing in the project to read, decrypt or commit, and that your agents get instructions to use accio instead of looking for files.

Which to pick

  • You want secrets versioned with your code and shared through git: dotenvx.
  • You want per-decrypt approval for agents: dotenvx with Armor.
  • You work alone on Macs and want no secrets in the project at all: fidelius.