Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add rule to check for getting sensitive data from environment variable #340

Open
ericwb opened this issue Mar 12, 2024 · 0 comments
Open
Labels
enhancement New feature or request new rule Enhancement request for a new rule

Comments

@ericwb
Copy link
Contributor

ericwb commented Mar 12, 2024

Is your feature request related to a problem? Please describe.
Check calls to os.getenv or os.environ to read sensitive data such as passwords or other secrets from environment variables

Describe the solution you'd like
As described in the CLI standard:

Do not read secrets from environment variables. While environment variables may be convenient for storing secrets, they have proven too prone to leakage:

  • Exported environment variables are sent to every process, and from there can easily leak into logs or be exfiltrated
  • Shell substitutions like curl -H "Authorization: Bearer $BEARER_TOKEN" will leak into globally-readable process state. (cURL offers the -H @filename alternative for reading sensitive headers from a file.)
  • Docker container environment variables can be viewed by anyone with Docker daemon access via docker inspect
  • Environment variables in systemd units are globally readable via systemctl show

Secrets should only be accepted via credential files, pipes, AF_UNIX sockets, secret management services, or another IPC mechanism.

For example:
https://github.com/openai/openai-python?tab=readme-ov-file#async-usage

Describe alternatives you've considered
n/a

Additional context

Love this idea? Give it a 👍. We prioritize fulfilling features with the most 👍.

@ericwb ericwb added enhancement New feature or request new rule Enhancement request for a new rule labels Mar 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request new rule Enhancement request for a new rule
Projects
None yet
Development

No branches or pull requests

1 participant