env
agentsecrets env --
agentsecrets env -- <command> [args...]
Injects all secrets configured for the active project environment into a child process at spawn time.
Mandatory Output Masking (Stdout/Stderr Redaction)
The env command provides zero-disk, process-isolated secret injection for runtime applications, database drivers, and local tools. By spawning the target command as an isolated child process with real-time output stream redaction, agentsecrets env ensures secrets never touch disk, never leak to shell history, never expose to other processes, and never print to terminal streams.
To guarantee that credentials cannot be exfiltrated through terminal scrollback, crash reports, or stdout inspection, agentsecrets enforces mandatory real-time stream masking:
- Real-time Redaction: The parent
agentsecretsprocess intercepts the child'sstdoutandstderrstreams, scanning them in real-time. - Pre-computed Variant Protection: The scanner matches not only the raw secret values but also their common encodings and case transformations to prevent simple obfuscation bypasses:
- Case-insensitive matches (Uppercase & Lowercase)
- Base64 (Standard & URL-safe encodings)
- Hex-encoded representations
- URL-query escaped values
- Always Enforced: This security layer is always active. There are no bypass flags (like
--no-mask) to ensure AI agents or malicious scripts cannot turn off the masking.
Note: The actual secret values are still loaded into the child process environment memory, meaning dynamic operations like network API calls proceed normally.
Showcase: Automatic Output Masking
To see output masking in action, suppose you have a secret named TEST_SECRET_MASK with the value SuperSecretKey123 configured in your active development environment.
If you run a command that prints this secret directly, or in any of its common encoded formats, agentsecrets automatically intercepts the output and replaces it with [REDACTED].
1Direct Output Masking
$ agentsecrets env -- sh -c 'echo $TEST_SECRET_MASK' [REDACTED]
2Base64 Encoded Masking
AI agents or rogue scripts might attempt to bypass simple checks by base64-encoding the environment variables. agentsecrets env pre-computes the Base64 representation of your secret values and masks them:
$ agentsecrets env -- sh -c 'echo $TEST_SECRET_MASK | base64' [REDACTED]
3Hex Encoded Masking
Hexadecimal encodings (including common 0x prefixes) are also caught and masked automatically:
$ agentsecrets env -- sh -c 'echo -n $TEST_SECRET_MASK | xxd -p' [REDACTED]
4Case Variation Masking
If the key name itself is accessed with a different case (such as $test_secret_mask instead of $TEST_SECRET_MASK on case-insensitive platforms or configurations), the value is still resolved and masked:
$ agentsecrets env -- sh -c 'echo $test_secret_mask' [REDACTED]