Build args with secrets still show in docker history on old images Infrastructure
We passed an npm auth token as a --build-arg for months. We've since moved to BuildKit secrets, but images built during that window are still in our registry and docker history shows the value in plain text. How bad is this in practice, and is rotating the token enough or do we need to delete every affected tag?
@rollback_rae · 9mo ago · 2 replies
Rotate the token first, today, before you touch anything else. Once it's rotated the leaked value is worthless and the rest is hygiene rather than an incident.
Then yes, the value lives in the layer metadata forever for those images. You can't edit history in place, only delete tags and garbage collect. Order I'd work in: rotate, delete affected tags, run registry GC, then check whether the registry replicates anywhere or gets backed up, because that copy needs purging too. Don't spend a day scrubbing images before the rotation is done.
Reply
Report
@static_typing_fan · 9mo ago
Rotated within the hour. GC found 340 affected manifests. The replication target is the thing I would have forgotten, so thank you.
Reply
Report