Documentation
¶
Overview ¶
Package oscal provides conversion functions to transform Gemara documents into OSCAL (Open Security Controls Assessment Language) format.
OSCAL is a set of standardized formats for expressing security controls, assessments, and related information in a machine-readable format. This package supports converting:
- Layer 1 GuidanceDocument to OSCAL Profile and Catalog
- Layer 2 Catalog to OSCAL Catalog
Index ¶
- func CatalogFromGuidanceDocument(g *gemara.GuidanceDocument, opts ...GenerateOption) (oscal.Catalog, error)
- func FromCatalog(catalog *gemara.Catalog, controlHREF string) (oscal.Catalog, error)
- func ProfileFromGuidanceDocument(g *gemara.GuidanceDocument, guidanceDocHref string, opts ...GenerateOption) (oscal.Profile, error)
- type GenerateOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CatalogFromGuidanceDocument ¶
func CatalogFromGuidanceDocument(g *gemara.GuidanceDocument, opts ...GenerateOption) (oscal.Catalog, error)
CatalogFromGuidanceDocument creates an OSCAL Catalog from the locally defined guidelines in a given Layer 1 Guidance Document.
func FromCatalog ¶
FromCatalog converts a Catalog to OSCAL Catalog format. Parameters:
- catalog: The catalog to convert
- controlHREF: URL template for linking to controls. Uses format: controlHREF(version, controlID) Example: "https://baseline.openssf.org/versions/%s#%s"
The function automatically:
- Uses the catalog's internal version from Metadata.Version
- Uses the ControlFamily.Id as the OSCAL group ID
- Generates a unique UUID for the catalog
func ProfileFromGuidanceDocument ¶
func ProfileFromGuidanceDocument(g *gemara.GuidanceDocument, guidanceDocHref string, opts ...GenerateOption) (oscal.Profile, error)
ProfileFromGuidanceDocument creates an OSCAL Profile from the imported and local guidelines from Layer 1 Guidance Document with a given location to the OSCAL Catalog for the guidance document.
Types ¶
type GenerateOption ¶
type GenerateOption func(opts *generateOpts)
GenerateOption defines an option to tune the behavior of the OSCAL generation functions for Layer 1.
func WithCanonicalHrefFormat ¶
func WithCanonicalHrefFormat(canonicalHref string) GenerateOption
WithCanonicalHrefFormat is a GenerateOption that provides an `href` format string for the canonical version of the guidance document. If set, this will be added as a link in the mapping.cue with the rel="canonical" attribute. Ex - https://myguidance.org/versions/%s
func WithOSCALImports ¶
func WithOSCALImports(imports map[string]string) GenerateOption
WithOSCALImports is a GenerateOption that provides the `href` to guidance document mappings in OSCAL by mapping unique identifier. If unset, the mapping URL of the guidance document will be used.
func WithVersion ¶
func WithVersion(version string) GenerateOption
WithVersion is a GenerateOption that sets the version of the OSCAL Document. If set, this will be used instead of the version in GuidanceDocument.