policy_manager

package
v0.1.8 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2025 License: AGPL-3.0 Imports: 16 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 Control added in v0.1.5

type Control struct {
	Class        string   `json:"class" mapstructure:"class"`
	ControlID    string   `json:"control-id" mapstructure:"control-id"`
	StatementIDs []string `json:"statement-ids,omitempty" mapstructure:"statement-ids,omitempty"`
}

type EvalOutput

type EvalOutput struct {
	Title               *string   `mapstructure:"title,omitempty"`
	Description         *string   `mapstructure:"description,omitempty"`
	Remarks             *string   `mapstructure:"remarks,omitempty"`
	Risks               []Risk    `mapstructure:"risks"`
	Tasks               []Task    `mapstructure:"tasks"`
	Controls            []Control `mapstructure:"controls"`
	Violations          []Violation
	AdditionalVariables map[string]interface{}
}
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)

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.SubjectReference,
	components []*proto.ComponentReference,
	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.Observation, []*proto.Finding, error)

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 Step

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

type Task

type Task struct {
	Title       string     `json:"title" mapstructure:"title"`
	Description string     `json:"description" mapstructure:"description"`
	Activities  []Activity `json:"activities" mapstructure:"activities"`
}

type Violation

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

Jump to

Keyboard shortcuts

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