Skip to content

Commit

Permalink
added support for references and updated template (#164)
Browse files Browse the repository at this point in the history
Signed-off-by: Eddie Knight <[email protected]>
  • Loading branch information
eddie-knight authored Jan 24, 2025
1 parent 6adf8bb commit 154f827
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 5 deletions.
4 changes: 4 additions & 0 deletions cmd/baseline.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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)
Expand Down
23 changes: 18 additions & 5 deletions cmd/template.md
Original file line number Diff line number Diff line change
Expand Up @@ -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).

---
Expand Down Expand Up @@ -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 }}
Expand All @@ -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
Expand Down

0 comments on commit 154f827

Please sign in to comment.