[Bug] P2P preheat fails to distribute manifest list children after a vulnerability scan because they are untagged
Expected behavior and actual behavior: Expected behavior: When an "Image scanned" event triggers a P2P preheat policy on a multi-arch image (manifest list), the actual runnable images (the child artifacts for different architectures) should be successfully distributed to the P2P engines (like Dragonfly or Kraken) regardless of whether they have their own tags, since they inherit the tag of the manifest list.
Actual behavior: The child artifacts of a manifest list are not preheated after a scan. They fail the preheat tag filter (e.g., **) because child artifacts are inherently untagged.
This known flaw is explicitly identified in src/controller/event/handler/p2p/preheat.go inside the handleImageScanned function (Lines 91-94):
func (p *Handler) handleImageScanned(ctx context.Context, event *event.ScanImageEvent) error {
// TODO: If the scan is targeting an manifest list, here the artifacts we get are all the children
// artifacts of the manifest list. The children artifacts are high probably untagged ones that
// will be definitely ignored by the tag filter. We need to find a way to resolve this issue.
log.Debugf("preheat: image scanned %s:%s", event.Artifact.Repository, event.Artifact.Tag)
// ...Because the preheat enforcer's tag filter rejects untagged artifacts, the children of the manifest list are ignored and dropped from the preheat execution queue.
Steps to reproduce the problem:
- Configure a P2P preheat provider (e.g., Dragonfly) in Harbor.
- Create a P2P preheat policy in a project with the event trigger set to "Image scanned" and a tag filter configured (e.g.,
**). - Push a multi-arch image (manifest list) to the project.
- Trigger a vulnerability scan on the manifest list (or have it scan automatically on push).
- Wait for the vulnerability scan to complete.
- Observe the P2P preheat executions for the project. The preheat task will not be dispatched for the manifest list's underlying architecture images (the children artifacts) because the tag filter evaluates them as untagged, defeating the preheat mechanism for multi-arch deployments.
Versions: Please specify the versions of following systems.
- harbor version: [main/master branch]
- docker engine version: [N/A]
- docker-compose version: [N/A]
Additional context:
- Harbor config files: You can get them by packaging
harbor.ymland files in the same directory, including subdirectory. - Log files: You can get them by package the
/var/log/harbor/.
Proposed Solution: When evaluating preheat policies for an untagged artifact triggered by a scan event, the system should resolve the parent manifest list and evaluate the policy against the parent's tags. Alternatively, when an image index is scanned, trigger the preheat execution for the parent manifest list directly so that the enforcer distributes the entire multi-arch structure rather than incorrectly filtering out its untagged children.
Source: goharbor/harbor