Help us shape the future of Go! Take the 2026 Go Developer Survey

stig

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2026 License: AGPL-3.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ProfileKind         = "UDS STIG Profile"
	ASDSTIGProfileKey   = "asd_v6r4"
	RHEL9STIGProfileKey = "rhel9_v2r7"
)

Variables

This section is empty.

Functions

func ChecklistTitle

func ChecklistTitle(appName string, definition STIGDefinition, revision string) string

func DefaultChecklistFilename

func DefaultChecklistFilename(appName string, definition STIGDefinition, revision string) string

func Evaluate

func Evaluate(p *Profile, groupID, ruleVersion, ruleTitle, checkContent, discussion string) (string, string, string)

Evaluate determines the status, finding_details, and comments for a rule based on the app profile characteristics.

func EvaluateRHEL9

func EvaluateRHEL9(p *Profile, _ string, ruleVersion, ruleTitle, checkContent, _ string) (string, string, string)

EvaluateRHEL9 provides broad posture-based auto-dispositions for host-focused RHEL 9 profiles. Rules not recognized here intentionally fall back to not_reviewed so they can be handled through profile overrides.

func RenderXCCDFComparison added in v0.2.0

func RenderXCCDFComparison(comparison *XCCDFComparison) string

RenderXCCDFComparison creates stable human-readable comparison evidence.

func ResolveXCCDFPath

func ResolveXCCDFPath(ctx context.Context, profile *Profile, explicitPath string) (string, func(), error)

func ScanDisposition added in v0.2.0

func ScanDisposition(results []XCCDFRuleResult) (string, bool)

ScanDisposition returns a CKLB disposition only when all supplied results agree.

Types

type ChangeClassification added in v0.2.0

type ChangeClassification string

ChangeClassification describes how a rule disposition changed.

const (
	Regression       ChangeClassification = "regression"
	Improvement      ChangeClassification = "improvement"
	Reclassification ChangeClassification = "reclassification"
)

type Characteristics

type Characteristics struct {
	UsesSOAP              bool   `yaml:"uses_soap"`
	UsesSAML              bool   `yaml:"uses_saml"`
	UsesXML               bool   `yaml:"uses_xml"`
	UsesDatabase          bool   `yaml:"uses_database"`
	UsesPasswords         bool   `yaml:"uses_passwords"`
	UsesPKI               bool   `yaml:"uses_pki_cac"`
	ProcessesClassified   bool   `yaml:"processes_classified_data"`
	ProcessesCUI          bool   `yaml:"processes_cui"`
	HasUserInput          bool   `yaml:"has_user_input"`
	HasAdminInterface     bool   `yaml:"has_admin_interface"`
	HasFileUpload         bool   `yaml:"has_file_upload"`
	IsStateless           bool   `yaml:"is_stateless"`
	HasMobileCode         bool   `yaml:"has_mobile_code"`
	IsHighAvailability    bool   `yaml:"is_high_availability"`
	IsPubliclyAccessible  bool   `yaml:"is_publicly_accessible"`
	HasWebServices        bool   `yaml:"has_web_services"`
	HasSharedAccounts     bool   `yaml:"has_shared_accounts"`
	HasNonLocalMaint      bool   `yaml:"has_non_local_maintenance"`
	DoesKeyExchange       bool   `yaml:"does_key_exchange"`
	IsTransactionBased    bool   `yaml:"is_transaction_based"`
	IsConfigMgmtApp       bool   `yaml:"is_config_mgmt_app"`
	AuthenticatesDevices  bool   `yaml:"authenticates_devices"`
	HasCryptoModuleAccess bool   `yaml:"has_crypto_module_access"`
	InDoDDMZ              bool   `yaml:"in_dod_dmz"`
	IsCritical            bool   `yaml:"is_critical"`
	HostsNonOrgUsers      bool   `yaml:"hosts_non_org_users"`
	DevelopedInHouse      bool   `yaml:"developed_in_house"`
	Language              string `yaml:"language"`

	IsVirtualMachine     bool `yaml:"is_virtual_machine"`
	IsContainerHost      bool `yaml:"is_container_host"`
	IsKubernetesNode     bool `yaml:"is_kubernetes_node"`
	IsStandaloneServer   bool `yaml:"is_standalone_server"`
	HasGUI               bool `yaml:"has_gui"`
	BootsToMultiUser     bool `yaml:"boots_to_multi_user_target"`
	InteractiveConsole   bool `yaml:"interactive_console_present"`
	HasLocalUsers        bool `yaml:"has_local_interactive_users"`
	IsDomainJoined       bool `yaml:"is_domain_joined"`
	UsesFIPSMode         bool `yaml:"uses_fips_mode"`
	UsesSELinux          bool `yaml:"uses_selinux"`
	UsesAuditd           bool `yaml:"uses_auditd"`
	UsesJournald         bool `yaml:"uses_journald"`
	UsesTimeSync         bool `yaml:"uses_time_sync"`
	UsesCryptoPolicy     bool `yaml:"uses_crypto_policy"`
	UsesFirewall         bool `yaml:"uses_firewall"`
	UsesSSH              bool `yaml:"uses_ssh"`
	UsesSudo             bool `yaml:"uses_sudo"`
	UsesAIDE             bool `yaml:"uses_aide"`
	UsesEncryptedStorage bool `yaml:"uses_encrypted_storage"`
	UsesIPv6             bool `yaml:"uses_ipv6"`
	PermitsWireless      bool `yaml:"permits_wireless"`
	UsesRemovableMedia   bool `yaml:"uses_removable_media"`
	USBStorageDisabled   bool `yaml:"usb_storage_disabled"`
	IsAirGapped          bool `yaml:"is_air_gapped"`
	SeparateTmp          bool `yaml:"separate_tmp"`
	SeparateVar          bool `yaml:"separate_var"`
	SeparateVarLog       bool `yaml:"separate_var_log"`
	SeparateVarLogAudit  bool `yaml:"separate_var_log_audit"`
	SeparateVarTmp       bool `yaml:"separate_var_tmp"`
	SeparateHome         bool `yaml:"separate_home"`
}

type CheckContentRef

type CheckContentRef struct {
	Href string `json:"href"`
	Name string `json:"name"`
}

type Checklist

type Checklist struct {
	Title       string      `json:"title"`
	ID          string      `json:"id"`
	CKLBVersion string      `json:"cklb_version"`
	Active      bool        `json:"active"`
	Mode        int         `json:"mode"`
	HasPath     bool        `json:"has_path"`
	TargetData  *TargetData `json:"target_data"`
	STIGs       []STIG      `json:"stigs"`
}

func BuildChecklist

func BuildChecklist(profile *Profile, stig *STIG) *Checklist

type GroupTreeEntry

type GroupTreeEntry struct {
	ID          string `json:"id"`
	Title       string `json:"title"`
	Description string `json:"description"`
}

type IncompatibleResultSetsError added in v0.2.0

type IncompatibleResultSetsError struct {
	BaseOnly []string
	NewOnly  []string
	Metadata []string
}

IncompatibleResultSetsError indicates that scans evaluated different rule-result identities.

func (*IncompatibleResultSetsError) Error added in v0.2.0

type Override

type Override struct {
	Status         string `yaml:"status"`
	FindingDetails string `yaml:"finding_details"`
	Comments       string `yaml:"comments,omitempty"`
}

Override allows per-rule status/finding overrides in the profile.

type PlatformConfig

type PlatformConfig struct {
	AuthProvider       string `yaml:"auth_provider"`
	AuthProxy          string `yaml:"auth_proxy"`
	ServiceMesh        string `yaml:"service_mesh"`
	TLSProvider        string `yaml:"tls_provider"`
	ContainerRuntime   string `yaml:"container_runtime"`
	ContainerUser      string `yaml:"container_user"`
	BaseImage          string `yaml:"base_image"`
	NetworkPolicies    bool   `yaml:"network_policies"`
	CICD_SAST          string `yaml:"cicd_sast"`
	CICD_SecretsScan   string `yaml:"cicd_secrets_scan"`
	CICD_Signing       string `yaml:"cicd_signing"`
	DependencyMonitor  string `yaml:"dependency_monitoring"`
	SCM                string `yaml:"scm"`
	DefectTracking     string `yaml:"defect_tracking"`
	CentralizedLogging bool   `yaml:"centralized_logging"`
	ResourceLimits     string `yaml:"resource_limits"`

	OSName                 string `yaml:"os_name"`
	OSVersion              string `yaml:"os_version"`
	HostRole               string `yaml:"host_role"`
	InstallationType       string `yaml:"installation_type"`
	Virtualization         string `yaml:"virtualization"`
	NetworkEnvironment     string `yaml:"network_environment"`
	ManagementPlane        string `yaml:"management_plane"`
	Authentication         string `yaml:"authentication"`
	PrivilegedAccess       string `yaml:"privileged_access"`
	SELinuxMode            string `yaml:"selinux_mode"`
	FIPSMode               bool   `yaml:"fips_mode"`
	AuditService           string `yaml:"audit_service"`
	JournaldEnabled        bool   `yaml:"journald_enabled"`
	RNGDEnabled            bool   `yaml:"rngd_enabled"`
	TimeSync               string `yaml:"time_sync"`
	Firewall               string `yaml:"firewall"`
	PackageSource          string `yaml:"package_source"`
	FileIntegrity          string `yaml:"file_integrity"`
	AntivirusOrEDR         string `yaml:"antivirus_or_edr"`
	SSHAccess              string `yaml:"ssh_access"`
	BootloaderProtected    bool   `yaml:"bootloader_protected"`
	CryptoPolicy           string `yaml:"crypto_policy"`
	DiskEncryption         string `yaml:"disk_encryption"`
	MountStrategy          string `yaml:"mount_strategy"`
	TmpMountOptions        string `yaml:"tmp_mount_options"`
	VarTmpMountOptions     string `yaml:"var_tmp_mount_options"`
	AuditLogMountOptions   string `yaml:"audit_log_mount_options"`
	LocalAccountPolicy     string `yaml:"local_account_policy"`
	KubernetesDistribution string `yaml:"kubernetes_distribution"`
	UpdateModel            string `yaml:"update_model"`
}

type Profile

type Profile struct {
	Kind     string          `yaml:"kind"`
	Metadata ProfileMetadata `yaml:"metadata"`
	STIGs    []STIGProfile   `yaml:"stigs"`

	AppName      string              `yaml:"-"`
	FQDN         string              `yaml:"-"`
	Description  string              `yaml:"-"`
	Chars        Characteristics     `yaml:"-"`
	Platform     PlatformConfig      `yaml:"-"`
	Overrides    map[string]Override `yaml:"-"`
	SelectedSTIG *STIGProfile        `yaml:"-"`
	// contains filtered or unexported fields
}

Profile represents the stig-profile.yaml configuration.

func LoadProfile

func LoadProfile(path string) (*Profile, error)

func (*Profile) ActivateSTIG added in v0.2.0

func (p *Profile) ActivateSTIG(selected *STIGProfile)

func (*Profile) SelectSTIG

func (p *Profile) SelectSTIG(id string) *STIGProfile

func (*Profile) SupportedSTIGs added in v0.2.0

func (p *Profile) SupportedSTIGs() []*STIGProfile

func (*Profile) ValidateSTIGs added in v0.2.0

func (p *Profile) ValidateSTIGs() error

func (*Profile) ValidateSchema added in v0.2.0

func (p *Profile) ValidateSchema(version string) error

func (*Profile) ValidateVersion added in v0.2.0

func (p *Profile) ValidateVersion(expected string) error

type ProfileMetadata

type ProfileMetadata struct {
	Name        string `yaml:"name"`
	FQDN        string `yaml:"fqdn"`
	Description string `yaml:"description"`
	Version     string `yaml:"version"`
}

type ResultChange added in v0.2.0

type ResultChange struct {
	Identity       string
	BaseStatus     ResultStatus
	NewStatus      ResultStatus
	Classification ChangeClassification
}

ResultChange is a changed rule-result record between two scans.

type ResultStatus added in v0.2.0

type ResultStatus string

ResultStatus is an XCCDF rule-result disposition.

const (
	ResultPass          ResultStatus = "pass"
	ResultFail          ResultStatus = "fail"
	ResultError         ResultStatus = "error"
	ResultUnknown       ResultStatus = "unknown"
	ResultNotApplicable ResultStatus = "notapplicable"
	ResultNotChecked    ResultStatus = "notchecked"
	ResultNotSelected   ResultStatus = "notselected"
	ResultInformational ResultStatus = "informational"
	ResultFixed         ResultStatus = "fixed"
)

type Rule

type Rule struct {
	GroupIDSrc        string           `json:"group_id_src"`
	GroupTree         []GroupTreeEntry `json:"group_tree"`
	GroupID           string           `json:"group_id"`
	Severity          string           `json:"severity"`
	GroupTitle        string           `json:"group_title"`
	RuleIDSrc         string           `json:"rule_id_src"`
	RuleID            string           `json:"rule_id"`
	RuleVersion       string           `json:"rule_version"`
	RuleTitle         string           `json:"rule_title"`
	FixText           string           `json:"fix_text"`
	Weight            string           `json:"weight"`
	CheckContent      string           `json:"check_content"`
	CheckContentRef   *CheckContentRef `json:"check_content_ref"`
	Classification    string           `json:"classification"`
	Discussion        string           `json:"discussion"`
	FalsePositives    string           `json:"false_positives"`
	FalseNegatives    string           `json:"false_negatives"`
	Documentable      string           `json:"documentable"`
	SecurityOverride  string           `json:"security_override_guidance"`
	PotentialImpacts  string           `json:"potential_impacts"`
	ThirdPartyTools   string           `json:"third_party_tools"`
	IAControls        string           `json:"ia_controls"`
	Responsibility    string           `json:"responsibility"`
	Mitigations       string           `json:"mitigations"`
	MitigationControl string           `json:"mitigation_control"`
	LegacyIDs         []string         `json:"legacy_ids"`
	CCIs              []string         `json:"ccis"`
	ReferenceID       *string          `json:"reference_identifier"`
	UUID              string           `json:"uuid"`
	SIGUUID           string           `json:"stig_uuid"`
	Status            string           `json:"status"`
	Overrides         map[string]any   `json:"overrides"`
	Comments          string           `json:"comments"`
	FindingDetails    string           `json:"finding_details"`
}

type STIG

type STIG struct {
	Revision            string  `json:"-"`
	STIGName            string  `json:"stig_name"`
	DisplayName         string  `json:"display_name"`
	STIGID              string  `json:"stig_id"`
	ReleaseInfo         string  `json:"release_info"`
	UUID                string  `json:"uuid"`
	ReferenceIdentifier *string `json:"reference_identifier"`
	Size                int     `json:"size"`
	Rules               []Rule  `json:"rules"`
}

func ParseXCCDF

func ParseXCCDF(path string, profile *Profile) (*STIG, error)

func ParseXCCDFWithEvidence added in v0.2.0

func ParseXCCDFWithEvidence(path string, profile *Profile, evidence *ScanEvidence) (*STIG, error)

ParseXCCDFWithEvidence applies mapped scan results between profile heuristics and human overrides.

type STIGDefinition

type STIGDefinition struct {
	ID             string
	ChecklistSlug  string
	TargetRole     string
	TechnologyArea string
	STIGName       string
	DisplayName    string
	STIGID         string
	ZipURL         string
	XCCDFName      string
}

func LookupSTIGDefinition

func LookupSTIGDefinition(id string) (STIGDefinition, error)

type STIGProfile

type STIGProfile struct {
	ID              string              `yaml:"id"`
	Description     string              `yaml:"description"`
	Characteristics Characteristics     `yaml:"characteristics"`
	Platform        PlatformConfig      `yaml:"platform"`
	Overrides       map[string]Override `yaml:"overrides,omitempty"`
}

type ScanEvidence added in v0.2.0

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

func LoadScanEvidence added in v0.2.0

func LoadScanEvidence(resultsPath, dataStreamPath string) (*ScanEvidence, error)

LoadScanEvidence joins OpenSCAP results to DISA rule IDs through SSG references.

func (*ScanEvidence) DispositionFor added in v0.2.0

func (e *ScanEvidence) DispositionFor(stigID, disaRuleID string) (string, bool, string)

DispositionFor requires every mapped SSG rule and DISA rule revision to match.

func (*ScanEvidence) FindingDetailsFor added in v0.2.0

func (e *ScanEvidence) FindingDetailsFor(stigID, dispositionNote string) string

FindingDetailsFor includes the source of mapped results and how they affected the disposition.

func (*ScanEvidence) ResultsFor added in v0.2.0

func (e *ScanEvidence) ResultsFor(stigID string) []XCCDFRuleResult

ResultsFor returns the scan records mapped to a DISA rule version.

type TargetData

type TargetData struct {
	TargetType     string `json:"target_type"`
	HostName       string `json:"host_name"`
	IPAddress      string `json:"ip_address"`
	MACAddress     string `json:"mac_address"`
	FQDN           string `json:"fqdn"`
	Comments       string `json:"comments"`
	Role           string `json:"role"`
	IsWebDatabase  bool   `json:"is_web_database"`
	TechnologyArea string `json:"technology_area"`
	WebDBSite      string `json:"web_db_site"`
	WebDBInstance  string `json:"web_db_instance"`
}

type XCCDFComparison added in v0.2.0

type XCCDFComparison struct {
	Base             *XCCDFResultSet
	New              *XCCDFResultSet
	Changes          []ResultChange
	UnchangedCount   int
	RegressionCount  int
	ImprovementCount int
	ReclassifyCount  int
}

XCCDFComparison is the validated comparison of two result sets.

func CompareXCCDFResults added in v0.2.0

func CompareXCCDFResults(base, newResults *XCCDFResultSet) (*XCCDFComparison, error)

CompareXCCDFResults validates equivalent identities and classifies disposition changes.

func (*XCCDFComparison) FailingRulesRemovedFromScope added in v0.2.0

func (c *XCCDFComparison) FailingRulesRemovedFromScope() int

FailingRulesRemovedFromScope counts failing rules that are no longer selected.

func (*XCCDFComparison) HasBlockingChanges added in v0.2.0

func (c *XCCDFComparison) HasBlockingChanges() bool

HasBlockingChanges reports whether the comparison should fail the CI gate.

func (*XCCDFComparison) HasRegressions added in v0.2.0

func (c *XCCDFComparison) HasRegressions() bool

HasRegressions reports whether the candidate contains regressions.

type XCCDFResultSet added in v0.2.0

type XCCDFResultSet struct {
	SourcePath       string
	BenchmarkID      string
	BenchmarkVersion string
	TestResultID     string
	ProfileID        string
	StartTime        string
	EndTime          string
	Targets          []string
	RuleResults      map[string]XCCDFRuleResult
}

XCCDFResultSet contains the single TestResult extracted from an XCCDF Benchmark.

func LoadXCCDFResults added in v0.2.0

func LoadXCCDFResults(path string) (*XCCDFResultSet, error)

LoadXCCDFResults parses one XCCDF 1.1 or 1.2 Benchmark containing exactly one TestResult.

type XCCDFRuleResult added in v0.2.0

type XCCDFRuleResult struct {
	Identity string
	RuleID   string
	Status   ResultStatus
}

XCCDFRuleResult is one uniquely identifiable XCCDF rule-result record.

Jump to

Keyboard shortcuts

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