Skip to content

Commit f5e0d24

Browse files
committed
docs(build-secret-leaks): document ad-hoc debug-build leak vector
A /retro session found a distinct leak mechanism from the provenance one this file already covers: `docker build --progress=plain` (or any verbose/raw build log) echoes literal RUN command lines with ARG/ENV already interpolated. Running such a debug build and piping/tailing the output puts a credential-bearing build arg in cleartext directly into whatever is capturing the session (chat transcript, CI log, terminal recording) — even when the project's real Dockerfile already uses --mount=type=secret correctly, because the leak comes from an ad-hoc invocation outside that path. Adds a short section covering the mechanism and the same rotate-first-then-cleanup response as the existing provenance case. Signed-off-by: Axel Seemann <axel.seemann@netresearch.de>
1 parent 8e236b8 commit f5e0d24

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

skills/docker-development/references/build-secret-leaks.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,3 +61,23 @@ rather than fail.
6161
Rotation is the only remedy that acts on what is already published — the
6262
attestations of existing versions keep their copy of the value forever, or until
6363
someone deletes those package versions. Rotate first, fix the build second.
64+
65+
## The other leak: your own debugging session
66+
67+
A leak does not need buildx provenance to happen. `docker build --progress=plain`
68+
(or any verbose/raw build log) echoes the literal `RUN` command line with every
69+
`ARG`/`ENV` already interpolated — so a credential-bearing build arg shows up in
70+
cleartext the moment that output reaches a terminal, a piped log file, or a
71+
`tail`. This is a transient leak (nothing gets published), but it lands directly
72+
in whatever you're capturing the session with — chat transcript, screen
73+
recording, CI job log — which is exactly the audience `--mount=type=secret` was
74+
meant to keep it from. It happens even when the project's real Dockerfile is
75+
already fixed with `--mount=type=secret`, because the leak comes from an ad-hoc
76+
debug invocation outside that path, not from the build definition.
77+
78+
Treat it the same as a provenance leak once it happens: rotate the credential
79+
first, then clean up (delete the log file, prune the build cache — the layer
80+
with the interpolated value may still be cached locally even though it was
81+
never pushed). Avoid it by not running debug builds with secret-bearing `ARG`s
82+
through `--progress=plain`/verbose output that you then cat, tail, or pipe
83+
into something you'll read — redact the known secret value first if you must.

0 commit comments

Comments
 (0)