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 ¶
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 ¶
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 ¶
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 ¶
func (s *Service) Create(db *gorm.DB, ssp oscalTypes_1_1_3.SystemSecurityPlan) (*relational.SystemSecurityPlan, error)
Create stores ssp, stamping its last-modified time and OSCAL version. Callers validate ssp first.