policy

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Apply

func Apply(cfg *config.Config, p *PolicyConfig)

func EvaluateViaOPA

func EvaluateViaOPA(policyPath string, findings []types.Finding) (string, error)

Types

type Condition

type Condition struct {
	Field    string      `yaml:"field"`
	Operator string      `yaml:"operator"`
	Value    interface{} `yaml:"value"`
}

type Policy

type Policy struct {
	Name        string    `yaml:"name"`
	Description string    `yaml:"description"`
	Condition   Condition `yaml:"condition"`
	Action      string    `yaml:"action"`
	Message     string    `yaml:"message"`
}

func LoadPolicies

func LoadPolicies(path string) ([]Policy, error)

type PolicyConfig

type PolicyConfig struct {
	Scan *struct {
		MinScore *int `yaml:"min_score"`
	} `yaml:"scan"`
}

func LoadFromFile

func LoadFromFile(path string) (*PolicyConfig, error)

func LoadFromURL

func LoadFromURL(url string) (*PolicyConfig, error)

type PolicySet

type PolicySet struct {
	Policies []Policy `yaml:"policies"`
}

type Violation

type Violation struct {
	PolicyName string        `json:"policy_name"`
	Message    string        `json:"message"`
	Action     string        `json:"action"`
	Finding    types.Finding `json:"finding,omitempty"`
}

func Evaluate

func Evaluate(findings []types.Finding, policies []Policy) []Violation

Jump to

Keyboard shortcuts

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