Skip to content

fix(relationship): favor real paths over symlinks for ownership by file #3923

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 4 commits into from
May 23, 2025

Conversation

luhring
Copy link
Contributor

@luhring luhring commented May 20, 2025

Description

This adjusts the way "ownership by file" relationships are formed, by preventing the scenario where a symlinked path can cause two packages to "own" the same package (one via the real path, and the other via the symlink). Now, when we're about to form a relationship via a symlink, we first check to see if there's a non-symlink ownership that exists, which should prevent the symlink-based relationship from being created.

Type of change

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

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

luhring added 2 commits May 20, 2025 15:08
…mlinks

Signed-off-by: Dan Luhring <dluhring@chainguard.dev>
Signed-off-by: Dan Luhring <dluhring@chainguard.dev>
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, thanks @luhring! 👍

@kzantow kzantow merged commit bbf3bb5 into anchore:main May 23, 2025
12 checks passed
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.

Syft incorrectly reports multiple APKs as parents of symlinked files
2 participants