5.4.1 Prefer using secrets as files over secrets as environment variables

Information

Kubernetes supports mounting secrets as data volumes or as environment variables. Minimize the use of environment variable secrets.

It is reasonably common for application code to log out its environment (particularly in the event of an error). This will include any secret values passed in as environment variables, so secrets can easily be exposed to any user or entity who has access to the logs.

NOTE: Nessus has not performed this check. Please review the benchmark to ensure target compliance.

Solution

If possible, rewrite application code to read secrets from mounted secret files, rather than from environment variables.

Impact:

Application code which expects to read secrets in the form of environment variables would need modification

See Also

https://workbench.cisecurity.org/benchmarks/17568

Item Details

Category: CONFIGURATION MANAGEMENT

References: 800-53|CM-6b.

Plugin: Unix

Control ID: b0cbf29971289fb3b764947e526429859c34f3fc3c065e1b382a29e753647d9d