dotnet / dotnet/docker-tools

Cleanup pipeline can unintentionally mark supported images as EOL

Open
#2,066 0 comments 0 reactions 1 assignee Claimed by @lbussell View on GitHub
area-infrastructure
Dominant language
C#
Stars
181
Forks
67
Avg merge
2d 15h
Merged PRs (30d)
10

Description

The image publishing stage can unintentionally publish EOL lifecycle referrer artifacts to supported images that were indiscriminately added during the cleanup pipeline.

The cleanup pipeline's Annotations job uses `GenerateEolAnnotationDataForAllImagesCommand`, which marks all images in the registry for EOL annotation indiscriminately. It runs against both the Build registry and the Public Mirror registry. This is intended to reduce the number of S360 vulnerability reports that we receive.

- During cleanup pipeline: `GenerateEolAnnotationDataForAllImagesCommand` adds EOL lifecycle referrer artifacts to all images indiscriminately.
- During publish pipeline: `CopyImageService` copies all referrers without filtering by artifact type - `OciArtifactType.Lifecycle` referrers are copied alongside signatures and other artifacts

If the cleanup pipeline runs in-between the build and publish stages of a build pipeline, then images published to MCR (that we intend to be fully supported) would be unintentionally marked as EOL. This can happen for staged releases in the dotnet-docker repo.

There are no known instances of this happening yet.

### Mitigation

- dotnet/docker-tools#2056 disables EOL annotation generation until this is resolved.

### References

- [`CopyImageService.cs` (lines 101-125)](https://github.com/dotnet/docker-tools/blob/7103854dd0f5da9cce160dc094eeab027f79dbc9/src/ImageBuilder/CopyImageService.cs#L101-L125) - unfiltered referrer copy
- [`GenerateEolAnnotationDataForAllImagesCommand.cs`](https://github.com/dotnet/docker-tools/blob/7103854dd0f5da9cce160dc094eeab027f79dbc9/src/ImageBuilder/Commands/GenerateEolAnnotationDataForAllImagesCommand.cs) - indiscriminate EOL marking
- [`GenerateEolAnnotationDataForPublishCommand.cs`](https://github.com/dotnet/docker-tools/blob/7103854dd0f5da9cce160dc094eeab027f79dbc9/src/ImageBuilder/Commands/GenerateEolAnnotationDataForPublishCommand.cs)
- [`cleanup-acr-images.yml` (line 78)](https://github.com/dotnet/docker-tools/blob/7103854dd0f5da9cce160dc094eeab027f79dbc9/eng/pipelines/templates/stages/cleanup-acr-images.yml#L78) - disabled with `condition: false`
- [`publish.yml` (lines 105-119)](https://github.com/dotnet/docker-tools/blob/7103854dd0f5da9cce160dc094eeab027f79dbc9/eng/docker-tools/templates/jobs/publish.yml#L105-L119) - copy step in publish flow

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.