-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add documentation for SecretsUsedInArgOrEnv rule
Signed-off-by: Talon Bowler <[email protected]>
- Loading branch information
Showing
6 changed files
with
70 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
frontend/dockerfile/docs/rules/secrets-used-in-arg-or-env.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
--- | ||
title: SecretsUsedInArgOrEnv | ||
description: Potentially sensitive data should not be used in the ARG or ENV commands | ||
aliases: | ||
- /go/dockerfile/rule/secrets-used-in-arg-or-env/ | ||
--- | ||
|
||
## Output | ||
|
||
```text | ||
Potentially sensitive data should not be used in the ARG or ENV commands | ||
``` | ||
|
||
## Description | ||
|
||
While it is common in many local development setups to pass secrets to running | ||
processes through environment variables, setting these within a Dockerfile via | ||
the `ENV` command means that these secrets will be committed to the build | ||
history of the resulting image, exposing the secret. For the same reasons, | ||
passing secrets in as build arguments, via the `ARG` command, will similarly | ||
expose the secret. This rule reports violations where `ENV` and `ARG` key names | ||
appear to be secret-related. | ||
|
||
## Examples | ||
|
||
❌ Bad: `AWS_SECRET_ACCESS_KEY` is a secret value. | ||
|
||
```dockerfile | ||
FROM scratch | ||
ARG AWS_SECRET_ACCESS_KEY | ||
``` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
## Output | ||
|
||
```text | ||
Potentially sensitive data should not be used in the ARG or ENV commands | ||
``` | ||
|
||
## Description | ||
|
||
While it is common in many local development setups to pass secrets to running | ||
processes through environment variables, setting these within a Dockerfile via | ||
the `ENV` command means that these secrets will be committed to the build | ||
history of the resulting image, exposing the secret. For the same reasons, | ||
passing secrets in as build arguments, via the `ARG` command, will similarly | ||
expose the secret. This rule reports violations where `ENV` and `ARG` key names | ||
appear to be secret-related. | ||
|
||
## Examples | ||
|
||
❌ Bad: `AWS_SECRET_ACCESS_KEY` is a secret value. | ||
|
||
```dockerfile | ||
FROM scratch | ||
ARG AWS_SECRET_ACCESS_KEY | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters