Skip to content

Commit ac1c210

Browse files
daghackdvdksn
andauthored
Update frontend/dockerfile/docs/rules/secrets-used-in-arg-or-env.md
Co-authored-by: David Karlsson <[email protected]> Signed-off-by: Talon James Bowler <[email protected]>
1 parent 14e2cab commit ac1c210

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

frontend/dockerfile/docs/rules/secrets-used-in-arg-or-env.md

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,17 @@ Potentially sensitive data should not be used in the ARG or ENV commands
1313

1414
## Description
1515

16-
While it is common in many local development setups to pass secrets to running
17-
processes through environment variables, setting these within a Dockerfile via
18-
the `ENV` command means that these secrets will be committed to the build
19-
history of the resulting image, exposing the secret. For the same reasons,
20-
passing secrets in as build arguments, via the `ARG` command, will similarly
21-
expose the secret. This rule reports violations where `ENV` and `ARG` key names
22-
appear to be secret-related.
16+
While it is common to pass secrets to running processes
17+
through environment variables during local development,
18+
setting secrets in a Dockerfile using `ENV` or `ARG`
19+
is insecure because they persist in the final image.
20+
This rule reports violations where `ENV` and `ARG` keys
21+
indicate that they contain sensitive data.
22+
23+
Instead of `ARG` or `ENV`, you should use secret mounts,
24+
which expose secrets to your builds in a secure manner,
25+
and do not persist in the final image or its metadata.
26+
See [Build secrets](https://docs.docker.com/build/building/secrets/).
2327

2428
## Examples
2529

0 commit comments

Comments
 (0)