10000 Order locations by container layer order by wagoodman · Pull Request #3858 · anchore/syft · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Order locations by container layer order #3858

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
May 13, 2025
Merged

Conversation

wagoodman
Copy link
Contributor
@wagoodman wagoodman commented May 5, 2025

This adjusts the output of any locations field in the JSON output to always order locations within the same evidence group to have the same layer ordering as seen in the container image.

So for instance, say we have a package with the following locations:

  • /b @ layer 1 [primary evidence]
  • /b @ layer 2 [primary evidence]
  • /c @ layer 1 [supporting evidence]
  • /c @ layer 2 [supporting evidence]
  • /a @ layer 1 [no evidence]

... this would also be the new sorting order.

This is a follow up to #3138 and #3855 so that consumers can now take the locations within each package location listing and be able to reason that earlier primary locations with the same path are overridden with later instances in the list with the same path (users can derive overriding precedence).

This change applies to:

  • package locations (.artifacts[].locations)
  • package license locations (.artifacts.licenses[].locations)
  • files section (.files)

Closes #435

Type of change

  • New feature (non-breaking change which adds functionality)

Checklist

  • I have added unit tests that cover changed behavior
  • I have tested my code in common scenarios and confirmed there are no regressions
  • I have added comments to my code, particularly in hard-to-understand sections

Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>
@wagoodman wagoodman added the enhancement New feature or request label May 5, 2025
Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>
@wagoodman wagoodman enabled auto-merge (squash) May 5, 2025 21:51
@wagoodman wagoodman self-assigned this May 5, 2025
@wagoodman wagoodman added this to OSS May 5, 2025
@wagoodman wagoodman moved this to In Review in OSS May 5, 2025
@wagoodman wagoodman requested a review from a team May 5, 2025 21:51
Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>
wagoodman added 2 commits May 7, 2025 10:10
Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>
Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>
Copy link
Contributor
@kzantow kzantow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🎉

@wagoodman wagoodman merged commit 59b880f into main May 13, 2025
13 checks passed
@wagoodman wagoodman deleted the order-by-layer-locations branch May 13, 2025 04:02
@github-project-automation github-project-automation bot moved this from In Review to Done in OSS May 827F 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Provide a way to get the LayerID the package was first found in
2 participants
0