sessionguard

package
v0.77.3 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2026 License: MIT Imports: 0 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RowR01UnboundAllow      = "R01_unbound_allow"
	RowR02MatchAllow        = "R02_match_allow"
	RowR03MailboxRouted     = "R03_mailbox_routed_allow"
	RowR04IgnorePin         = "R04_ignore_pin_allow"
	RowR05SourceFromSession = "R05_source_from_session_allow"
	RowR06ListOwnBase       = "R06_list_own_base_allow"
	RowR07DoctorOwnBase     = "R07_doctor_own_base_allow"
	RowR08MismatchExit5     = "R08_mismatch_exit5"
	RowR09InvalidExit5      = "R09_invalid_pin_exit5"
	RowR10ListMismatchWarn  = "R10_list_mismatch_warn"
	RowR11ListInvalidWarn   = "R11_list_invalid_warn"
	RowR12DoctorMismatchErr = "R12_doctor_mismatch_structured_error"
	RowR13DoctorInvalidErr  = "R13_doctor_invalid_structured_error"
	RowR14RouteMismatchJSON = "R14_route_mismatch_json_error"
	RowR15RouteInvalidJSON  = "R15_route_invalid_json_error"
)

The 15 stable rows are policy decisions, not call sites. Keep their IDs reviewable because the site-to-row map and equivalence tests refer to them.

Variables

This section is empty.

Functions

This section is empty.

Types

type Channel

type Channel uint8
const (
	ChannelExit5 Channel = iota
	ChannelJSON
)

type Decision

type Decision struct {
	Row     string
	Verdict Verdict
}

func Decide

func Decide(in Input) Decision

Decide is the pure W2a policy table. Filesystem resolution, identity authentication, preflight validation, error construction, and output channels remain at the current call sites until Step 3 rewiring.

TargetRelationMismatch includes either a pin mismatch or a CWD conflict after the caller's evaluator has normalized those facts. Explicit roots and cross-project routing must not turn a pin mismatch into a match; they only affect the pre-table CWD check.

type Flags

type Flags struct {
	Routed          bool // participating mailbox target was --session-routed
	IgnorePin       bool // --ignore-session-pin passed caller preflight
	ExplicitRoot    bool // caller supplied an explicit root
	ExplicitContext bool // env --root/--session was visited
	CrossProject    bool // source guard serves a --project route
	FromSession     bool // send used --from-session source routing
	Revalidation    bool // watch/monitor callback phase; policy is unchanged
}

type Input

type Input struct {
	Kind     Kind
	Channel  Channel
	Pin      PinState
	Relation TargetRelation
	Flags    Flags
}

type Kind

type Kind uint8

Kind identifies the policy surface consuming the shared pin evaluator. Route explain is a source policy with a different output channel; it is intentionally not a second source policy.

const (
	KindMailbox Kind = iota
	KindSource
	KindList
	KindEnv
	KindDoctorRepair
)

type PinState

type PinState uint8
const (
	PinAbsent PinState = iota
	PinLegacy
	PinIdentity
	PinInvalid
)

type TargetRelation

type TargetRelation uint8
const (
	// The caller has already normalized the evaluator facts. Unbound includes
	// no pin and no established conflicting tree; CWD conflicts normalize to
	// Mismatch before this policy table is consulted.
	TargetUnbound TargetRelation = iota
	TargetMatch
	TargetMismatch
	TargetOwnPinnedBase
)

type Verdict

type Verdict uint8

These are the only public outcome channels in the policy table.

const (
	Allow Verdict = iota
	RefuseExit5
	WarnContinue
	StructuredErrorContinueExit0
	JSONErrorExit0
)

Jump to

Keyboard shortcuts

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