fix: snap cataloger incorrectly identifies snap container as deb package#4500
Merged
kzantow merged 2 commits intoanchore:mainfrom Jan 30, 2026
Merged
fix: snap cataloger incorrectly identifies snap container as deb package#4500kzantow merged 2 commits intoanchore:mainfrom
kzantow merged 2 commits intoanchore:mainfrom
Conversation
The parseSnapYaml function was creating a DebPkg entry from meta/snap.yaml, which describes the snap container itself, not a debian package inside. This caused snaps like emacs (built from source) to incorrectly appear as debian packages in the SBOM output. Changes: - parseSnapYaml now returns an empty package list (snap.yaml is container metadata, not package info) - Actual packages inside snaps are still correctly identified by other parsers (manifest.yaml for primed-stage-packages) and catalogers (binary cataloger for binaries) - Moved readAll() usage to io.ReadAll() in parse_kernel_changelog.go 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]> Signed-off-by: Alan Pope <[email protected]>
kzantow
reviewed
Dec 24, 2025
| // the actual contents (binaries, debs) are cataloged by their respective | ||
| // catalogers (binary cataloger for binaries built from source, and other snap | ||
| // parsers like parse_system_manifest.go for debian packages from primed-stage-packages). | ||
| func parseSnapYaml(_ context.Context, _ file.Resolver, _ *generic.Environment, _ file.LocationReadCloser) ([]pkg.Package, []artifact.Relationship, error) { |
Contributor
There was a problem hiding this comment.
I don't see any reason to keep the function here or the related test, since we are not changing any configurable or API-level behavior, only removing this erroneous portion of the lookup. We might as well just remove the parse function and related things, since it's not exported and the cataloger will continue to function properly with removal, note: you will probably need to update the capabilities.yaml.
Signed-off-by: Christopher Phillips <[email protected]>
spiffcs
added a commit
to patrickpichler/syft
that referenced
this pull request
Jan 30, 2026
* main: (114 commits) fix: lookup alternate scheme on url->licenseID (anchore#4588) chore(deps): bump the go-minor-patch group with 2 updates (anchore#4583) feat: add Qt6 binary detection (anchore#4550) chore(deps): bump the actions-minor-patch group across 1 directory with 2 updates (anchore#4584) fix: snap cataloger incorrectly identifies snap container as deb package (anchore#4500) chore(deps): update tools to latest versions (anchore#4577) fix: update mixed case dependencies in python to be normalized (anchore#4573) chore(deps): update anchore dependencies (anchore#4575) chore(deps): update tools to latest versions (anchore#4570) feat: detect Debian version from /etc/debian_version (anchore#4569) fix: correctly report supporting evidence for binary packages (anchore#4558) chore(deps): bump the actions-minor-patch group across 2 directories with 3 updates (anchore#4568) chore(deps): bump the go-minor-patch group with 6 updates (anchore#4567) chore(deps): update tools to latest versions (anchore#4565) chore(deps): bump github.com/spdx/tools-golang (anchore#4557) ci: enable zizmor to fail PRs (anchore#4556) Chore new slack action (anchore#4553) chore(deps): update anchore dependencies (anchore#4552) chore(deps): update tools to latest versions (anchore#4551) chore(deps): update tools to latest versions (anchore#4545) ... Signed-off-by: Christopher Phillips <[email protected]>
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.
The parseSnapYaml function was creating a DebPkg entry from meta/snap.yaml, which describes the snap container itself, not a debian package inside.
This caused snaps like emacs (built from source) to incorrectly appear as debian packages in the SBOM output.
Changes:
Type of change
Checklist
Issue references
Fixes #4486
🤖 Generated with Claude Code (with the kindly guiding hands of @popey )