Skip to content
Merged
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
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
# Changelog

## v2.2.1

### Features

- `SecurityInsightsFilenames()` returns both accepted names, `security-insights.yml` and `security-insights.yaml`, matching the spec

### Deprecations

- `SecurityInsightsFilename` names only the `.yml` file. Use `SecurityInsightsFilenames()` instead

### Bug Fixes

- `in-scope` and `out-of-scope` load as string lists. Files that set either field no longer fail to load ([#68](https://github.com/ossf/si-tooling/issues/68))

## v2.1.0

This release is made in concert with the v2.1.0 release of [Security Insights](https://github.com/ossf/security-insights-spec)
Expand Down
9 changes: 9 additions & 0 deletions v2/si/security_insights.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,17 @@ import (
)

// SecurityInsightsFilename is the expected name of the YAML file containing the insights data. See https://github.com/ossf/security-insights-spec?tab=readme-ov-file#usage for more details.
//
// Deprecated: the spec accepts both .yml and .yaml. Use SecurityInsightsFilenames.
const SecurityInsightsFilename = "security-insights.yml"

// SecurityInsightsFilenames returns every name a SecurityInsights YAML file may
// use. The historical .yml name comes first, so callers that stop at the first
// match keep their current behavior. A project should keep only one of them.
func SecurityInsightsFilenames() []string {
return []string{SecurityInsightsFilename, "security-insights.yaml"}
}

func fetchParentSecurityInsights(parentUrl string) (bytes []byte, err error) {
request, err := http.NewRequest("GET", parentUrl, nil)
if err != nil {
Expand Down
11 changes: 11 additions & 0 deletions v2/si/security_insights_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,17 @@ func TestNewURL(t *testing.T) {
})
}
}

func TestSecurityInsightsFilenames(t *testing.T) {
assert.Equal(t, []string{"security-insights.yml", "security-insights.yaml"}, SecurityInsightsFilenames())

t.Run("returns a fresh slice", func(t *testing.T) {
names := SecurityInsightsFilenames()
names[0] = "changed"
assert.Equal(t, "security-insights.yml", SecurityInsightsFilenames()[0])
})
}

func TestNewEmail(t *testing.T) {
tests := []struct {
name string
Expand Down
Loading