slsa

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Control constants
	DEPRECATED_ContinuityEnforced  ControlName = "CONTINUITY_ENFORCED"
	DEPRECATED_ProvenanceAvailable ControlName = "PROVENANCE_AVAILABLE"
	DEPRECATED_ReviewEnforced      ControlName = "REVIEW_ENFORCED"
	DEPRECATED_TagHygiene          ControlName = "TAG_HYGIENE"

	// Virtual control to manage policy lifcycle
	PolicyAvailable ControlName = "POLICY_AVAILABLE"

	SLSA_SOURCE_ORG_SCS              ControlName = "SLSA_SOURCE_ORG_SCS"
	SLSA_SOURCE_ORG_ACCESS_CONTROL   ControlName = "SLSA_SOURCE_ORG_ACCESS_CONTROL"
	SLSA_SOURCE_ORG_SAFE_EXPUNGE     ControlName = "SLSA_SOURCE_ORG_SAFE_EXPUNGE"
	SLSA_SOURCE_ORG_CONTINUITY       ControlName = "SLSA_SOURCE_ORG_CONTINUITY"
	SLSA_SOURCE_SCS_REPO_ID          ControlName = "SLSA_SOURCE_SCS_REPO_ID"
	SLSA_SOURCE_SCS_REVISION_ID      ControlName = "SLSA_SOURCE_SCS_REVISION_ID"
	SLSA_SOURCE_SCS_DIFF_DISPLAY     ControlName = "SLSA_SOURCE_SCS_DIFF_DISPLAY"
	SLSA_SOURCE_SCS_VSA              ControlName = "SLSA_SOURCE_SCS_VSA"
	SLSA_SOURCE_SCS_HISTORY          ControlName = "SLSA_SOURCE_SCS_HISTORY"
	SLSA_SOURCE_SCS_CONTINUITY       ControlName = "SLSA_SOURCE_SCS_CONTINUITY"
	SLSA_SOURCE_SCS_IDENTITY         ControlName = "SLSA_SOURCE_SCS_IDENTITY"
	SLSA_SOURCE_SCS_PROVENANCE       ControlName = "SLSA_SOURCE_SCS_PROVENANCE"
	SLSA_SOURCE_SCS_PROTECTED_REFS   ControlName = "SLSA_SOURCE_SCS_PROTECTED_REFS"
	SLSA_SOURCE_SCS_TWO_PARTY_REVIEW ControlName = "SLSA_SOURCE_SCS_TWO_PARTY_REVIEW"

	// Control lifecycle states
	StateNotEnabled ControlState = "not_enabled"
	StateInProgress ControlState = "in_progress"
	StateActive     ControlState = "active"
)
View Source
const (
	SourceBranchesAnnotation = "source_branches"
	SourceRefsAnnotation     = "source_refs"
	AllowedOrgPropPrefix     = "ORG_SOURCE_"
)

Variables

AllLevelControls is a set holding all controls of the SLSA Source spec

View Source
var Level0 = ControlNameSet{}

Functions

func ControlNamesToStrings

func ControlNamesToStrings(controlNames []ControlName) []string

func EarlierTime

func EarlierTime(time1, time2 time.Time) time.Time

func IsLevelHigherOrEqualTo

func IsLevelHigherOrEqualTo(level1, level2 SlsaSourceLevel) bool

func IsSlsaSourceLevel

func IsSlsaSourceLevel(control ControlName) bool

Types

type Control added in v0.7.0

type Control struct {
	Name              ControlName
	State             ControlState `json:"control_state"`
	Since             *time.Time   `json:"since,omitempty"`
	Message           string
	RecommendedAction *ControlRecommendedAction
}

Control captures the status of a control as seen from a VCS system

func (*Control) GetName added in v0.7.0

func (cs *Control) GetName() ControlName

func (*Control) GetSince added in v0.7.0

func (cs *Control) GetSince() *time.Time

type ControlName

type ControlName string

func (ControlName) String

func (c ControlName) String() string

type ControlNameSet added in v0.7.0

type ControlNameSet []ControlName

ControlNameSet is a list of control names

func GetRequiredControlsForLevel

func GetRequiredControlsForLevel(level SlsaSourceLevel) ControlNameSet

Returns the list of control names that must be set for the given slsa level.

func (ControlNameSet) GetControl added in v0.7.0

func (cs ControlNameSet) GetControl(ctrl ControlName) ControlName

type ControlRecommendedAction

type ControlRecommendedAction struct {
	Message string
	Command string
}

ControlRecommendedAction captures the recommended action to complete a control's implementation.

type ControlSet added in v0.7.0

type ControlSet struct {
	RepoUri string
	Branch  string
	// The time we are observing the controls
	Time time.Time
	// The time the commit we're evaluating was pushed.
	CommitPushTime time.Time
	// The actor that pushed the commit.
	ActorLogin string
	// The type of activity that created the commit.
	ActivityType string
	// List of controls
	Controls []*Control
}

ControlSet is a snapshot of the status of SLSA controls in a branch at a point in time.

func NewControlSet added in v0.7.0

func NewControlSet() *ControlSet

NewControlStatus returns a new control status object initialized with all existing controls in not_enabled state.

func NewControlSetFromProvanenaceControls added in v0.7.0

func NewControlSetFromProvanenaceControls(provControls []*provenance.Control) *ControlSet

func (*ControlSet) AddControl added in v0.7.0

func (cs *ControlSet) AddControl(newControls ...*Control)

Adds the control to the list. Ignores nil controls. Does not check for duplicate controls.

func (*ControlSet) AreControlsAvailable added in v0.7.0

func (cs *ControlSet) AreControlsAvailable(names []ControlName) bool

This checks if the controls are present in the array. But As we merged the controls array with the struct we also check if they are all active

func (*ControlSet) GetActiveControls added in v0.7.0

func (cs *ControlSet) GetActiveControls() *ControlSet

GetActiveControls returns a Controls collection with all the controls which are active in the set.

func (*ControlSet) GetControl added in v0.7.0

func (cs *ControlSet) GetControl(name ControlName) *Control

Gets the control with the corresponding name, returns nil if not found.

func (*ControlSet) Names added in v0.7.0

func (cs *ControlSet) Names() []ControlName

Returns the names of the controls.

func (*ControlSet) SetControlState added in v0.7.0

func (cs *ControlSet) SetControlState(ctrlName ControlName, state ControlState)

SetControlState sets the state of a control in the set by name.

func (*ControlSet) ToProvenanceControls added in v0.7.0

func (cs *ControlSet) ToProvenanceControls() []*provenance.Control

type ControlState

type ControlState string

type Level added in v0.7.0

type Level struct {
	Level    uint8
	Controls ControlNameSet
}

type SlsaSourceLevel

type SlsaSourceLevel ControlName
const (
	SlsaSourceLevel0 SlsaSourceLevel = "SLSA_SOURCE_LEVEL_0"
	SlsaSourceLevel1 SlsaSourceLevel = "SLSA_SOURCE_LEVEL_1"
	SlsaSourceLevel2 SlsaSourceLevel = "SLSA_SOURCE_LEVEL_2"
	SlsaSourceLevel3 SlsaSourceLevel = "SLSA_SOURCE_LEVEL_3"
	SlsaSourceLevel4 SlsaSourceLevel = "SLSA_SOURCE_LEVEL_4"
)

type SourceVerifiedLevels

type SourceVerifiedLevels []ControlName

These can be any string, not just SlsaLevels

func (SourceVerifiedLevels) Levels added in v0.7.0

Levels returns the contrlols that are only SLSA levels (ignoring others)

Jump to

Keyboard shortcuts

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