policy_manager

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2026 License: AGPL-3.0 Imports: 13 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 = policyeval.EvalOutput

The evaluation core lives in the API module's policyeval package, shared with the API's playback endpoint so both evaluate policies identically. These aliases keep this package's exported names stable for plugins.

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 = policyeval.Package

type Policy

type Policy = policyeval.Policy

type PolicyManager

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

func New

func New(ctx context.Context, logger hclog.Logger, policyPath string, policyData map[string]interface{}) *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,
	policyData map[string]interface{},
) *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 = policyeval.Result

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 = policyeval.Violation

Jump to

Keyboard shortcuts

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