policy_manager

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2026 License: AGPL-3.0 Imports: 14 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FirstOf added in v0.1.7

func FirstOf[K interface{}](inputs ...*K) *K

FirstOf will return the first pointer which is not null. This is used when multiple optional options exist to fill a field, but they have an order of priority

func MergeMaps added in v0.1.7

func MergeMaps[K comparable, V comparable](maps ...map[K]V) map[K]V

func Pointer added in v0.1.7

func Pointer[K interface{}](input K) *K

Types

type Activity

type Activity struct {
	Title       string   `json:"title" mapstructure:"title"`
	Description string   `json:"description" mapstructure:"description"`
	Type        string   `json:"type" mapstructure:"type"`
	Steps       []Step   `json:"steps" mapstructure:"steps"`
	Tools       []string `json:"tools" mapstructure:"tools"`
}

type EvalOutput

type EvalOutput struct {
	Title               *string            `mapstructure:"title,omitempty"`
	Description         *string            `mapstructure:"description,omitempty"`
	Remarks             *string            `mapstructure:"remarks,omitempty"`
	Labels              *map[string]string `mapstructure:"labels,omitempty"`
	Violations          []Violation
	AdditionalVariables map[string]interface{}
}

type Labels added in v0.2.0

type Labels map[string]string
type Link struct {
	Text string `json:"text" mapstructure:"text"`
	URL  string `json:"href" mapstructure:"href"`
}

type Package

type Package string

func (Package) PurePackage

func (p Package) PurePackage() string

type Policy

type Policy struct {
	File        string
	Package     Package
	Annotations []*ast.Annotations
}

type PolicyManager

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

func New

func New(ctx context.Context, logger hclog.Logger, policyPath string) *PolicyManager

func (*PolicyManager) Execute

func (pm *PolicyManager) Execute(ctx context.Context, input interface{}) ([]Result, error)

func (*PolicyManager) GetRiskTemplates added in v0.3.0

func (pm *PolicyManager) GetRiskTemplates(ctx context.Context) (map[string][]*proto.RiskTemplate, error)

type PolicyProcessor added in v0.1.7

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

func NewPolicyProcessor added in v0.1.7

func NewPolicyProcessor(
	logger hclog.Logger,
	labels map[string]string,
	subjects []*proto.Subject,
	components []*proto.Component,
	inventoryItems []*proto.InventoryItem,
	actors []*proto.OriginActor,
	activities []*proto.Activity,
) *PolicyProcessor

func (*PolicyProcessor) GenerateResults added in v0.1.7

func (p *PolicyProcessor) GenerateResults(ctx context.Context, policyPath string, data interface{}) ([]*proto.Evidence, error)

type Remediation added in v0.3.0

type Remediation struct {
	Title       string            `json:"title" mapstructure:"title"`
	Description string            `json:"description" mapstructure:"description"`
	Tasks       []RemediationTask `json:"tasks" mapstructure:"tasks"`
}

type RemediationTask added in v0.3.0

type RemediationTask struct {
	Title string `json:"title" mapstructure:"title"`
}

type Result

type Result struct {
	Policy Policy
	*EvalOutput
}

func (Result) String

func (res Result) String() string

type Risk

type Risk struct {
	Title       string `json:"title" mapstructure:"title"`
	Description string `json:"description" mapstructure:"description"`
	Statement   string `json:"statement" mapstructure:"statement"`
	Links       []Link `json:"links" mapstructure:"links"`
}

type RiskTemplate added in v0.3.0

type RiskTemplate struct {
	Name           string       `json:"name" mapstructure:"name"`
	Title          string       `json:"title" mapstructure:"title"`
	Statement      string       `json:"statement" mapstructure:"statement"`
	LikelihoodHint string       `json:"likelihood_hint" mapstructure:"likelihood_hint"`
	ImpactHint     string       `json:"impact_hint" mapstructure:"impact_hint"`
	ViolationIds   []string     `json:"violation_ids" mapstructure:"violation_ids"`
	ThreatRefs     []ThreatRef  `json:"threat_refs" mapstructure:"threat_refs"`
	Remediation    *Remediation `json:"remediation,omitempty" mapstructure:"remediation"`

	DedupeLabelKeys []string                  `json:"dedupe_label_keys" mapstructure:"dedupe_label_keys"`
	LabelSchema     []RiskTemplateLabelSchema `json:"label_schema" mapstructure:"label_schema"`
}

type RiskTemplateLabelSchema added in v0.3.2

type RiskTemplateLabelSchema struct {
	Key         string `json:"key" mapstructure:"key"`
	Description string `json:"description" mapstructure:"description"`
}

type Step

type Step struct {
	Title       string `json:"title" mapstructure:"title"`
	Description string `json:"description" mapstructure:"description"`
}

type ThreatRef added in v0.3.0

type ThreatRef struct {
	System     string `json:"system" mapstructure:"system"`
	ExternalID string `json:"external_id" mapstructure:"external_id"`
	Title      string `json:"title" mapstructure:"title"`
	Url        string `json:"url" mapstructure:"url"`
}

type Violation

type Violation struct {
	ID          *string `json:"id,omitempty" mapstructure:"id"`
	Title       *string `json:"title,omitempty" mapstructure:"title"`
	Description *string `json:"description,omitempty" mapstructure:"description"`
	Remarks     *string `json:"remarks,omitempty" mapstructure:"remarks"`
}

Jump to

Keyboard shortcuts

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