Skip to content

Commit 19f2104

Browse files
fix: epss and kev file nil pointer bug
1 parent c3d7d17 commit 19f2104

File tree

3 files changed

+11
-8
lines changed

3 files changed

+11
-8
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [UNRELEASED]
99

10+
## [0.7.4] - 2024-06-18
11+
1012
### Fixed
1113

1214
- Missing `slog.Error` for KEV validations
1315
- Use base EPSS url instead of a specific date to get the latest data
16+
- Use a *os.File for kev and epss validation to simplify CLI runtime logic
1417

1518
## [0.7.0] - 2024-05-17
1619

cmd/validate.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,14 +52,13 @@ var validateCmd = &cobra.Command{
5252
return nil
5353
},
5454
RunE: func(cmd *cobra.Command, args []string) error {
55-
5655
err := gatecheck.Validate(
5756
RuntimeConfig.gatecheckConfig,
5857
RuntimeConfig.targetFile,
5958
args[0],
6059
gatecheck.WithEPSSURL(RuntimeConfig.EPSSURL.Value().(string)),
6160
gatecheck.WithKEVURL(RuntimeConfig.KEVURL.Value().(string)),
62-
gatecheck.WithEPSSFile(RuntimeConfig.epssFile),
61+
gatecheck.WithEPSSFile(RuntimeConfig.epssFile), // TODO: fix this
6362
gatecheck.WithKEVFile(RuntimeConfig.kevFile),
6463
)
6564

pkg/gatecheck/download.go

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package gatecheck
33
import (
44
"io"
55
"net/http"
6+
"os"
67

78
"github.com/gatecheckdev/gatecheck/pkg/epss"
89
"github.com/gatecheckdev/gatecheck/pkg/kev"
@@ -15,8 +16,8 @@ type fetchOptions struct {
1516
kevClient *http.Client
1617
kevURL string
1718

18-
epssFile io.Reader
19-
kevFile io.Reader
19+
epssFile *os.File
20+
kevFile *os.File
2021
}
2122

2223
func defaultOptions() *fetchOptions {
@@ -56,15 +57,15 @@ func WithKEVURL(url string) optionFunc {
5657
}
5758
}
5859

59-
func WithEPSSFile(r io.Reader) optionFunc {
60+
func WithEPSSFile(epssFile *os.File) optionFunc {
6061
return func(o *fetchOptions) {
61-
o.epssFile = r
62+
o.epssFile = epssFile
6263
}
6364
}
6465

65-
func WithKEVFile(r io.Reader) optionFunc {
66+
func WithKEVFile(kevFile *os.File) optionFunc {
6667
return func(o *fetchOptions) {
67-
o.kevFile = r
68+
o.kevFile = kevFile
6869
}
6970
}
7071

0 commit comments

Comments
 (0)