Skip to content
This repository has been archived by the owner on Oct 14, 2020. It is now read-only.

fix(aqua-csp): Write report without vulnerability items #9

Merged

Conversation

danielpacak
Copy link
Contributor

The Vulnerability CRD has schema validation which does not
allow persising null vulnerability items. It has to be an
empty array.

Signed-off-by: Daniel Pacak [email protected]

The Vulnerability CRD has schema validation which does not
allow persising null vulnerability items. It has to be an
empty array.

Signed-off-by: Daniel Pacak <[email protected]>
@codecov
Copy link

codecov bot commented Jul 6, 2020

Codecov Report

❗ No coverage uploaded for pull request base (master@a22ba3d). Click here to learn what that means.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##             master       #9   +/-   ##
=========================================
  Coverage          ?   29.54%           
=========================================
  Files             ?        2           
  Lines             ?      176           
  Branches          ?        0           
=========================================
  Hits              ?       52           
  Misses            ?      123           
  Partials          ?        1           
Impacted Files Coverage Δ
pkg/scanner/vulnerability/aqua/converter.go 78.78% <100.00%> (ø)
pkg/scanner/vulnerability/aqua/scanner.go 0.00% <0.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a22ba3d...da32262. Read the comment docs.

@danielpacak danielpacak requested a review from lizrice July 6, 2020 12:07
Copy link
Contributor

@lizrice lizrice left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm! two little comments for your consideration

@@ -33,7 +33,7 @@ func (c *converter) Convert(in io.Reader) (starboard.VulnerabilityReport, error)
}

func (c *converter) convert(aquaReport ScanReport) (starboardReport starboard.VulnerabilityReport) {
var items []starboard.VulnerabilityItem
items := make([]starboard.VulnerabilityItem, 0)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit (which you are welcome to ignore!) - personally I marginally prefer simple declaration rather than zero-length make for slices, because it's one fewer allocation. That is absolutely negligible here so really not important!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. I agree. I did that only for the side effect of JSON encoder, i.e. to serialize vulnerabilities property to [] instead of null. Otherwise OpenAPI schema validation that we have for vulnerabilities.aquasecurity.github.io would fail.

name string

expectedReport v1alpha1.VulnerabilityReport
}{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible to get a report with some resources, but no vulnerabilities for those resources?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe it's not possible because we do not pass the --full-output flag to the scannercli scan command. However, we do ignore Negligible vulnerabilities, because we do not have such qualitative severity in the vulnerabilities CRD.

@danielpacak danielpacak merged commit 9c69ffd into master Jul 9, 2020
@danielpacak danielpacak deleted the fix_convert_empty_aqua_csp_vulnerability_report branch July 9, 2020 13:21
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants