layer2

package
v0.15.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 13, 2025 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AssessmentRequirement

type AssessmentRequirement struct {
	Id string `json:"id" yaml:"id"`

	Text string `json:"text" yaml:"text"`

	Applicability []string `json:"applicability" yaml:"applicability"`

	Recommendation string `json:"recommendation,omitempty" yaml:"recommendation,omitempty"`
}

type Capability

type Capability struct {
	Id string `json:"id" yaml:"id"`

	Title string `json:"title" yaml:"title"`

	Description string `json:"description" yaml:"description"`
}

type Catalog

type Catalog struct {
	Metadata Metadata `json:"metadata,omitempty" yaml:"metadata,omitempty"`

	ControlFamilies []ControlFamily `json:"control-families,omitempty" yaml:"control-families,omitempty"`

	Threats []Threat `json:"threats,omitempty" yaml:"threats,omitempty"`

	Capabilities []Capability `json:"capabilities,omitempty" yaml:"capabilities,omitempty"`

	ImportedControls []Mapping `json:"imported-controls,omitempty" yaml:"imported-controls,omitempty"`

	ImportedThreats []Mapping `json:"imported-threats,omitempty" yaml:"imported-threats,omitempty"`

	ImportedCapabilities []Mapping `json:"imported-capabilities,omitempty" yaml:"imported-capabilities,omitempty"`
}

func (*Catalog) LoadFile

func (c *Catalog) LoadFile(sourcePath string) error

LoadFile loads data from a single YAML or JSON file at the provided path. sourcePath is expected to be a file or https URI in the form file:///path/to/file.yaml or https://example.com/file.yaml. If run multiple times for the same data type, this method will override previous data.

func (*Catalog) LoadFiles

func (c *Catalog) LoadFiles(sourcePaths []string) error

LoadFiles loads data from any number of YAML or JSON files at the provided paths. sourcePath are expected to be file or https URIs in the form file:///path/to/file.yaml or https://example.com/file.yaml. If run multiple times, this method will append new data to previous data.

func (*Catalog) LoadNestedCatalog added in v0.6.0

func (c *Catalog) LoadNestedCatalog(sourcePath, fieldName string) error

LoadNestedCatalog loads a YAML file containing a nested catalog. Only supports a single layer of nesting. Accepts file URIs with the 'file:///' prefix. Throws an error if the URL is not https. TODO: Consider validating/sanitizing inputs to reduce injection risks.

func (*Catalog) ToOSCAL added in v0.4.0

func (c *Catalog) ToOSCAL(controlHREF string) (oscal.Catalog, error)

ToOSCAL converts a Catalog to OSCAL Catalog format. Parameters:

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

type Category

type Category struct {
	Id string `json:"id" yaml:"id"`

	Title string `json:"title" yaml:"title"`

	Description string `json:"description" yaml:"description"`
}

type Control

type Control struct {
	Id string `json:"id" yaml:"id"`

	Title string `json:"title" yaml:"title"`

	Objective string `json:"objective" yaml:"objective"`

	AssessmentRequirements []AssessmentRequirement `json:"assessment-requirements" yaml:"assessment-requirements"`

	GuidelineMappings []Mapping `json:"guideline-mappings,omitempty" yaml:"guideline-mappings,omitempty"`

	ThreatMappings []Mapping `json:"threat-mappings,omitempty" yaml:"threat-mappings,omitempty"`
}

type ControlFamily

type ControlFamily struct {
	Id string `json:"id" yaml:"id"`

	Title string `json:"title" yaml:"title"`

	Description string `json:"description" yaml:"description"`

	Controls []Control `json:"controls" yaml:"controls"`
}

type Mapping

type Mapping struct {
	ReferenceId string `json:"reference-id" yaml:"reference-id"`

	Entries []MappingEntry `json:"entries" yaml:"entries"`

	Remarks string `json:"remarks,omitempty" yaml:"remarks,omitempty"`
}

type MappingEntry

type MappingEntry struct {
	ReferenceId string `json:"reference-id" yaml:"reference-id"`

	Strength int64 `json:"strength" yaml:"strength"`

	Remarks string `json:"remarks,omitempty" yaml:"remarks,omitempty"`
}

type MappingReference

type MappingReference struct {
	Id string `json:"id" yaml:"id"`

	Title string `json:"title" yaml:"title"`

	Version string `json:"version" yaml:"version"`

	Description string `json:"description,omitempty" yaml:"description,omitempty"`

	Url string `json:"url,omitempty" yaml:"url,omitempty"`
}

type Metadata

type Metadata struct {
	Id string `json:"id" yaml:"id"`

	Title string `json:"title" yaml:"title"`

	Description string `json:"description" yaml:"description"`

	Version string `json:"version,omitempty" yaml:"version,omitempty"`

	LastModified string `json:"last-modified,omitempty" yaml:"last-modified,omitempty"`

	ApplicabilityCategories []Category `json:"applicability-categories,omitempty" yaml:"applicability-categories,omitempty"`

	MappingReferences []MappingReference `json:"mapping-references,omitempty" yaml:"mapping-references,omitempty"`
}

Resuable types //

type Threat

type Threat struct {
	Id string `json:"id" yaml:"id"`

	Title string `json:"title" yaml:"title"`

	Description string `json:"description" yaml:"description"`

	Capabilities []Mapping `json:"capabilities" yaml:"capabilities"`

	ExternalMappings []Mapping `json:"external-mappings,omitempty" yaml:"external-mappings,omitempty"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL