R295 Pass a credential to a program only through the environment, a file or the secret manager’s injection

On by default

Let a credential’s value reach a program only through an environment variable, a file or a way the secret manager itself provides of injecting it into the program.

Reason

A credential is protected strictly and kept from leaking (Art. II §1). A command line can be seen by other processes on the machine and is kept in shell history and logs, so a value passed as an argument leaks. A secret manager’s own injection hands the value over through the environment or a file as well, and keeps it out of shell variables and command lines on the way.

Verification

A secret manager’s own injection is a command or integration it provides that puts the value in the environment of the program it starts or in a file, never on that program’s command line, such as 1Password’s op run, which resolves the secret references and starts the program with their values in its environment variables. op run itself passes the value through the environment, so it does not conflict with passing it by an environment variable; what it adds is that the value never sits in a shell variable or on a command line.

Splitting, trimming or otherwise changing the value happens inside the program that uses it, not in the shell. Keeping the value out of every message, log and output is rule 291.

Violated when a credential’s value reaches a program by any route other than an environment variable, a file or the secret manager’s own injection, such as a command-line argument, whichever program puts it there, or is split or trimmed in the shell.

Provisions of the constitution it cites

Relations

Parent
R265 Credentials
Requires
none
Conflicts with
none

Metadata

ID
295
Revision
2
Kind
rule
Status
active
Slug
credential-value-route-injection
Default level
project
Constitution revisions
>=1
Check
none
Default
on
Uses
Instructions instructions
Original language
English en
Translations
Chinese zh