Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

format: add Issued field to quay output format #193

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
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
4 changes: 4 additions & 0 deletions output/quay.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ package output
import (
"encoding/json"
"strings"
"time"

"github.com/quay/claircore"
)
Expand Down Expand Up @@ -47,6 +48,8 @@ type Vuln struct {
Description string `json:"Description"`
Name string `json:"Name"`
Metadata *Metadata `json:"Metadata"`
// This is a departure from the "spec" but needed for Konflux
Copy link

Choose a reason for hiding this comment

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

what would it be if it were following the spec?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

There is no official spec but the current Quay secscan response does not include an Issued at all.

Issued time.Time `json:"Issued"`
}

type Metadata struct {
Expand Down Expand Up @@ -108,6 +111,7 @@ func ReportToSecScan(vr *claircore.VulnerabilityReport) (*QuayReport, error) {
FixedBy: vuln.FixedInVersion,
Description: vuln.Description,
Name: vuln.Name,
Issued: vuln.Issued,
Metadata: &Metadata{
UpdatedBy: vuln.Updater,
RepoName: vuln.Repo.Name,
Expand Down
6 changes: 5 additions & 1 deletion output/quay_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,11 @@ func TestQuayReport(t *testing.T) {
if totalVulns != tc.numVulns {
t.Fatalf("found %d vulns, wanted %d", totalVulns, tc.numVulns)
}

rep, err := json.MarshalIndent(quayReport, "", " ")
if err != nil {
t.Fatal(err)
}
t.Log(string(rep))
})
}
}