As the industry attempts to move security futher to the left, it becomes increasingly important to link built and pushed container images to their origin; ideally via Git metadata. This enables numerous use cases for tools along the software supply chain. Here are just a few examples:
- Inform contributors about updates to base images via workflows on GitHub
- Trace images that get deployed to production to their Git source
- Remediate CVEs by sending PRs to GitHub repositories updating
apt-get install etc lines
We are aware that there is currently a lot of great work underway to securly and verifiably attach such provenance information to container images via signed attestations. Additionally similar provenance data is recorded when using remote Git contexts with buildx/buildkit. This work is still very early.
Ideally we would have a very pragmatic solution that could work today without requiring users of docker build to every build.
Therefore, we'd like to propose that buildx starts to record the following pieces of provenance when being run with a context that has a .git directory:
- Git commit SHA of current checked out HEAD
- Include flag to indicate state of local clone (dirty)
- Dockerfile path
From a privacy perspective we believe that storing Git commit SHAs shouldn't represent a concern given what we see other tools doing (eg. go build storing very similar information without requiring opt-in) and images from private repositories can be pushed to private registries.
We propose to store this information in image labels following the naming conventions set out by https://specs.opencontainers.org/image-spec/annotations/ accepting the way label inheritance can complicate things. This convention is already widely adopted by vendors and projects:
Initially, we'd want to make storing the Git information by buildx opt-in via an environment variable switch.
There's a POC with the suggested changes at: cdupuis@cb8253f
Before raising a pull request with the proposed additions, we'd wanted to raise this issue for community feedback.
As the industry attempts to move security futher to the left, it becomes increasingly important to link built and pushed container images to their origin; ideally via Git metadata. This enables numerous use cases for tools along the software supply chain. Here are just a few examples:
apt-get installetc linesWe are aware that there is currently a lot of great work underway to securly and verifiably attach such provenance information to container images via signed attestations. Additionally similar provenance data is recorded when using remote Git contexts with buildx/buildkit. This work is still very early.
Ideally we would have a very pragmatic solution that could work today without requiring users of
docker buildto every build.Therefore, we'd like to propose that buildx starts to record the following pieces of provenance when being run with a context that has a
.gitdirectory:From a privacy perspective we believe that storing Git commit SHAs shouldn't represent a concern given what we see other tools doing (eg.
go buildstoring very similar information without requiring opt-in) and images from private repositories can be pushed to private registries.We propose to store this information in image labels following the naming conventions set out by https://specs.opencontainers.org/image-spec/annotations/ accepting the way label inheritance can complicate things. This convention is already widely adopted by vendors and projects:
Initially, we'd want to make storing the Git information by buildx opt-in via an environment variable switch.
There's a POC with the suggested changes at: cdupuis@cb8253f
Before raising a pull request with the proposed additions, we'd wanted to raise this issue for community feedback.