Skip to content

Commit

Permalink
Search /usr/share for rpmdb to fix scan on ostree-managed images
Browse files Browse the repository at this point in the history
Fixes: anchore#1755
Co-authored-by: Alex Goodman <alex.goodman@anchore.com>
Signed-off-by: Filip Pytloun <filip@pytloun.cz>
  • Loading branch information
fpytloun and wagoodman committed May 2, 2023
1 parent 995eed9 commit a168f9e
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 1 deletion.
3 changes: 3 additions & 0 deletions syft/pkg/cataloger/rpm/cataloger_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ func Test_DBCataloger_Globs(t *testing.T) {
name: "obtain DB files",
fixture: "test-fixtures/glob-paths",
expected: []string{
"usr/share/rpm/Packages",
"usr/share/rpm/Packages.db",
"usr/share/rpm/rpmdb.sqlite",
"var/lib/rpm/Packages",
"var/lib/rpm/Packages.db",
"var/lib/rpm/rpmdb.sqlite",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
bogus
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
bogus
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
bogus
4 changes: 3 additions & 1 deletion syft/pkg/rpm_metadata.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@ import (
"github.com/anchore/syft/syft/file"
)

// /var/lib/rpm/... is the typical path for most distributions
// /usr/share/rpm/... is common for rpm-ostree distributions (coreos-like)
// Packages is the legacy Berkely db based format
// Packages.db is the "ndb" format used in SUSE
// rpmdb.sqlite is the sqlite format used in fedora + derivates
const RpmDBGlob = "**/var/lib/rpm/{Packages,Packages.db,rpmdb.sqlite}"
const RpmDBGlob = "**/{var/lib,usr/share}/rpm/{Packages,Packages.db,rpmdb.sqlite}"

// Used in CBL-Mariner distroless images
const RpmManifestGlob = "**/var/lib/rpmmanifest/container-manifest-2"
Expand Down

0 comments on commit a168f9e

Please sign in to comment.