Skip to content
Merged
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
25 changes: 15 additions & 10 deletions pkg/flow/spsOption.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,25 +84,30 @@ func (o SpsOption) Run(ctx context.Context) error {
return nil, nil, err
}

switch copa.SupportedOS(string(r.Metadata.OS.Family)) {
case true:
if r.Metadata.OS == nil {
// Distroless/scratch images report no OS; nothing Copa can patch.
slog.Warn("Image has no detected OS (likely distroless/scratch). The image will not be patched.",
slog.String("image", ref),
)
push = append(push, i)
} else if !copa.SupportedOS(string(r.Metadata.OS.Family)) {
slog.Warn("Image contains an unsupported OS. The image will not be patched.",
slog.String("image", ref),
slog.String("os", string(r.Metadata.OS.Family)),
)
push = append(push, i)
} else {
// filter images with no os-pkgs as copa has nothing to do
switch trivy.ContainsOsPkgs(r.Results) {
case true:
if trivy.ContainsOsPkgs(r.Results) {
slog.Debug("Image does contain os-pkgs vulnerabilities",
slog.String("image", ref))
patch = append(patch, i)
case false:
} else {
slog.Warn("Image does not contain os-pkgs. The image will not be patched.",
slog.String("image", ref),
)
push = append(push, i)
}
case false:
slog.Warn("Image contains an unsupported OS. The image will not be patched.",
slog.String("image", ref),
)
push = append(push, i)
}

// Write report to filesystem
Expand Down
Loading