@@ -12,6 +12,7 @@ import (
12
12
"github.com/quay/claircore"
13
13
"github.com/quay/claircore/internal/xmlutil"
14
14
"github.com/quay/claircore/libvuln/driver"
15
+ "github.com/quay/claircore/pkg/cpe"
15
16
"github.com/quay/claircore/pkg/ovalutil"
16
17
)
17
18
@@ -71,6 +72,32 @@ func (u *Updater) Parse(ctx context.Context, r io.ReadCloser) ([]*claircore.Vuln
71
72
if len (vs ) == 0 {
72
73
return nil , fmt .Errorf ("could not determine dist" )
73
74
}
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
+
74
101
return vs , nil
75
102
}
76
103
vulns , err := ovalutil .RPMDefsToVulns (ctx , & root , protoVulns )
0 commit comments