policy

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GuardianDecision

type GuardianDecision struct {
	Allowed    bool    `json:"allowed"`
	Reason     string  `json:"reason"`
	Confidence float64 `json:"confidence"`
}

GuardianDecision is a provider-neutral automatic permission review response.

type PermissionRequest

type PermissionRequest struct {
	ToolName string `json:"tool_name"`
	ToolID   string `json:"tool_id,omitempty"`
	Summary  string `json:"summary,omitempty"`
}

PermissionRequest represents a user-facing approval request.

type PermissionVerdict

type PermissionVerdict struct {
	Allowed    bool    `json:"allowed"`
	Reason     string  `json:"reason,omitempty"`
	Rule       string  `json:"rule,omitempty"`
	Risk       Risk    `json:"risk"`
	Confidence float64 `json:"confidence,omitempty"`
	Source     string  `json:"source,omitempty"`
}

PermissionVerdict is the unified outcome type for permission subsystems.

func Allow

func Allow(reason string) PermissionVerdict

Allow returns a permissive verdict.

func Deny

func Deny(reason, rule string) PermissionVerdict

Deny returns a reject verdict with the given reason and rule.

func RequireApproval

func RequireApproval(reason, rule string, risk Risk) PermissionVerdict

RequireApproval returns a "needs human approval" verdict.

func (PermissionVerdict) IsZero

func (v PermissionVerdict) IsZero() bool

IsZero reports whether v is the zero value.

func (PermissionVerdict) String

func (v PermissionVerdict) String() string

String returns a one-line summary for logs.

type Risk

type Risk int

Risk is the severity of a permission or policy verdict.

const (
	RiskLow Risk = iota
	RiskMedium
	RiskHigh
	RiskBlocked
)

func ParseRisk

func ParseRisk(s string) (Risk, error)

ParseRisk parses a risk name (case-insensitive) into a Risk value.

func (Risk) String

func (r Risk) String() string

String returns a human-readable risk name.

Jump to

Keyboard shortcuts

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