From 154f82713aea8fb7c25a08d8e7e694721a9857dd Mon Sep 17 00:00:00 2001 From: Eddie Knight Date: Fri, 24 Jan 2025 16:37:35 -0600 Subject: [PATCH] added support for references and updated template (#164) Signed-off-by: Eddie Knight --- cmd/baseline.go | 4 ++++ cmd/template.md | 23 ++++++++++++++++++----- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/cmd/baseline.go b/cmd/baseline.go index 7ed7204..5a8d54b 100644 --- a/cmd/baseline.go +++ b/cmd/baseline.go @@ -40,6 +40,7 @@ type LexiconEntry struct { Term string `yaml:"term"` Definition string `yaml:"definition"` Synonyms []string `yaml:"synonyms"` + References []string `yaml:"references"` } func hardcodedCategories() []string { @@ -192,6 +193,9 @@ func (b *Baseline) Generate() error { "asLink": func(s string) string { return asLinkTemplateFunction(s) }, + "subtract": func(a, b int) int { + return a - b + }, }).Parse(string(templateContent)) if err != nil { return fmt.Errorf("error parsing template: %w", err) diff --git a/cmd/template.md b/cmd/template.md index 41c2dc8..e2b2c15 100644 --- a/cmd/template.md +++ b/cmd/template.md @@ -9,6 +9,11 @@ The Open Source Project Security (OSPS) Baseline is a set of security criteria t The criteria are organized by maturity level and category. In the detailed subsections you will find the criterion, rationale, and details notes. + +Where possible, we have added control mappings to external frameworks. +These are not guaranteed to be 100% matches, but instead serve as references +when working to meet the corresponding controls. + For more information on the project and to make contributions, visit the [GitHub repo](https://github.com/ossf/security-baseline). --- @@ -68,10 +73,10 @@ For more information on the project and to make contributions, visit the [GitHub {{- end }} **Details:** {{ .Details | addLinks }} {{ if .ControlMappings }} -**Control Mappings:** -{{ range $key, $value := .ControlMappings }} -- {{ $key }}: {{ $value }} -{{- end }} +| Catalog | Potential Mappings | +| ------- | ------------------ | +{{ range $key, $value := .ControlMappings }}| {{ $key | addLinks }} | {{ $value }} | +{{ end }} {{- end }} {{ if .SecurityInsightsValue }} **Security Insights Value:** {{ .SecurityInsightsValue }} @@ -85,11 +90,19 @@ For more information on the project and to make contributions, visit the [GitHub ## Lexicon {{ range .Lexicon }} + ### {{ .Term }} {{ .Definition }} -{{- end }} +{{ if .References }} +**References:** +{{ range .References }} + - {{.}} +{{ end -}} +{{ end -}} +{{ end -}} + --- ## Acknowledgments