Conversation
Signed-off-by: Daniel Prohaska <dprohaska@mitre.org>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Syft produces different SBOM results when run on Windows and Linux for the same Linux container image. Duplicate packages exist due to file ownership detection failing. This causes Windows scans to report additional CVEs and fail VEX/backport type supression/fixes.
For the pinned Debian image below, unpatched Windows Syft retains
pkg:generic/bash@5.2.37alongside the Debianbashpackage. Linux Syft reports only the Debian package.Cause and fix
In
syft/pkg/cataloger/debian/package.go,fetchMd5ContentsandfetchConffileContentsusefilepath.Diron image-internal paths such as/var/lib/dpkg/status. On Windows, this produces a directory containing backslashes. Passing that directory throughpath.Joinleaves backslashes in the lookup path, so the image resolver cannot find the corresponding DPKG metadata files (since the Linux paths use forward slashes).The fix is to replace both calls with
path.Dir.This keeps image paths slash-separated on Windows and aligns these lookups with
findDpkgInfoFiles, which already usespath.Dir.There are no new, changed, or removed CLI flags or configuration options.
Reproduce with Syft on Windows
Run native Windows Syft v1.51.1 in PowerShell with the default configuration (WSL and the Syft container do not reproduce this bug).
The command prints the package table and saves the full SBOM.
Look for two
bashrows near the top:syft.exeonPATH, then run:Only the Debian package should remain:
syft version syft scan registry:docker.io/library/debian@sha256:a347fd7510ee31a84387619a492ad6c8eb0af2f2682b916ff3e643eb076f925a \ --platform linux/amd64 \ --output syft-table --output syft-json=linux.syft.json --quietThe saved JSON reports also show the ownership change. The Debian
bashartifact'smetadata.fileslacks/usr/bin/bashbefore the fix and includes it afterward.Validation
Compared Syft v1.51.1 on Windows and Linux with patched commit
8e117383e9e5140fe9d566848625535675291e48on Windows.The patched build used Windows
10.0.22631, Go1.27.0, andCGO_ENABLED=0onamd64and passess all tests.Using the pinned
registry:docker.io/library/debian@sha256:a347fd7510ee31a84387619a492ad6c8eb0af2f2682b916ff3e643eb076f925aDHI image above:bashowns/usr/bin/bashbashis presentThe regression test passed on Windows with the patch (both standard and distroless cases) and fail when unpatched.
Type of change
Checklist
Issue references
Related to anchore/syft#4563. I believe this addresses (at least some of) the difference between Windows/Mac/Linux outputs.
AI Notice
This document includes content generated with the assistance of Codex. All AI-generated content has been reviewed and edited by Daniel Prohaska (dprohaska@mitre.org) to ensure accuracy and compliance with MITRE's generative AI use guidelines.
Copyright