Skip to content

Commit

Permalink
Add support for CVE labels and values
Browse files Browse the repository at this point in the history
  • Loading branch information
janos committed Jul 31, 2020
1 parent 0d42664 commit 86df9e3
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 5 deletions.
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ require (
github.com/spf13/cobra v1.0.0
github.com/spf13/viper v1.7.0
github.com/ssor/bom v0.0.0-20170718123548-6386211fdfcf // indirect
golang.org/x/crypto v0.0.0-20200709230013-948cd5f35899
golang.org/x/crypto v0.0.0-20200728195943-123391ffb6de
jaytaylor.com/html2text v0.0.0-20200412013138-3577fbdbcff7
newreleases.io/newreleases v1.4.0
newreleases.io/newreleases v1.5.1
)
4 changes: 4 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,8 @@ golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8U
golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20200709230013-948cd5f35899 h1:DZhuSZLsGlFL4CmhA8BcRA0mnthyA/nZ00AqCUo7vHg=
golang.org/x/crypto v0.0.0-20200709230013-948cd5f35899/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20200728195943-123391ffb6de h1:ikNHVSjEfnvz6sxdSPCaPt572qowuyMDMJLLm3Db3ig=
golang.org/x/crypto v0.0.0-20200728195943-123391ffb6de/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8=
Expand Down Expand Up @@ -333,4 +335,6 @@ jaytaylor.com/html2text v0.0.0-20200412013138-3577fbdbcff7 h1:mub0MmFLOn8XLikZOA
jaytaylor.com/html2text v0.0.0-20200412013138-3577fbdbcff7/go.mod h1:OxvTsCwKosqQ1q7B+8FwXqg4rKZ/UG9dUW+g/VL2xH4=
newreleases.io/newreleases v1.4.0 h1:rUTHJT15P6sasUBABKpblECTuP8++xAVruoPHs+Fzto=
newreleases.io/newreleases v1.4.0/go.mod h1:IFoaLRTd4ZNVIEIZflkjRt+0Z4BOgivteiLGs9vPobw=
newreleases.io/newreleases v1.5.1 h1:PLX8wmjxxj0ZyKkPdqtddT8krKoNy5SM4OOwdNP9x7E=
newreleases.io/newreleases v1.5.1/go.mod h1:IFoaLRTd4ZNVIEIZflkjRt+0Z4BOgivteiLGs9vPobw=
rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8=
7 changes: 5 additions & 2 deletions newreleases/cmd/release.go
Original file line number Diff line number Diff line change
Expand Up @@ -199,9 +199,9 @@ type releasesService interface {

func printReleasesTable(cmd *cobra.Command, releases []newreleases.Release) {
table := newTable(cmd.OutOrStdout())
table.SetHeader([]string{"Version", "Date", "Pre-Release", "Has Note", "Updated", "Excluded"})
table.SetHeader([]string{"Version", "Date", "Pre-Release", "Has Note", "Updated", "Excluded", "CVE"})
for _, r := range releases {
table.Append([]string{r.Version, r.Date.Local().String(), yesNo(r.IsPrerelease), yesNo(r.HasNote), yesNo(r.IsUpdated), yesNo(r.IsExcluded)})
table.Append([]string{r.Version, r.Date.Local().String(), yesNo(r.IsPrerelease), yesNo(r.HasNote), yesNo(r.IsUpdated), yesNo(r.IsExcluded), yesNo(len(r.CVE) > 0)})
}
table.Render()
}
Expand All @@ -223,6 +223,9 @@ func printRelease(cmd *cobra.Command, r *newreleases.Release) {
if r.IsExcluded {
table.Append([]string{"Excluded:", "yes"})
}
if len(r.CVE) > 0 {
table.Append([]string{"CVE:", strings.Join(r.CVE, ", ")})
}
table.Render()
}

Expand Down
2 changes: 1 addition & 1 deletion newreleases/cmd/release_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ func TestReleaseCmd_List(t *testing.T) {
}, nil, 1, nil),
wantOutputFunc: func() string {
dateHeaderSep := strings.Repeat(" ", len(newTime(t, "2019-10-22T01:45:55Z").Local().String())-1)
return fmt.Sprintf("VERSION DATE%sPRE-RELEASE HAS NOTE UPDATED EXCLUDED \nv1.25.0 %s no no no no \nv1.21.6 %s yes no no no \nv1.21.5 %s no yes no no \nv1.20.0 %s no no yes no \nv1.18.88 %s no no no yes \n",
return fmt.Sprintf("VERSION DATE%sPRE-RELEASE HAS NOTE UPDATED EXCLUDED CVE \nv1.25.0 %s no no no no no \nv1.21.6 %s yes no no no no \nv1.21.5 %s no yes no no no \nv1.20.0 %s no no yes no no \nv1.18.88 %s no no no yes no \n",
dateHeaderSep,
newTime(t, "2019-10-22T01:45:55Z").Local(),
newTime(t, "2019-09-21T11:25:00Z").Local(),
Expand Down

0 comments on commit 86df9e3

Please sign in to comment.