Skip to content

fix(image): merge OS data from cached layers#10968

Open
1solomonwakhungu wants to merge 1 commit into
aquasecurity:mainfrom
1solomonwakhungu:fix/issue-9982
Open

fix(image): merge OS data from cached layers#10968
1solomonwakhungu wants to merge 1 commit into
aquasecurity:mainfrom
1solomonwakhungu:fix/issue-9982

Conversation

@1solomonwakhungu

Copy link
Copy Markdown

Description

Image config analysis previously merged OS data only from layers analyzed during the current scan. If a layer was already cached, its OS data was omitted; when several layers were analyzed in parallel, completion order could also affect the merged result.

This change:

  • reads OS information from cached layers whenever the image config needs analysis
  • records parallel layer results by cache key and merges them in image layer order
  • adds a small cache RPC so client/server scans can retrieve only the cached OS record
  • falls back to analyzing a layer if cached OS data cannot be retrieved, preserving compatibility with older cache servers

Related issues

Type of Change

  • Bug fix (non-breaking change which fixes an issue)

Testing

  • GOEXPERIMENT=jsonv2 go test ./...
  • go tool mage test:unit
  • GOEXPERIMENT=jsonv2 go test -race ./pkg/fanal/artifact/image -run TestArtifact_InspectUsesCachedOSInLayerOrder
  • GOEXPERIMENT=jsonv2 golangci-lint run --build-tags=integration --new-from-rev=upstream/main
  • go tool mage protoc:breaking

The regression test forces cached layer lookups to finish out of order and verifies that config analysis still receives the OS produced by image layer order.

Checklist

  • I have read the guidelines for contributing to this repository.
  • I have followed the conventions in the PR title.
  • I have added tests that prove the fix is effective.
  • Documentation is not required because this changes internal cache and image-analysis behavior only.
  • Usage information is not required because this introduces no user-facing options.
  • A before/after UI example is not required because this is not a user interface change.

Closes aquasecurity#9982

Read OS information from every cached image layer before running config
analyzers, and merge parallel results in deterministic layer order. Add a
cache RPC for client/server scans and fall back to layer analysis when cached
OS data cannot be read.

Signed-off-by: Solomon Wakhungu <65043605+1solomonwakhungu@users.noreply.github.com>
@CLAassistant

CLAassistant commented Jul 15, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: during inspectConfig, the OS information obtained from the layers is non-deterministic or missed

2 participants