Fix CI: extend grace periods for MSRC feeds and expand test coverage for file validation. (#37991)

1. Root cause: cmd/msrc/generate.go

Problem: The MSRC feed generator panicked when the January 2026 feed
wasn't available. The grace period was only 5 days, but MSRC feed
publication dates vary (not available right now).

  Fix: Extended grace period from 5 to 15 days.

2. Defensive fix:
server/vulnerabilities/macoffice/integration_sync_test.go

Problem: Test only checked for files from the last 2 days, which failed
when the NVD repo hadn't published for a few days.

  Fix: Extended tolerance to 7 days.
This commit is contained in:
Victor Lyuboslavsky
2026-01-07 10:28:20 -06:00
committed by GitHub
parent 3db9a2011e
commit 8ab072f600
2 changed files with 16 additions and 17 deletions
+3 -3
View File
@@ -71,11 +71,11 @@ func main() {
// windowsBulletinGracePeriod returns whether we are within the grace period for a MSRC monthly feed to exist.
//
// E.g. September 2024 bulletin was released on the 2nd, thus we add some grace period (5 days)
// for Microsoft to publish the current month bulletin.
// MSRC monthly feeds are typically published early in the month, but the exact date varies.
// We use a 15-day grace period to account for this variability.
func windowsBulletinGracePeriod(month time.Month, year int) bool {
now := time.Now()
return month == now.Month() && year == now.Year() && now.Day() <= 5
return month == now.Month() && year == now.Year() && now.Day() <= 15
}
func update(
@@ -3,6 +3,7 @@ package macoffice
import (
"context"
"os"
"slices"
"testing"
"time"
@@ -28,21 +29,19 @@ func TestIntegrationsSync(t *testing.T) {
require.NoError(t, err)
// Checking for the presence of the file for today or yesterday
// in case the NVD repo is having delays publishing the data
todayFilename := io.MacOfficeRelNotesFileName(time.Now())
yesterdayFilename := io.MacOfficeRelNotesFileName(time.Now().AddDate(0, 0, -1))
// Checking for the presence of the file from the last 7 days
// in case the NVD repo is having delays publishing the data (weekends, holidays, infra issues, etc.)
var expectedFilenames []string
for i := range 7 {
expectedFilenames = append(expectedFilenames, io.MacOfficeRelNotesFileName(time.Now().AddDate(0, 0, -i)))
}
require.Condition(t, func() bool {
return contains(filesInVulnPath, todayFilename) || contains(filesInVulnPath, yesterdayFilename)
}, "Expected to find %s or %s in %s", todayFilename, yesterdayFilename, vulnPath)
}
func contains(slice []string, str string) bool {
for _, v := range slice {
if v == str {
return true
for _, expectedFilename := range expectedFilenames {
if slices.Contains(filesInVulnPath, expectedFilename) {
return true
}
}
}
return false
return false
}, "Expected to find one of %v in %s", expectedFilenames, vulnPath)
}