Skip to content

Commit f47d05b

Browse files
committed
feat(detector/vuls2): SUSE by vuls2
1 parent 200111e commit f47d05b

File tree

4 files changed

+25
-13
lines changed

4 files changed

+25
-13
lines changed

detector/detector.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -322,11 +322,11 @@ func Detect(rs []models.ScanResult, dir string) ([]models.ScanResult, error) {
322322
func DetectPkgCves(r *models.ScanResult, ovalCnf config.GovalDictConf, gostCnf config.GostConf, vuls2Conf config.Vuls2Conf, logOpts logging.LogOpts, noProgress bool) error {
323323
if isPkgCvesDetactable(r) {
324324
switch r.Family {
325-
case constant.RedHat, constant.CentOS, constant.Alma, constant.Rocky, constant.Oracle, constant.Alpine:
325+
case constant.RedHat, constant.CentOS, constant.Alma, constant.Rocky, constant.Oracle, constant.Alpine, constant.OpenSUSE, constant.OpenSUSELeap, constant.SUSEEnterpriseServer, constant.SUSEEnterpriseDesktop:
326326
if err := vuls2.Detect(r, vuls2Conf, noProgress); err != nil {
327327
return xerrors.Errorf("Failed to detect CVE with Vuls2: %w", err)
328328
}
329-
case constant.Fedora, constant.Amazon, constant.OpenSUSE, constant.OpenSUSELeap, constant.SUSEEnterpriseServer, constant.SUSEEnterpriseDesktop:
329+
case constant.Fedora, constant.Amazon:
330330
if err := detectPkgsCvesWithOval(ovalCnf, r, logOpts); err != nil {
331331
return xerrors.Errorf("Failed to detect CVE with OVAL: %w", err)
332332
}

detector/vuls2/vuls2.go

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import (
1919
criteriaTypes "github.com/MaineK00n/vuls-data-update/pkg/extract/types/data/detection/condition/criteria"
2020
criterionTypes "github.com/MaineK00n/vuls-data-update/pkg/extract/types/data/detection/condition/criteria/criterion"
2121
vcAffectedRangeTypes "github.com/MaineK00n/vuls-data-update/pkg/extract/types/data/detection/condition/criteria/criterion/versioncriterion/affected/range"
22+
"github.com/MaineK00n/vuls-data-update/pkg/extract/types/data/detection/condition/criteria/criterion/versioncriterion/fixstatus"
2223
vcPackageTypes "github.com/MaineK00n/vuls-data-update/pkg/extract/types/data/detection/condition/criteria/criterion/versioncriterion/package"
2324
segmentTypes "github.com/MaineK00n/vuls-data-update/pkg/extract/types/data/detection/segment"
2425
ecosystemTypes "github.com/MaineK00n/vuls-data-update/pkg/extract/types/data/detection/segment/ecosystem"
@@ -120,8 +121,8 @@ func preConvert(sr *models.ScanResult) scanTypes.ScanResult {
120121
return scanTypes.ScanResult{
121122
JSONVersion: 0,
122123
ServerName: sr.ServerName,
123-
Family: ecosystemTypes.Ecosystem(sr.Family),
124-
Release: sr.Release,
124+
Family: ecosystemTypes.Ecosystem("suse.linux.enterprise.server"), // FIXME
125+
Release: "15", // FIXME
125126

126127
Kernel: scanTypes.Kernel{
127128
Release: sr.RunningKernel.Release,
@@ -466,6 +467,10 @@ func walkCriteria(e ecosystemTypes.Ecosystem, sourceID sourceTypes.SourceID, ca
466467

467468
switch cn.Criterion.Version.Package.Type {
468469
case vcPackageTypes.PackageTypeBinary, vcPackageTypes.PackageTypeSource:
470+
if !cn.Criterion.Version.Vulnerable {
471+
continue
472+
}
473+
469474
rangeType, fixedIn := func() (vcAffectedRangeTypes.RangeType, string) {
470475
if cn.Criterion.Version.Affected == nil {
471476
return vcAffectedRangeTypes.RangeTypeUnknown, ""
@@ -485,10 +490,17 @@ func walkCriteria(e ecosystemTypes.Ecosystem, sourceID sourceTypes.SourceID, ca
485490
if cn.Criterion.Version.FixStatus == nil {
486491
return ""
487492
}
493+
488494
return cn.Criterion.Version.FixStatus.Vendor
489495
}(),
490-
FixedIn: fixedIn,
491-
NotFixedYet: fixedIn == "",
496+
FixedIn: fixedIn,
497+
NotFixedYet: func() bool {
498+
499+
if cn.Criterion.Version.FixStatus == nil {
500+
return true
501+
}
502+
return cn.Criterion.Version.FixStatus.Class != fixstatus.ClassFixed
503+
}(),
492504
},
493505
})
494506
}

go.mod

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ require (
284284
github.com/prometheus/common v0.62.0 // indirect
285285
github.com/prometheus/procfs v0.15.1 // indirect
286286
github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect
287-
github.com/redis/rueidis v1.0.60 // indirect
287+
github.com/redis/rueidis v1.0.61 // indirect
288288
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect
289289
github.com/rivo/uniseg v0.4.7 // indirect
290290
github.com/rubenv/sql-migrate v1.8.0 // indirect
@@ -381,3 +381,7 @@ require (
381381
sigs.k8s.io/structured-merge-diff/v4 v4.6.0 // indirect
382382
sigs.k8s.io/yaml v1.4.0 // indirect
383383
)
384+
385+
replace github.com/MaineK00n/vuls-data-update => ../vuls-data-update
386+
387+
replace github.com/MaineK00n/vuls2 => ../vuls2

go.sum

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -682,10 +682,6 @@ github.com/GoogleCloudPlatform/opentelemetry-operations-go/internal/resourcemapp
682682
github.com/JohnCGriffin/overflow v0.0.0-20211019200055-46fa312c352c/go.mod h1:X0CRv0ky0k6m906ixxpzmDRLvX58TFUKS2eePweuyxk=
683683
github.com/MaineK00n/go-paloalto-version v0.0.0-20250604055825-65738633ae7a h1:/ch5eGOtMXUGrS1uMvV07uWbuKEfMbm/3DeZ0Ctx52U=
684684
github.com/MaineK00n/go-paloalto-version v0.0.0-20250604055825-65738633ae7a/go.mod h1:ELOxzfAd4oAe4niMmoZlSiJwzf1DF+DjNdjsUcuqAR8=
685-
github.com/MaineK00n/vuls-data-update v0.0.0-20250612091020-1510dae2b184 h1:FxvcEbd/aEVKKXQpDbn9dC3GzUfRmLltzMwSS9/QCSA=
686-
github.com/MaineK00n/vuls-data-update v0.0.0-20250612091020-1510dae2b184/go.mod h1:rAOVc7Vw0GX/KPj5I6jl5ObzWe6r0Kw625leCQHT7Uc=
687-
github.com/MaineK00n/vuls2 v0.0.1-alpha.0.20250523010213-9b211cf92398 h1:sI22jqK3ptsn95EQldxgnsKYTRccxzVkFgbwFyNZFMY=
688-
github.com/MaineK00n/vuls2 v0.0.1-alpha.0.20250523010213-9b211cf92398/go.mod h1:5kjwBPbOBPSxBTZz2dOGNbTPGWwawoiYwi4FZRprXl4=
689685
github.com/MakeNowJust/heredoc v1.0.0 h1:cXCdzVdstXyiTqTvfqk9SDHpKNjxuom+DOlyEeQ4pzQ=
690686
github.com/MakeNowJust/heredoc v1.0.0/go.mod h1:mG5amYoWBHf8vpLOuehzbGGw0EHxpZZ6lCpQ4fNJ8LE=
691687
github.com/Masterminds/goutils v1.1.1 h1:5nUrii3FMTL5diU80unEVvNevw1nH4+ZV4DSLVJLSYI=
@@ -1549,8 +1545,8 @@ github.com/redis/go-redis/extra/redisotel/v9 v9.0.5 h1:EfpWLLCyXw8PSM2/XNJLjI3Pb
15491545
github.com/redis/go-redis/extra/redisotel/v9 v9.0.5/go.mod h1:WZjPDy7VNzn77AAfnAfVjZNvfJTYfPetfZk5yoSTLaQ=
15501546
github.com/redis/go-redis/v9 v9.8.0 h1:q3nRvjrlge/6UD7eTu/DSg2uYiU2mCL0G/uzBWqhicI=
15511547
github.com/redis/go-redis/v9 v9.8.0/go.mod h1:huWgSWd8mW6+m0VPhJjSSQ+d6Nh1VICQ6Q5lHuCH/Iw=
1552-
github.com/redis/rueidis v1.0.60 h1:MGZX8uNdw7iyWz22JhjA/9iXzddfCUE/EMK4VxKoKpA=
1553-
github.com/redis/rueidis v1.0.60/go.mod h1:Lkhr2QTgcoYBhxARU7kJRO8SyVlgUuEkcJO1Y8MCluA=
1548+
github.com/redis/rueidis v1.0.61 h1:AkbCMeTyjFSQraGaNYncg3unMCTYGr6Y8WOqGhDOQu4=
1549+
github.com/redis/rueidis v1.0.61/go.mod h1:Lkhr2QTgcoYBhxARU7kJRO8SyVlgUuEkcJO1Y8MCluA=
15541550
github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo=
15551551
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec h1:W09IVJc94icq4NjY3clb7Lk8O1qJ8BdBEF8z0ibU0rE=
15561552
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo=

0 commit comments

Comments
 (0)