sspservice

package
v0.22.2 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2026 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Overview

Package sspservice creates System Security Plans and binds profiles to them. The SSP HTTP handlers and SSP template discovery both go through it, so an SSP is built the same way whoever creates it.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrSSPNotFound is returned when the SSP does not exist.
	ErrSSPNotFound = errors.New("SSP not found")
	// ErrProfileNotFound is returned when the profile does not exist.
	ErrProfileNotFound = errors.New("profile not found")
	// ErrProfileAlreadyBound is returned when the profile is already bound to the SSP.
	ErrProfileAlreadyBound = errors.New("profile is already bound to this SSP")
	// ErrNoResolvedControls is returned when the profile resolves to no controls.
	ErrNoResolvedControls = errors.New("no controls were resolved from the selected profile")
)

Functions

This section is empty.

Types

type ControlResolver

type ControlResolver func(profileID uuid.UUID) ([]string, error)

ControlResolver returns the catalog-canonical control IDs a profile selects, de-duplicated.

type Service

type Service struct {
	// contains filtered or unexported fields
}

Service creates SSPs and binds profiles to them. Every method takes the *gorm.DB to run on, so callers can pass a transaction.

func NewService

func NewService(resolveControls ControlResolver) *Service

NewService returns a Service resolving profile controls with resolveControls.

func (*Service) AttachProfile

func (s *Service) AttachProfile(db *gorm.DB, sspID, profileID uuid.UUID) error

AttachProfile binds the profile to the SSP and creates an implemented requirement for each of the profile's controls the SSP does not implement yet (matched case-insensitively, stored with the catalog's casing). The writes run in one transaction (a savepoint when db is already one). It fails with ErrSSPNotFound, ErrProfileNotFound, ErrProfileAlreadyBound or ErrNoResolvedControls.

func (*Service) Create

Create stores ssp, stamping its last-modified time and OSCAL version. Callers validate ssp first.

Jump to

Keyboard shortcuts

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