argparse — sensitive info
Invocation of Process Using Visible Sensitive Information in argparse
Do not read secrets directly from command line arguments. When a command
accepts a secret like via a --password argument or --api-key, the argument
value will leak the secret into ps output and shell history. This also
encourages the use of insecure environment variables for secrets.
Example
Example Output
Remediation
Consider accepting sensitive data only from an interactive hidden prompt or via files. A --password-file argument allows a secret to be passed in discreetly, in a wide variety of contexts.
| argparse_add_argument_password.py | |
|---|---|
See also
Info
New in version 0.3.14
Changed in version 0.4.1: --api-key also checked