Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions extractor/filesystem/os/apk/apk.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ func (e Extractor) Requirements() *plugin.Capabilities { return &plugin.Capabili
func (e Extractor) FileRequired(api filesystem.FileAPI) bool {
// Should match the status file.
if filepath.ToSlash(api.Path()) != "lib/apk/db/installed" &&
filepath.ToSlash(api.Path()) != "var/lib/apk/db/installed" &&
// TODO(b/428271704): Remove once we handle symlinks properly.
filepath.ToSlash(api.Path()) != "usr/lib/apk/db/installed" {
return false
Expand Down
6 changes: 6 additions & 0 deletions extractor/filesystem/os/apk/apk_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,12 @@ func TestFileRequired(t *testing.T) {
wantRequired: true,
wantResultMetric: stats.FileRequiredResultOK,
},
{
name: "installed file in /var",
path: "var/lib/apk/db/installed",
wantRequired: true,
wantResultMetric: stats.FileRequiredResultOK,
},
{
name: "sub file",
path: "lib/apk/db/installed/test",
Expand Down
6 changes: 6 additions & 0 deletions extractor/filesystem/os/ecosystem/ecosystem.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,12 @@ func MakeEcosystem(metadata any) osvecosystem.Parsed {
if version == "" {
return osvecosystem.FromEcosystem(osvschema.EcosystemAlpine)
}
if m.OSID == "alpaquita" {
return osvecosystem.Parsed{Ecosystem: osvschema.EcosystemAlpaquita, Suffix: m.OSVersionID}
}
if m.OSID == "bellsoft-hardened-containers" {
return osvecosystem.Parsed{Ecosystem: osvschema.EcosystemBellSoftHardenedContainers, Suffix: m.OSVersionID}
}
return osvecosystem.Parsed{Ecosystem: osvschema.EcosystemAlpine, Suffix: m.TrimDistroVersion(version)}

case *dpkgmeta.Metadata:
Expand Down
32 changes: 32 additions & 0 deletions extractor/filesystem/os/ecosystem/ecosystem_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,38 @@ func TestMakeEcosystemAPK(t *testing.T) {
metadata: &apkmeta.Metadata{},
want: "Alpine",
},
{
desc: "BellSoft 1st case",
metadata: &apkmeta.Metadata{
OSID: "alpaquita",
OSVersionID: "23",
},
want: "Alpaquita:23",
},
{
desc: "BellSoft 2nd case",
metadata: &apkmeta.Metadata{
OSID: "alpaquita",
OSVersionID: "stream",
},
want: "Alpaquita:stream",
},
{
desc: "BellSoft 3rd case",
metadata: &apkmeta.Metadata{
OSID: "bellsoft-hardened-containers",
OSVersionID: "23",
},
want: "BellSoft Hardened Containers:23",
},
{
desc: "BellSoft 4th case",
metadata: &apkmeta.Metadata{
OSID: "bellsoft-hardened-containers",
OSVersionID: "stream",
},
want: "BellSoft Hardened Containers:stream",
},
}
for _, tt := range tests {
t.Run(tt.desc, func(t *testing.T) {
Expand Down
2 changes: 2 additions & 0 deletions semantic/parse.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ func Parse(str string, ecosystem string) (Version, error) {
return parseAlpineVersion(str)
case "Alpine":
return parseAlpineVersion(str)
case "BellSoft Hardened Containers":
return parseAlpineVersion(str)
case "Bitnami":
return parseSemverVersion(str), nil
case "Bioconductor":
Expand Down
1 change: 1 addition & 0 deletions semantic/parse_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ var ecosystems = []string{
"AlmaLinux",
"Alpaquita",
"Alpine",
"BellSoft Hardened Containers",
"Bioconductor",
"Bitnami",
"Chainguard",
Expand Down