diff --git a/changes/22492-msrc-fix b/changes/22492-msrc-fix new file mode 100644 index 0000000000..4bd6035faa --- /dev/null +++ b/changes/22492-msrc-fix @@ -0,0 +1 @@ +* Fix MSRC feed pulls (for NVD release builds) in environments where GitHub access is authenticated diff --git a/cmd/msrc/generate.go b/cmd/msrc/generate.go index 8156fbf683..9af759eb2a 100644 --- a/cmd/msrc/generate.go +++ b/cmd/msrc/generate.go @@ -35,13 +35,16 @@ func main() { panicif(err) now := time.Now() - httpC := fleethttp.NewGithubClient() ctx := context.Background() - ghAPI := io.NewGitHubClient(httpC, github.NewClient(httpC).Repositories, wd) - msrcAPI := msrc.NewMSRCClient(httpC, inPath, msrc.MSRCBaseURL) - fmt.Println("Downloading existing bulletins...") + githubHttp := fleethttp.NewGithubClient() + ghAPI := io.NewGitHubClient(githubHttp, github.NewClient(githubHttp).Repositories, wd) + + msrcHttp := fleethttp.NewClient() // don't reuse the GitHub client as it has an OAuth token baked in + msrcAPI := msrc.NewMSRCClient(msrcHttp, inPath, msrc.MSRCBaseURL) + + fmt.Println("Downloading existing MSRC bulletins...") eBulletins, err := ghAPI.MSRCBulletins(ctx) panicif(err) @@ -62,7 +65,7 @@ func main() { panicif(err) } - fmt.Println("Done.") + fmt.Println("Done processing MSRC feed.") } // windowsBulletinGracePeriod returns whether we are within the grace period for a MSRC monthly feed to exist. diff --git a/server/vulnerabilities/msrc/msrc_api.go b/server/vulnerabilities/msrc/msrc_api.go index 14070abdbd..c44f7356d1 100644 --- a/server/vulnerabilities/msrc/msrc_api.go +++ b/server/vulnerabilities/msrc/msrc_api.go @@ -49,7 +49,7 @@ func feedName(date time.Time) string { } func (msrc MSRCClient) getURL(date time.Time) (*url.URL, error) { - return url.Parse(msrc.baseURL + "/cvrf/v2.0/document/" + feedName(date)) + return url.Parse(msrc.baseURL + "/cvrf/v3.0/document/" + feedName(date)) } // GetFeed downloads the MSRC security feed for 'month' and 'year' into 'workDir', returning the