Skip to content

Commit 05875c9

Browse files
committed
oracle: exclude splice vulnerabilities
Signed-off-by: Brad Lugo <[email protected]>
1 parent 178b694 commit 05875c9

File tree

3 files changed

+330
-106
lines changed

3 files changed

+330
-106
lines changed

oracle/parser.go

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import (
1212
"github.com/quay/claircore"
1313
"github.com/quay/claircore/internal/xmlutil"
1414
"github.com/quay/claircore/libvuln/driver"
15+
"github.com/quay/claircore/pkg/cpe"
1516
"github.com/quay/claircore/pkg/ovalutil"
1617
)
1718

@@ -71,6 +72,32 @@ func (u *Updater) Parse(ctx context.Context, r io.ReadCloser) ([]*claircore.Vuln
7172
if len(vs) == 0 {
7273
return nil, fmt.Errorf("could not determine dist")
7374
}
75+
76+
// Check if the vulnerability only affects a userspace_ksplice package.
77+
// These errata should never be applied to a container since ksplice
78+
// userspace packages are not supported to be run within a container.
79+
// TODO(DO NOT MERGE): Assume no CPEs is not ksplice. Is this a problem
80+
// with the test?
81+
// TODO(DO NOT MERGE): Is this even the right way to go about this?
82+
isOnlyKsplice := len(def.Advisory.AffectedCPEList) > 0
83+
for _, affected := range def.Advisory.AffectedCPEList {
84+
wfn, err := cpe.Unbind(affected)
85+
if err != nil {
86+
// TODO(DO NOT MERGE): Assume unbindable CPE is not a ksplice.
87+
// Is this a problem with the test?
88+
zlog.Warn(ctx).Msg("could not parse CPE")
89+
isOnlyKsplice = false
90+
break
91+
}
92+
if wfn.Attr[cpe.Edition].V != "userspace_ksplice" {
93+
isOnlyKsplice = false
94+
break
95+
}
96+
}
97+
if isOnlyKsplice {
98+
return nil, fmt.Errorf("vuln is userspace_ksplice")
99+
}
100+
74101
return vs, nil
75102
}
76103
vulns, err := ovalutil.RPMDefsToVulns(ctx, &root, protoVulns)

0 commit comments

Comments
 (0)