Skip to content

Commit c79884b

Browse files
fl0pp5ipaqsa
andcommitted
feat: add ALT Linux support
Co-Authored-By: stefan <stefan_paksa@icloud.com>
1 parent 5f69937 commit c79884b

File tree

10 files changed

+256
-10
lines changed

10 files changed

+256
-10
lines changed

go.mod

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,14 +96,14 @@ require (
9696
github.com/spf13/cobra v1.8.0
9797
github.com/spf13/pflag v1.0.5
9898
github.com/spf13/viper v1.18.2
99-
github.com/stretchr/testify v1.8.4
99+
github.com/stretchr/testify v1.9.0
100100
github.com/testcontainers/testcontainers-go v0.28.0
101101
github.com/testcontainers/testcontainers-go/modules/localstack v0.26.0
102102
github.com/tetratelabs/wazero v1.7.0
103103
github.com/twitchtv/twirp v8.1.2+incompatible
104104
github.com/xeipuuv/gojsonschema v1.2.0
105105
github.com/xlab/treeprint v1.2.0
106-
go.etcd.io/bbolt v1.3.8
106+
go.etcd.io/bbolt v1.3.9
107107
go.uber.org/zap v1.27.0
108108
golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa
109109
golang.org/x/mod v0.15.0
@@ -366,7 +366,7 @@ require (
366366
github.com/skeema/knownhosts v1.2.1 // indirect
367367
github.com/sourcegraph/conc v0.3.0 // indirect
368368
github.com/spf13/afero v1.11.0 // indirect
369-
github.com/stretchr/objx v0.5.0 // indirect
369+
github.com/stretchr/objx v0.5.2 // indirect
370370
github.com/subosito/gotenv v1.6.0 // indirect
371371
github.com/tchap/go-patricia/v2 v2.3.1 // indirect
372372
github.com/ulikunitz/xz v0.5.11 // indirect
@@ -431,3 +431,5 @@ require (
431431
// testcontainers-go has a bug with versions v0.25.0 and v0.26.0
432432
// ref: https://github.com/testcontainers/testcontainers-go/issues/1782
433433
replace github.com/testcontainers/testcontainers-go => github.com/testcontainers/testcontainers-go v0.23.0
434+
435+
replace github.com/aquasecurity/trivy-db => github.com/altlinux/trivy-db v0.0.0-20240401141737-336f6ffaab21

go.sum

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,8 @@ github.com/alicebob/gopher-json v0.0.0-20200520072559-a9ecdc9d1d3a h1:HbKu58rmZp
308308
github.com/alicebob/gopher-json v0.0.0-20200520072559-a9ecdc9d1d3a/go.mod h1:SGnFV6hVsYE877CKEZ6tDNTjaSXYUk6QqoIK6PrAtcc=
309309
github.com/alicebob/miniredis/v2 v2.31.1 h1:7XAt0uUg3DtwEKW5ZAGa+K7FZV2DdKQo5K/6TTnfX8Y=
310310
github.com/alicebob/miniredis/v2 v2.31.1/go.mod h1:UB/T2Uztp7MlFSDakaX1sTXUv5CASoprx0wulRT6HBg=
311+
github.com/altlinux/trivy-db v0.0.0-20240401141737-336f6ffaab21 h1:ogBUREezeqGdM56cqJAyXPhXaTE4ZQX81k+du9VM150=
312+
github.com/altlinux/trivy-db v0.0.0-20240401141737-336f6ffaab21/go.mod h1:sECIuPk1bXaqGDdoRVRfJCNNrPwIrutIFrfoVy6AVWE=
311313
github.com/anchore/go-struct-converter v0.0.0-20221118182256-c68fdcfa2092 h1:aM1rlcoLz8y5B2r4tTLMiVTrMtpfY0O8EScKJxaSaEc=
312314
github.com/anchore/go-struct-converter v0.0.0-20221118182256-c68fdcfa2092/go.mod h1:rYqSE9HbjzpHTI74vwPvae4ZVYZd1lue2ta6xHPdblA=
313315
github.com/anmitsu/go-shlex v0.0.0-20200514113438-38f4b401e2be h1:9AeTilPcZAjCFIImctFaOjnTIavg87rW78vTPkQqLI8=
@@ -345,8 +347,6 @@ github.com/aquasecurity/tml v0.6.1 h1:y2ZlGSfrhnn7t4ZJ/0rotuH+v5Jgv6BDDO5jB6A9gw
345347
github.com/aquasecurity/tml v0.6.1/go.mod h1:OnYMWY5lvI9ejU7yH9LCberWaaTBW7hBFsITiIMY2yY=
346348
github.com/aquasecurity/trivy-aws v0.8.0 h1:4ij8MiZ2sJUH+vWpSeoGVhPr109ZBcNp7LNLfPuv5Cw=
347349
github.com/aquasecurity/trivy-aws v0.8.0/go.mod h1:Pb9xqOuTKMHVgjsnjvudjqZh3nmzdFqFVfRkXnoIZBM=
348-
github.com/aquasecurity/trivy-db v0.0.0-20231005141211-4fc651f7ac8d h1:fjI9mkoTUAkbGqpzt9nJsO24RAdfG+ZSiLFj0G2jO8c=
349-
github.com/aquasecurity/trivy-db v0.0.0-20231005141211-4fc651f7ac8d/go.mod h1:cj9/QmD9N3OZnKQMp+/DvdV+ym3HyIkd4e+F0ZM3ZGs=
350350
github.com/aquasecurity/trivy-java-db v0.0.0-20240109071736-184bd7481d48 h1:JVgBIuIYbwG+ekC5lUHUpGJboPYiCcxiz06RCtz8neI=
351351
github.com/aquasecurity/trivy-java-db v0.0.0-20240109071736-184bd7481d48/go.mod h1:Ldya37FLi0e/5Cjq2T5Bty7cFkzUDwTcPeQua+2M8i8=
352352
github.com/aquasecurity/trivy-kubernetes v0.6.3 h1:Hmo0pefXRsyVYsii62WUQyt3xMHjm37ipPESeWM/LNA=
@@ -1599,8 +1599,9 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+
15991599
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
16001600
github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE=
16011601
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
1602-
github.com/stretchr/objx v0.5.0 h1:1zr/of2m5FGMsad5YfcqgdqdWrIhu+EBEJRhR1U7z/c=
16031602
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
1603+
github.com/stretchr/objx v0.5.2 h1:xuMeJ0Sdp5ZMRXx/aWO6RZxdr3beISkG5/G/aIRr3pY=
1604+
github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA=
16041605
github.com/stretchr/testify v0.0.0-20180303142811-b89eecf5ca5d/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
16051606
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
16061607
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
@@ -1612,8 +1613,9 @@ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/
16121613
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
16131614
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
16141615
github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
1615-
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
16161616
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
1617+
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
1618+
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
16171619
github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw=
16181620
github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8=
16191621
github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU=
@@ -1699,8 +1701,8 @@ github.com/zclconf/go-cty-yaml v1.0.3/go.mod h1:9YLUH4g7lOhVWqUbctnVlZ5KLpg7JApr
16991701
go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU=
17001702
go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU=
17011703
go.etcd.io/bbolt v1.3.5/go.mod h1:G5EMThwa9y8QZGBClrRx5EY+Yw9kAhnjy3bSjsnlVTQ=
1702-
go.etcd.io/bbolt v1.3.8 h1:xs88BrvEv273UsB79e0hcVrlUWmS0a8upikMFhSyAtA=
1703-
go.etcd.io/bbolt v1.3.8/go.mod h1:N9Mkw9X8x5fupy0IKsmuqVtoGDyxsaDlbk4Rd05IAQw=
1704+
go.etcd.io/bbolt v1.3.9 h1:8x7aARPEXiXbHmtUwAIv7eV2fQFHrLLavdiJ3uzJXoI=
1705+
go.etcd.io/bbolt v1.3.9/go.mod h1:zaO32+Ti0PK1ivdPtgMESzuzL2VPoIG1PCQNvOdo/dE=
17041706
go.etcd.io/etcd v0.5.0-alpha.5.0.20200910180754-dd1b699fc489/go.mod h1:yVHk9ub3CSBatqGNg7GRmsnfLWtoW60w4eDYfh7vHDg=
17051707
go.etcd.io/etcd/api/v3 v3.5.0/go.mod h1:cbVKeC6lCfl7j/8jBhAK6aIYO9XOjdptoxU/nLQcPvs=
17061708
go.etcd.io/etcd/client/pkg/v3 v3.5.0/go.mod h1:IJHfcCEKxYu1Os13ZdwCwIUTUVGYTSAM3YSwc9/Ac1g=

pkg/detector/ospkg/alt/alt.go

Lines changed: 167 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,167 @@
1+
package alt
2+
3+
import (
4+
"context"
5+
"sort"
6+
"strings"
7+
"time"
8+
9+
dbTypes "github.com/aquasecurity/trivy-db/pkg/types"
10+
ustrings "github.com/aquasecurity/trivy-db/pkg/utils/strings"
11+
"github.com/aquasecurity/trivy-db/pkg/vulnsrc/alt"
12+
"github.com/aquasecurity/trivy-db/pkg/vulnsrc/vulnerability"
13+
osver "github.com/aquasecurity/trivy/pkg/detector/ospkg/version"
14+
ftypes "github.com/aquasecurity/trivy/pkg/fanal/types"
15+
"github.com/aquasecurity/trivy/pkg/log"
16+
"github.com/aquasecurity/trivy/pkg/scanner/utils"
17+
"github.com/aquasecurity/trivy/pkg/types"
18+
"github.com/cheggaaa/pb/v3"
19+
version "github.com/knqyf263/go-rpm-version"
20+
"golang.org/x/exp/maps"
21+
"golang.org/x/exp/slices"
22+
"golang.org/x/xerrors"
23+
"k8s.io/utils/clock"
24+
)
25+
26+
var (
27+
eolDates = map[string]time.Time{
28+
"p9": time.Date(2023, 12, 31, 23, 59, 59, 0, time.UTC),
29+
"p10": time.Date(2024, 6, 30, 23, 59, 59, 0, time.UTC),
30+
"c10f1": time.Date(2024, 6, 30, 23, 59, 59, 0, time.UTC),
31+
}
32+
)
33+
34+
type options struct {
35+
clock clock.Clock
36+
}
37+
38+
type option func(*options)
39+
40+
func WithClock(clock clock.Clock) option {
41+
return func(opts *options) {
42+
opts.clock = clock
43+
}
44+
}
45+
46+
// Scanner implements the ALT scanner with ALT` vuln source
47+
type Scanner struct {
48+
vs alt.VulnSrc
49+
*options
50+
}
51+
52+
// NewScanner is the factory method for Scanner
53+
func NewScanner(opts ...option) *Scanner {
54+
o := &options{
55+
clock: clock.RealClock{},
56+
}
57+
58+
for _, opt := range opts {
59+
opt(o)
60+
}
61+
return &Scanner{
62+
vs: alt.NewVulnSrc(),
63+
options: o,
64+
}
65+
}
66+
67+
// IsSupportedVersion checks the OSFamily can be scanned using ALT scanner
68+
func (s *Scanner) IsSupportedVersion(ctx context.Context, osFamily ftypes.OSType, osVer string) bool {
69+
return osver.Supported(ctx, eolDates, osFamily, osVer)
70+
}
71+
72+
func (s *Scanner) Detect(cpe string, _ *ftypes.Repository, pkgs []ftypes.Package) ([]types.DetectedVulnerability, error) {
73+
log.Logger.Info("Detecting ALT vulnerabilities...")
74+
log.Logger.Debugf("ALT: os version: %s", fromCPE(cpe))
75+
log.Logger.Debugf("ALT: the number of packages: %d", len(pkgs))
76+
77+
var vulns []types.DetectedVulnerability
78+
p := pb.New(len(pkgs))
79+
p.Start()
80+
for _, pkg := range pkgs {
81+
detectedVulns, err := s.detect(cpe, pkg)
82+
if err != nil {
83+
return nil, xerrors.Errorf("ALT vulnerability detection error: %w", err)
84+
}
85+
vulns = append(vulns, detectedVulns...)
86+
p.Increment()
87+
}
88+
p.Finish()
89+
return vulns, nil
90+
}
91+
92+
func (s *Scanner) detect(cpe string, pkg ftypes.Package) ([]types.DetectedVulnerability, error) {
93+
advisories, err := s.vs.Get(pkg.Name, cpe)
94+
if err != nil {
95+
return nil, xerrors.Errorf("failed to get ALT advisories: %w", err)
96+
}
97+
98+
installed := utils.FormatVersion(pkg)
99+
installedVersion := version.NewVersion(installed)
100+
101+
uniqVulns := map[string]types.DetectedVulnerability{}
102+
for _, adv := range advisories {
103+
if len(adv.Arches) != 0 && pkg.Arch != "noarch" {
104+
if !slices.Contains(adv.Arches, pkg.Arch) {
105+
continue
106+
}
107+
}
108+
vulnID := adv.VulnerabilityID
109+
vuln := types.DetectedVulnerability{
110+
VulnerabilityID: vulnID,
111+
PkgID: pkg.ID,
112+
PkgName: pkg.Name,
113+
InstalledVersion: utils.FormatVersion(pkg),
114+
PkgIdentifier: pkg.Identifier,
115+
Layer: pkg.Layer,
116+
SeveritySource: vulnerability.ALT,
117+
Vulnerability: dbTypes.Vulnerability{
118+
Severity: adv.Severity.String(),
119+
},
120+
Custom: adv.Custom,
121+
}
122+
123+
if adv.FixedVersion == "" {
124+
if _, ok := uniqVulns[vulnID]; !ok {
125+
uniqVulns[vulnID] = vuln
126+
}
127+
continue
128+
}
129+
130+
fixedVersion := version.NewVersion(adv.FixedVersion)
131+
if installedVersion.LessThan(fixedVersion) {
132+
vuln.VendorIDs = adv.VendorIDs
133+
vuln.FixedVersion = fixedVersion.String()
134+
135+
if v, ok := uniqVulns[vulnID]; ok {
136+
v.VendorIDs = ustrings.Unique(append(v.VendorIDs, vuln.VendorIDs...))
137+
138+
if version.NewVersion(v.FixedVersion).LessThan(fixedVersion) {
139+
v.FixedVersion = vuln.FixedVersion
140+
}
141+
uniqVulns[vulnID] = v
142+
} else {
143+
uniqVulns[vulnID] = vuln
144+
}
145+
}
146+
}
147+
148+
vulns := maps.Values(uniqVulns)
149+
sort.Slice(vulns, func(i, j int) bool {
150+
return vulns[i].VulnerabilityID < vulns[j].VulnerabilityID
151+
})
152+
153+
return vulns, nil
154+
}
155+
156+
func fromCPE(cpe string) string {
157+
if strings.Contains(cpe, "sp") && strings.Contains(cpe, "10") {
158+
return "c10f1"
159+
}
160+
if !strings.Contains(cpe, "sp") && strings.Contains(cpe, "10") {
161+
return "p10"
162+
}
163+
if !strings.Contains(cpe, "sp") && strings.Contains(cpe, "9") {
164+
return "p9"
165+
}
166+
return "undefined"
167+
}

pkg/detector/ospkg/detect.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import (
99

1010
"github.com/aquasecurity/trivy/pkg/detector/ospkg/alma"
1111
"github.com/aquasecurity/trivy/pkg/detector/ospkg/alpine"
12+
"github.com/aquasecurity/trivy/pkg/detector/ospkg/alt"
1213
"github.com/aquasecurity/trivy/pkg/detector/ospkg/amazon"
1314
"github.com/aquasecurity/trivy/pkg/detector/ospkg/chainguard"
1415
"github.com/aquasecurity/trivy/pkg/detector/ospkg/debian"
@@ -33,6 +34,7 @@ var (
3334
ftypes.Alpine: alpine.NewScanner(),
3435
ftypes.Alma: alma.NewScanner(),
3536
ftypes.Amazon: amazon.NewScanner(),
37+
ftypes.ALT: alt.NewScanner(),
3638
ftypes.CBLMariner: mariner.NewScanner(),
3739
ftypes.Debian: debian.NewScanner(),
3840
ftypes.Ubuntu: ubuntu.NewScanner(),

pkg/fanal/analyzer/all/import.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ import (
3636
_ "github.com/aquasecurity/trivy/pkg/fanal/analyzer/language/swift/swift"
3737
_ "github.com/aquasecurity/trivy/pkg/fanal/analyzer/licensing"
3838
_ "github.com/aquasecurity/trivy/pkg/fanal/analyzer/os/alpine"
39+
_ "github.com/aquasecurity/trivy/pkg/fanal/analyzer/os/alt"
3940
_ "github.com/aquasecurity/trivy/pkg/fanal/analyzer/os/amazonlinux"
4041
_ "github.com/aquasecurity/trivy/pkg/fanal/analyzer/os/debian"
4142
_ "github.com/aquasecurity/trivy/pkg/fanal/analyzer/os/mariner"

pkg/fanal/analyzer/const.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ const (
1313
TypeOSRelease Type = "os-release"
1414
TypeAlpine Type = "alpine"
1515
TypeAmazon Type = "amazon"
16+
TypeALT Type = "alt"
1617
TypeCBLMariner Type = "cbl-mariner"
1718
TypeDebian Type = "debian"
1819
TypePhoton Type = "photon"

pkg/fanal/analyzer/os/alt/alt.go

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
package alt
2+
3+
import (
4+
"bufio"
5+
"context"
6+
"os"
7+
"strings"
8+
9+
"github.com/aquasecurity/trivy/pkg/fanal/analyzer"
10+
fos "github.com/aquasecurity/trivy/pkg/fanal/analyzer/os"
11+
"github.com/aquasecurity/trivy/pkg/fanal/types"
12+
"golang.org/x/exp/slices"
13+
"golang.org/x/xerrors"
14+
)
15+
16+
func init() {
17+
analyzer.RegisterAnalyzer(&altOSAnalyzer{})
18+
}
19+
20+
const altAnalyzerVersion = 1
21+
22+
var requiredFiles = []string{"etc/os-release"}
23+
24+
type altOSAnalyzer struct{}
25+
26+
func (a altOSAnalyzer) Analyze(_ context.Context, input analyzer.AnalysisInput) (*analyzer.AnalysisResult, error) {
27+
scanner := bufio.NewScanner(input.Content)
28+
var cpe string
29+
for scanner.Scan() {
30+
line := scanner.Text()
31+
ss := strings.SplitN(line, "=", 2)
32+
if len(ss) != 2 {
33+
continue
34+
}
35+
key, value := strings.TrimSpace(ss[0]), strings.TrimSpace(ss[1])
36+
37+
switch key {
38+
case "ID":
39+
id := strings.Trim(value, `"'`)
40+
if !strings.Contains(id, "altlinux") {
41+
return nil, nil
42+
}
43+
continue
44+
case "CPE_NAME":
45+
cpe = strings.Trim(value, `"'`)
46+
default:
47+
continue
48+
}
49+
return &analyzer.AnalysisResult{
50+
OS: types.OS{Family: types.ALT, Name: cpe},
51+
}, nil
52+
}
53+
return nil, xerrors.Errorf("alt: %w", fos.AnalyzeOSError)
54+
}
55+
56+
func (a altOSAnalyzer) Required(filePath string, _ os.FileInfo) bool {
57+
return slices.Contains(requiredFiles, filePath)
58+
}
59+
60+
func (a altOSAnalyzer) Type() analyzer.Type {
61+
return analyzer.TypeALT
62+
}
63+
64+
func (a altOSAnalyzer) Version() int {
65+
return altAnalyzerVersion
66+
}

pkg/fanal/types/const.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ const (
2424
Alma OSType = "alma"
2525
Alpine OSType = "alpine"
2626
Amazon OSType = "amazon"
27+
ALT OSType = "alt"
2728
CBLMariner OSType = "cbl-mariner"
2829
CentOS OSType = "centos"
2930
Chainguard OSType = "chainguard"

pkg/purl/purl.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -458,7 +458,7 @@ func purlType(t ftypes.TargetType) string {
458458
return packageurl.TypeDebian
459459
case ftypes.RedHat, ftypes.CentOS, ftypes.Rocky, ftypes.Alma,
460460
ftypes.Amazon, ftypes.Fedora, ftypes.Oracle, ftypes.OpenSUSE,
461-
ftypes.OpenSUSELeap, ftypes.OpenSUSETumbleweed, ftypes.SLES, ftypes.Photon:
461+
ftypes.OpenSUSELeap, ftypes.OpenSUSETumbleweed, ftypes.SLES, ftypes.Photon, ftypes.ALT:
462462
return packageurl.TypeRPM
463463
case TypeOCI:
464464
return packageurl.TypeOCI

pkg/vulnerability/vulnerability.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,10 @@ func (c Client) getPrimaryURL(vulnID string, refs []string, source dbTypes.Sourc
143143
return "https://github.com/advisories/" + vulnID
144144
case strings.HasPrefix(vulnID, "TEMP-"):
145145
return "https://security-tracker.debian.org/tracker/" + vulnID
146+
case strings.HasPrefix(vulnID, "ALT-"):
147+
return "https://errata.altlinux.org/" + vulnID
148+
case strings.HasPrefix(vulnID, "BDU"):
149+
return "https://bdu.fstec.ru/vul/" + strings.Split(vulnID, ":")[1]
146150
}
147151

148152
prefixes := primaryURLPrefixes[source]

0 commit comments

Comments
 (0)