policy

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2026 License: AGPL-3.0 Imports: 2 Imported by: 0

Documentation

Overview

Package policy defines the agent's named permission tiers.

The tier is fixed by the operator at startup via DEVMON_POLICY_MODE and is immutable for the life of the process. A client can never widen what the operator granted — that is the agent's core security property.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Mode

type Mode int

Mode is a permission tier. Tiers are strict supersets of one another, which is what lets Allows be a single comparison rather than a set membership test.

const (
	// ModeReadOnly permits inspection only: list, inspect, logs.
	ModeReadOnly Mode = iota
	// ModeDefault adds non-destructive lifecycle control: start, restart, stop.
	// This is the tier chosen when DEVMON_POLICY_MODE is unset — useful out of
	// the box, but incapable of destroying anything.
	ModeDefault
	// ModeFull adds destructive operations: kill, delete.
	ModeFull
)

func ParseMode

func ParseMode(s string) (Mode, error)

ParseMode converts a DEVMON_POLICY_MODE value into a Mode.

The empty string yields ModeDefault, not ModeReadOnly: an unconfigured agent should be useful without being able to destroy anything. Parsing is exact — no case folding — so a typo surfaces as a startup error rather than as a silently different permission tier.

func (Mode) Allows

func (m Mode) Allows(op Operation) bool

Allows reports whether this tier permits op. Unknown operations are denied.

func (Mode) String

func (m Mode) String() string

String returns the wire name of the tier.

type Operation

type Operation string

Operation is a single agent capability that a Mode either permits or denies.

const (
	OpRead    Operation = "read"
	OpLogs    Operation = "logs"
	OpStart   Operation = "start"
	OpRestart Operation = "restart"
	OpStop    Operation = "stop"
	OpKill    Operation = "kill"
	OpDelete  Operation = "delete"
)

Jump to

Keyboard shortcuts

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