config

package
v0.0.0-...-230ac96 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2026 License: Apache-2.0 Imports: 23 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

internal/config/ptrace.go

Index

Constants

View Source
const (
	DefaultRemotePolicyPollInterval = 5 * time.Minute
	DefaultRemotePolicyLongPoll     = 30 * time.Second
)

Default poll and long-poll durations, applied when the fields are empty.

View Source
const DefaultOnionooSource = "https://onionoo.torproject.org/details"

DefaultOnionooSource is the canonical relay-feed source used when the feed is enabled but no sources/local lists are configured.

Variables

View Source
var DefaultTorClientBinaries = []string{
	"tor", "obfs4proxy", "snowflake-client", "lyrebird", "meek-client", "torsocks",
}

DefaultTorClientBinaries is the recommended client-binary deny list.

Functions

func ApplyExternalProviderDefaults

func ApplyExternalProviderDefaults(cfg *PackageChecksConfig) []string

ApplyExternalProviderDefaults adjusts cfg in-place when one or more external providers are enabled:

  • if Scope is unset, promote to "all_installs"
  • if Scope is "new_packages_only", emit a validation warning naming the external provider(s) and recommending "all_installs"

Returns a list of human-readable warnings the caller should surface.

func ApplyFailMode

func ApplyFailMode(cfg *PackageChecksConfig, mode string)

ApplyFailMode sets OnFailure on every enabled external provider to match the resolved fail mode. Mapping:

open     → "allow"
closed   → "deny"
degraded → "warn"

External providers are those listed in externalProviderNames. Other providers (osv, depsdev, local) keep whatever OnFailure the user set.

Per-provider explicit `on_failure` always wins: if a provider already has a non-empty OnFailure, it is preserved. Fail mode only fills in providers that did not configure on_failure themselves, so an operator can override the global mode for a single provider.

func CompileBlockOn

func CompileBlockOn(b BlockOnConfig) []policy.PackageRule

CompileBlockOn translates the BlockOnConfig shorthand into a list of policy.PackageRule entries (first-match-wins) ending in a catch-all allow.

Use this variant when block_on is the sole rule source — the catch-all allow ensures unmatched findings pass through rather than hitting the evaluator's default-deny. When merging with an operator policy engine, use CompileBlockOnRules instead so the engine's catch-all (or deliberate omission of one) is not shadowed.

func CompileBlockOnRules

func CompileBlockOnRules(b BlockOnConfig) []policy.PackageRule

CompileBlockOnRules translates the BlockOnConfig shorthand into a list of typed policy.PackageRule entries (first-match-wins) WITHOUT a trailing catch-all allow rule.

Use this variant when merging block_on rules with an operator policy engine that may deliberately omit a catch-all (fail-closed intent). Adding a catch-all in that context would silently override the operator's default-deny.

For each finding type we emit deny rules for severities at or above the threshold, warn rules for severities below the threshold but still noteworthy (currently: high vulns become warn even when threshold is critical).

func DefaultDataDir

func DefaultDataDir() string

DefaultDataDir returns the system data directory only when this process can actually write it.

Where the config file lives says nothing about what the daemon may write. A user-level daemon reading /etc/agentmon/config.yaml still cannot create /var/lib/agentmon, and both shipped units run as the logged-in user: a systemd --user service and a launchd LaunchAgent. Resolving on the effective uid answers the question that is actually being asked.

It is exported because the CLI subcommands need the same answer when they have no config to read: `agentmon checkpoint list` against a missing config used to reach for the system path and fail on mkdir.

func EffectiveSyscallBlock

func EffectiveSyscallBlock(in SandboxSeccompConfig) ([]string, string, error)

func FileMonitorBoolWithDefault

func FileMonitorBoolWithDefault(v *bool, defaultVal bool) bool

FileMonitorBoolWithDefault returns the value of a *bool field, or defaultVal if nil.

func GetBundleResourcesDir

func GetBundleResourcesDir() string

GetBundleResourcesDir returns the Resources directory inside the macOS .app bundle, or empty string if not running from a bundle or not on macOS.

func GetConfigDir

func GetConfigDir() string

GetConfigDir returns the platform-appropriate config directory.

func GetDataDir

func GetDataDir() string

GetDataDir returns the platform-appropriate data directory.

func GetMountPoint

func GetMountPoint(cfg *Config) string

GetMountPoint returns the appropriate mount point for the current platform.

func GetPoliciesDir

func GetPoliciesDir() string

GetPoliciesDir returns the platform-appropriate policies directory.

func GetUserConfigDir

func GetUserConfigDir() string

GetUserConfigDir returns the user-specific config directory.

func GetUserDataDir

func GetUserDataDir() string

GetUserDataDir returns the user-specific data directory.

func GetUserStateDir

func GetUserStateDir() string

GetUserStateDir returns the user-specific state directory used for ephemeral runtime artifacts (e.g., WTP WAL/cursor/replay store).

Linux: honors XDG_STATE_HOME with a fallback to ~/.local/state, per the XDG Base Directory Specification.

macOS: there is no canonical state directory; we reuse the same path as GetUserDataDir (~/Library/Application Support/agentmon).

Windows: state lives under LOCALAPPDATA (non-roaming), NOT APPDATA. This is a deliberate divergence from GetUserDataDir, which uses APPDATA (roaming). Per-machine WAL segments, cursor positions, and replay-store shards must not be roamed across hosts: they are tightly coupled to the node's seq counter and would corrupt the chain if synced. State here is machine-local by design; user-facing data (settings, history) stays in APPDATA where roaming is appropriate.

func InitializePlatform

func InitializePlatform(cfg *Config) (platform.Platform, error)

InitializePlatform creates and configures a platform based on the config.

func LoadWithSource

func LoadWithSource(path string, source ConfigSource) (*Config, ConfigSource, error)

LoadWithSource loads config from path and returns the config along with its source. The source parameter indicates where this config path came from.

func ParseByteSize

func ParseByteSize(s string) (int64, error)

func PolicyDiff

func PolicyDiff(oldPolicy, newPolicy *PolicyFiles) string

PolicyDiff computes a summary of changes between policies.

func PolicySocketPathIsDefault

func PolicySocketPathIsDefault(path string) bool

PolicySocketPathIsDefault reports whether the configured path is the one the system extension will look for.

The extension cannot be told a custom path: it runs as root, starts independently of the daemon, and has no channel to the daemon that does not itself run over this socket. So a custom path silently costs all macOS enforcement, and callers use this to say so rather than leaving the operator to discover it.

func PolicyVersion

func PolicyVersion(content []byte) string

PolicyVersion computes a version hash for policy content.

func ResolveBlockedFamilies

func ResolveBlockedFamilies(in []SandboxSeccompSocketFamilyConfig) ([]seccomp.BlockedFamily, error)

ResolveBlockedFamilies converts YAML-typed entries into the engine-typed slice consumed by FilterConfigFromYAML / FamilyChecker. Empty Action defaults to errno. Returns an error if any entry has an unknown family or an invalid action string.

func ResolveEffectiveBlockedFamilies

func ResolveEffectiveBlockedFamilies(in SandboxSeccompConfig) ([]seccomp.BlockedFamily, error)

func ResolveFailMode

func ResolveFailMode(cfg *PackageChecksConfig) string

ResolveFailMode returns the effective fail mode, honoring the PKGCHECK_FAIL_MODE env var override. Defaults to "degraded".

func ResolveSocketRules

func ResolveSocketRules(in SandboxSeccompConfig) ([]seccomp.SocketRule, error)

func ValidateMCPTransports

func ValidateMCPTransports(cfg SandboxMCPConfig) error

ValidateMCPTransports checks that all declared MCP servers use allowed transports.

func ValidatePolicyFiles

func ValidatePolicyFiles(policies *PolicyFiles) error

ValidatePolicyFiles validates the loaded policy files.

func WaitKillableFilterCompositionTriggersBug

func WaitKillableFilterCompositionTriggersBug(cfg SandboxConfig) bool

WaitKillableFilterCompositionTriggersBug returns true when the effective seccomp filter for the given config would install notify rules from both the socket family (unix_socket / top-level unix_sockets) AND the file/metadata family (file_monitor or intercept_metadata). This is the known-bad combination from issue #369: on kernels that lie about WAIT_KILLABLE_RECV support (e.g. 6.12.67 with ProcessVMReadv=ENOSYS), the wrapped process is killed by signal during the post-execve syscall storm when this combination is present together with WAIT_KILLABLE_RECV.

It takes the whole SandboxConfig so socket-family detection uses the same OR the wrapper does (UnixSocketNotifyEnabled), and resolves FileMonitor.* defaults exactly as buildSeccompWrapperConfig does — so the gotcha in the issue's bisection table (file_monitor.enabled=false with enforce_without_fuse=true still installs metadata notify rules) is caught.

Types

type AWSKMSConfig

type AWSKMSConfig struct {
	KeyID            string `yaml:"key_id"`             // KMS key ARN or alias
	Region           string `yaml:"region"`             // AWS region
	EncryptedDEKFile string `yaml:"encrypted_dek_file"` // Optional path to cache encrypted DEK
}

AWSKMSConfig configures AWS KMS integration.

type ApprovalsConfig

type ApprovalsConfig struct {
	Enabled  bool           `yaml:"enabled"`
	Mode     string         `yaml:"mode"`    // "local_tty", "api", "totp", "webauthn", or "gui"
	Timeout  string         `yaml:"timeout"` // duration string, e.g. "5m"
	WebAuthn WebAuthnConfig `yaml:"webauthn"`
}

func (*ApprovalsConfig) Validate

func (c *ApprovalsConfig) Validate(goos, policySocketTeamID string) error

Validate checks approvals.mode.

An unrecognised mode used to be accepted and then behave as api mode, because approvals.Manager only special-cases the modes it knows. A typo therefore gave the operator a mode that waits for an API call nobody makes.

type AuditConfig

type AuditConfig struct {
	Enabled  bool           `yaml:"enabled"`
	Output   string         `yaml:"output"`
	Rotation RotationConfig `yaml:"rotation"`

	// Storage is agentmon-specific (not in spec config yet): local DB path.
	Storage AuditStorageConfig `yaml:"storage"`

	// Optional: ship events to an HTTP webhook.
	Webhook AuditWebhookConfig `yaml:"webhook"`

	// Integrity configures tamper-proof audit logging with HMAC chains.
	Integrity AuditIntegrityConfig `yaml:"integrity"`

	// Encryption configures AES-256-GCM encryption at rest.
	Encryption AuditEncryptionConfig `yaml:"encryption"`

	// OTEL configures OpenTelemetry event export.
	OTEL AuditOTELConfig `yaml:"otel"`

	// Watchtower configures the WTP (Watchtower Transport Protocol) sink.
	Watchtower AuditWatchtowerConfig `yaml:"watchtower"`
}

type AuditEncryptionConfig

type AuditEncryptionConfig struct {
	Enabled   bool   `yaml:"enabled"`
	KeySource string `yaml:"key_source"` // file, env
	KeyFile   string `yaml:"key_file"`
	KeyEnv    string `yaml:"key_env"`
}

AuditEncryptionConfig configures encryption at rest.

type AuditIntegrityConfig

type AuditIntegrityConfig struct {
	Enabled   bool   `yaml:"enabled"`
	Algorithm string `yaml:"algorithm"` // hmac-sha256 (default), hmac-sha512

	// Key source (mutually exclusive options)
	KeySource string `yaml:"key_source"` // file, env, aws_kms, azure_keyvault, hashicorp_vault, gcp_kms

	// File/Env source (legacy, still supported)
	KeyFile string `yaml:"key_file"` // Path to HMAC key file
	KeyEnv  string `yaml:"key_env"`  // Or env var name containing key

	// AWS KMS configuration
	AWSKMS AWSKMSConfig `yaml:"aws_kms"`

	// Azure Key Vault configuration
	AzureKeyVault AzureKeyVaultConfig `yaml:"azure_keyvault"`

	// HashiCorp Vault configuration
	HashiCorpVault HashiCorpVaultConfig `yaml:"hashicorp_vault"`

	// GCP Cloud KMS configuration
	GCPKMS GCPKMSConfig `yaml:"gcp_kms"`
}

AuditIntegrityConfig configures tamper-proof audit logging.

type AuditOTELConfig

type AuditOTELConfig struct {
	Enabled  bool               `yaml:"enabled"`
	Endpoint string             `yaml:"endpoint"`
	Protocol string             `yaml:"protocol"` // "grpc" or "http"
	TLS      OTELTLSConfig      `yaml:"tls"`
	Headers  map[string]string  `yaml:"headers"`
	Timeout  string             `yaml:"timeout"`
	Signals  OTELSignalsConfig  `yaml:"signals"`
	Batch    OTELBatchConfig    `yaml:"batch"`
	Filter   OTELFilterConfig   `yaml:"filter"`
	Resource OTELResourceConfig `yaml:"resource"`
}

AuditOTELConfig configures OpenTelemetry event export.

type AuditStorageConfig

type AuditStorageConfig struct {
	Enabled       *bool         `yaml:"enabled"` // defaults to true; set false to skip SQLite
	SQLitePath    string        `yaml:"sqlite_path"`
	BatchSize     int           `yaml:"batch_size"`     // events per batch (default 64)
	FlushInterval time.Duration `yaml:"flush_interval"` // max time before flush (default 50ms)
	ChannelSize   int           `yaml:"channel_size"`   // async buffer capacity (default 4096)
}

type AuditWatchtowerConfig

type AuditWatchtowerConfig struct {
	Enabled   bool   `yaml:"enabled"`
	Endpoint  string `yaml:"endpoint"`   // host:port
	SessionID string `yaml:"session_id"` // optional; auto-generated ULID if empty
	// AgentID is the operator-visible identifier for this agent on the
	// Watchtower wire. When empty (the default), buildWatchtowerStore
	// falls back to os.Hostname() — preserving pre-existing behaviour
	// from before this field existed.
	//
	// Mirrors SessionID: optional in YAML, resolved at store-construction
	// time (NOT in applyDefaults — non-daemon CLI subcommands like
	// `agentmon config show` must not trigger hostname lookup).
	AgentID       string `yaml:"agent_id"`
	StateDir      string `yaml:"state_dir"` // default GetUserStateDir() + "/wtp"; per-OS path differs (XDG_STATE_HOME on Linux, LOCALAPPDATA on Windows). See defaultWatchtowerStateDir.
	EphemeralMode bool   `yaml:"ephemeral_mode"`

	// LogGoawayMessage controls whether the WARN log emitted on GOAWAY
	// receipt includes the server-supplied message text (after client-
	// side sanitization). Three-state:
	//   nil   — field omitted from YAML; resolved to PRD default at
	//           store-construction time. The store-construction path
	//           emits a single INFO at startup announcing the resolved
	//           default so operators can audit a future default-flip.
	//   false — explicit operator-set; same runtime behavior as nil today.
	//   true  — opt in to verbatim sanitized goaway_message logging.
	//           Store-construction emits a single WARN at startup
	//           reminding the operator that this depends on the server-
	//           side no-secrets contract documented at
	//           proto/canyonroad/wtp/v1/wtp.proto (Goaway.message) in the
	//           github.com/canyonroad/wtp-protos repo.
	//
	// This pointer-form is mandatory: a plain bool would collapse "unset"
	// into "explicit false" before the daemon could distinguish them,
	// preventing a future schema-major-bump default-flip from being
	// detectable in audit logs.
	//
	// IMPORTANT: Defaulting MUST NOT happen in applyDefaults/applyDefaultsWithSource.
	// The nil state must survive the config-load pipeline. Defaulting occurs
	// ONLY at store-construction time (buildWatchtowerStore in internal/server/wtp.go).
	LogGoawayMessage *bool `yaml:"log_goaway_message,omitempty"`

	TLS       WatchtowerTLSConfig       `yaml:"tls"`
	Auth      WatchtowerAuthConfig      `yaml:"auth"`
	Chain     WatchtowerChainConfig     `yaml:"chain"`
	Batch     WatchtowerBatchConfig     `yaml:"batch"`
	WAL       WatchtowerWALConfig       `yaml:"wal"`
	Heartbeat WatchtowerHeartbeatConfig `yaml:"heartbeat"`
	Backoff   WatchtowerBackoffConfig   `yaml:"backoff"`
	Filter    WatchtowerFilterConfig    `yaml:"filter"`

	// DecisionContext is reported to Watchtower on SessionInit so the
	// server can resolve the bound policy from identity + environment.
	DecisionContext WatchtowerDecisionContextConfig `yaml:"decision_context"`

	// EmitExtendedLossReasons controls whether the WTP client emits
	// TransportLoss frames with the six reason values added in the
	// 2026-04-27 spec: MAPPER_FAILURE, INVALID_MAPPER, INVALID_TIMESTAMP,
	// INVALID_UTF8, SEQUENCE_OVERFLOW, ACK_REGRESSION_AFTER_GC.
	//
	// Default false. Strict-enum receivers reject unknown enum values
	// per the TRANSPORT_LOSS_REASON_UNSPECIFIED contract (Goaway on
	// unknown). Operators flip this to true once their receiving
	// Watchtower instance has been upgraded.
	//
	// OVERFLOW and CRC_CORRUPTION are always emitted (they predate this
	// spec and are part of the original wire schema) — those reasons
	// are not gated by this flag.
	EmitExtendedLossReasons bool `yaml:"emit_extended_loss_reasons"`
}

AuditWatchtowerConfig configures the WTP (Watchtower Transport Protocol) sink. Spec: docs/superpowers/specs/2026-04-18-wtp-client-design.md §"Configuration & Wiring".

type AuditWebhookConfig

type AuditWebhookConfig struct {
	URL           string            `yaml:"url"`
	BatchSize     int               `yaml:"batch_size"`
	FlushInterval string            `yaml:"flush_interval"`
	Timeout       string            `yaml:"timeout"`
	Headers       map[string]string `yaml:"headers"`
}

type AuthAPIKeyConfig

type AuthAPIKeyConfig struct {
	KeysFile   string `yaml:"keys_file"`
	HeaderName string `yaml:"header_name"`
}

type AuthConfig

type AuthConfig struct {
	Type   string           `yaml:"type"` // "api_key", "oidc", "hybrid"
	APIKey AuthAPIKeyConfig `yaml:"api_key"`
	OIDC   OIDCConfig       `yaml:"oidc"`
}

type AutoCheckpointConfig

type AutoCheckpointConfig struct {
	Enabled  bool     `yaml:"enabled"`
	Triggers []string `yaml:"triggers"` // Commands that trigger auto-checkpoint (e.g., "rm", "mv")
}

AutoCheckpointConfig configures automatic checkpointing before risky commands.

type AzureKeyVaultConfig

type AzureKeyVaultConfig struct {
	VaultURL   string `yaml:"vault_url"`   // Vault URL (e.g., https://myvault.vault.azure.net)
	KeyName    string `yaml:"key_name"`    // Secret name in vault
	KeyVersion string `yaml:"key_version"` // Optional version (empty = latest)
}

AzureKeyVaultConfig configures Azure Key Vault integration.

type BlockOnConfig

type BlockOnConfig struct {
	Malware       string `yaml:"malware" json:"malware"`
	Vulnerability string `yaml:"vulnerability" json:"vulnerability"`
	License       string `yaml:"license" json:"license"`
	Reputation    string `yaml:"reputation" json:"reputation"`
	Provenance    string `yaml:"provenance" json:"provenance"`
}

BlockOnConfig is the per-finding-type severity-threshold shorthand:

malware:       any | critical | never
vulnerability: critical | high | medium | never
license:       any | never
reputation:    any | never
provenance:    any | never

func (BlockOnConfig) Validate

func (b BlockOnConfig) Validate() error

Validate ensures every field in BlockOnConfig holds an enum value from its documented set. Empty strings are permitted (treated as "no rule for this finding type"). Unknown values fail loudly so a typo like "critcal" doesn't compile to permissive policy.

type BurstConfig

type BurstConfig struct {
	Enabled  bool          `yaml:"enabled"`
	MaxCalls int           `yaml:"max_calls"` // default: 10
	Window   time.Duration `yaml:"window"`    // default: 5s
}

BurstConfig detects rapid-fire tool calls that may indicate exfiltration.

type CapabilitiesConfig

type CapabilitiesConfig struct {
	Allow []string `yaml:"allow"` // Capabilities to keep (empty = drop all droppable)
}

CapabilitiesConfig controls Linux capability dropping.

type CheckpointConfig

type CheckpointConfig struct {
	Enabled        bool                      `yaml:"enabled"`
	StorageDir     string                    `yaml:"storage_dir"`     // Directory for checkpoint storage
	MaxPerSession  int                       `yaml:"max_per_session"` // Max checkpoints per session (0 = unlimited)
	MaxSizeMB      int                       `yaml:"max_size_mb"`     // Max total size per session (0 = unlimited)
	AutoCheckpoint AutoCheckpointConfig      `yaml:"auto_checkpoint"`
	Retention      CheckpointRetentionConfig `yaml:"retention"`
}

CheckpointConfig configures workspace checkpoint and rollback.

type CheckpointRetentionConfig

type CheckpointRetentionConfig struct {
	MaxAge          string `yaml:"max_age"`          // Duration string, e.g., "24h"
	CleanupInterval string `yaml:"cleanup_interval"` // How often to run cleanup
}

CheckpointRetentionConfig configures checkpoint cleanup.

type Config

type Config struct {
	// DataDir is where the daemon keeps state it writes at runtime: the
	// threat-feed cache, the Tor relay cache, the policy cache. Its default
	// follows the config source, so a user-level daemon writes under the
	// user's data directory and a system one under /var/lib.
	//
	// The three caches used to call GetDataDir() directly, which always
	// returns the system path. Both shipped units run the daemon as the
	// logged-in user -- a systemd --user service and a launchd LaunchAgent --
	// so every one of those writes failed, and each failure was a warning at
	// first use rather than anything that stopped startup.
	DataDir string `yaml:"data_dir"`

	Platform          PlatformConfig          `yaml:"platform"`
	Server            ServerConfig            `yaml:"server"`
	Auth              AuthConfig              `yaml:"auth"`
	Logging           LoggingConfig           `yaml:"logging"`
	Audit             AuditConfig             `yaml:"audit"`
	Sessions          SessionsConfig          `yaml:"sessions"`
	Sandbox           SandboxConfig           `yaml:"sandbox"`
	Policies          PoliciesConfig          `yaml:"policies"`
	MountProfiles     map[string]MountProfile `yaml:"mount_profiles"`
	Approvals         ApprovalsConfig         `yaml:"approvals"`
	Metrics           MetricsConfig           `yaml:"metrics"`
	Health            HealthConfig            `yaml:"health"`
	Development       DevelopmentConfig       `yaml:"development"`
	Proxy             ProxyConfig             `yaml:"proxy"`
	DLP               DLPConfig               `yaml:"dlp"`
	LLMStorage        LLMStorageConfig        `yaml:"llm_storage"`
	Security          SecurityConfig          `yaml:"security"`
	Landlock          LandlockConfig          `yaml:"landlock"`
	LinuxCapabilities CapabilitiesConfig      `yaml:"capabilities"`
	ThreatFeeds       ThreatFeedsConfig       `yaml:"threat_feeds"`
	Tor               TorConfig               `yaml:"tor"`
	PackageChecks     PackageChecksConfig     `yaml:"package_checks"`
	Skillcheck        SkillcheckConfig        `yaml:"skillcheck"`
	PolicySocket      PolicySocketConfig      `yaml:"policy_socket"`
	Inspection        InspectionConfig        `yaml:"inspection"`
}

func Load

func Load(path string) (*Config, error)

func (*Config) ResolvedDataDir

func (c *Config) ResolvedDataDir() string

ResolvedDataDir returns the directory the daemon writes runtime state to.

It falls back to DefaultDataDir only for a Config that never went through Load -- tests build Config{} directly -- so a real daemon always gets the source-aware value, and the fallback is still one this process can write.

type ConfigSource

type ConfigSource int

ConfigSource indicates where the configuration was loaded from.

const (
	// ConfigSourceEnv means config path was specified via AGENTMON_CONFIG env var.
	ConfigSourceEnv ConfigSource = iota
	// ConfigSourceUser means config was loaded from user-local directory.
	ConfigSourceUser
	// ConfigSourceSystem means config was loaded from system-wide directory.
	ConfigSourceSystem
	// ConfigSourceBundle means config was loaded from the macOS .app bundle Resources.
	ConfigSourceBundle
)

func (ConfigSource) String

func (s ConfigSource) String() string

String returns a human-readable name for the config source.

type CrossServerConfig

type CrossServerConfig struct {
	Enabled         bool                  `yaml:"enabled"`
	ReadThenSend    ReadThenSendConfig    `yaml:"read_then_send"`
	Burst           BurstConfig           `yaml:"burst"`
	CrossServerFlow CrossServerFlowConfig `yaml:"cross_server_flow"`
	ShadowTool      ShadowToolConfig      `yaml:"shadow_tool"`
}

CrossServerConfig configures cross-server pattern detection. These patterns detect potentially malicious multi-server tool call sequences (e.g., reading secrets from one server then sending them via another).

type CrossServerFlowConfig

type CrossServerFlowConfig struct {
	Enabled      bool          `yaml:"enabled"`
	SameTurnOnly *bool         `yaml:"same_turn_only"` // default: true
	Window       time.Duration `yaml:"window"`         // default: 30s
}

CrossServerFlowConfig detects tool calls that flow across different servers.

type CustomPatternConfig

type CustomPatternConfig struct {
	Name    string `yaml:"name"`
	Display string `yaml:"display"`
	Regex   string `yaml:"regex"`
}

type DLPConfig

type DLPConfig struct {
	Mode           string                `yaml:"mode"`
	Patterns       DLPPatternsConfig     `yaml:"patterns"`
	CustomPatterns []CustomPatternConfig `yaml:"custom_patterns"`
}

func DefaultDLPConfig

func DefaultDLPConfig() DLPConfig

type DLPPatternsConfig

type DLPPatternsConfig struct {
	Email      bool `yaml:"email"`
	Phone      bool `yaml:"phone"`
	CreditCard bool `yaml:"credit_card"`
	SSN        bool `yaml:"ssn"`
	APIKeys    bool `yaml:"api_keys"`
}

type DNSPolicyConfig

type DNSPolicyConfig struct {
	Rules []DNSPolicyRule `yaml:"rules"`
}

DNSPolicyConfig configures DNS query policy.

type DNSPolicyRule

type DNSPolicyRule struct {
	Name     string             `yaml:"name"`
	Patterns []string           `yaml:"patterns"` // glob patterns like "*.malware.com"
	Action   string             `yaml:"action"`   // allow, deny, redirect
	Redirect *DNSRedirectConfig `yaml:"redirect,omitempty"`
}

DNSPolicyRule defines a DNS policy rule.

type DNSRedirectConfig

type DNSRedirectConfig struct {
	IPAddress string `yaml:"ip_address"`
}

DNSRedirectConfig configures DNS redirect behavior.

type DevelopmentConfig

type DevelopmentConfig struct {
	Debug         bool `yaml:"debug"`
	DisableAuth   bool `yaml:"disable_auth"`
	DisablePolicy bool `yaml:"disable_policy"`

	PProf DevelopmentPProfConfig `yaml:"pprof"`
}

type DevelopmentPProfConfig

type DevelopmentPProfConfig struct {
	Enabled bool   `yaml:"enabled"`
	Addr    string `yaml:"addr"`
}

type DomainRateLimit

type DomainRateLimit struct {
	RequestsPerMinute int `yaml:"requests_per_minute"`
	Burst             int `yaml:"burst"`
}

DomainRateLimit defines rate limits for a domain.

type EffectiveSeccompRules

type EffectiveSeccompRules struct {
	SocketRules           []SandboxSeccompSocketRuleConfig
	BlockedSocketFamilies []SandboxSeccompSocketFamilyConfig
	SyscallBlock          []string
	SyscallOnBlock        string
	LoadedMitigations     []MitigationLoadInfo
}

func EffectiveSeccompRulesForConfig

func EffectiveSeccompRulesForConfig(in SandboxSeccompConfig) (EffectiveSeccompRules, error)

type EnvPolicyConfig

type EnvPolicyConfig struct {
	Allow          []string `yaml:"allow"`
	Deny           []string `yaml:"deny"`
	MaxBytes       int      `yaml:"max_bytes"`
	MaxKeys        int      `yaml:"max_keys"`
	BlockIteration bool     `yaml:"block_iteration"`
}

type EnvProtectionPolicy

type EnvProtectionPolicy struct {
	Enabled               bool     `yaml:"enabled"`
	Mode                  string   `yaml:"mode"` // "allowlist" or "blocklist"
	Allowlist             []string `yaml:"allowlist"`
	Blocklist             []string `yaml:"blocklist"`
	SensitivePatterns     []string `yaml:"sensitive_patterns"`
	RedactInsteadOfRemove bool     `yaml:"redact_instead_of_remove"`
	RedactPlaceholder     string   `yaml:"redact_placeholder"`
	LogAccess             bool     `yaml:"log_access"`
	AlertOnSensitive      bool     `yaml:"alert_on_sensitive"`
}

EnvProtectionPolicy configures environment variable protection.

type Environment

type Environment struct {
	OS             string
	InContainer    bool
	InWSL          bool
	InDevContainer bool
}

Environment contains information about the current runtime environment.

func DetectEnvironment

func DetectEnvironment() Environment

DetectEnvironment returns information about the current runtime environment.

type ExecveConfig

type ExecveConfig struct {
	Enabled               bool          `yaml:"enabled"`
	MaxArgc               int           `yaml:"max_argc"`
	MaxArgvBytes          int           `yaml:"max_argv_bytes"`
	OnTruncated           string        `yaml:"on_truncated"` // deny | allow | approval
	ApprovalTimeout       time.Duration `yaml:"approval_timeout"`
	ApprovalTimeoutAction string        `yaml:"approval_timeout_action"` // deny | allow
	InternalBypass        []string      `yaml:"internal_bypass"`
}

ExecveConfig configures execve/execveat interception.

func DefaultExecveConfig

func DefaultExecveConfig() ExecveConfig

DefaultExecveConfig returns secure defaults.

type FUSEAuditConfig

type FUSEAuditConfig struct {
	Enabled              *bool  `yaml:"enabled"`
	Mode                 string `yaml:"mode"` // monitor, soft_block, soft_delete, strict
	TrashPath            string `yaml:"trash_path"`
	TTL                  string `yaml:"ttl"`
	Quota                string `yaml:"quota"`
	StrictOnAuditFailure bool   `yaml:"strict_on_audit_failure"`
	MaxEventQueue        int    `yaml:"max_event_queue"`
	HashSmallFilesUnder  string `yaml:"hash_small_files_under"`
}

type FilePolicyConfig

type FilePolicyConfig struct {
	DefaultAction string           `yaml:"default_action"` // deny, allow, approve
	Rules         []FilePolicyRule `yaml:"rules"`
}

FilePolicyConfig configures file access policy.

type FilePolicyRule

type FilePolicyRule struct {
	Name           string              `yaml:"name"`
	Paths          []string            `yaml:"paths"`
	Operations     []string            `yaml:"operations"` // read, write, create, delete, rename, stat
	Action         string              `yaml:"action"`     // allow, deny, approve, redirect
	TimeoutSeconds int                 `yaml:"timeout_seconds,omitempty"`
	Redirect       *FileRedirectConfig `yaml:"redirect,omitempty"`
}

FilePolicyRule defines a file access rule.

type FileRedirectConfig

type FileRedirectConfig struct {
	FilePath string `yaml:"file_path"`
}

FileRedirectConfig configures file redirect behavior.

type GCPKMSConfig

type GCPKMSConfig struct {
	KeyName          string `yaml:"key_name"`           // Full key resource name
	EncryptedDEKFile string `yaml:"encrypted_dek_file"` // Optional path to cache encrypted DEK
}

GCPKMSConfig configures GCP Cloud KMS integration.

type HashiCorpVaultConfig

type HashiCorpVaultConfig struct {
	Address    string `yaml:"address"`         // Vault address
	AuthMethod string `yaml:"auth_method"`     // token, kubernetes, approle
	TokenFile  string `yaml:"token_file"`      // Path to token file (for token auth)
	K8sRole    string `yaml:"kubernetes_role"` // Role name (for kubernetes auth)
	AppRoleID  string `yaml:"approle_id"`      // Role ID (for approle auth)
	SecretID   string `yaml:"secret_id"`       // Secret ID (for approle auth, or use VAULT_SECRET_ID env)
	SecretPath string `yaml:"secret_path"`     // Path to secret (e.g., secret/data/agentmon/audit-key)
	KeyField   string `yaml:"key_field"`       // Field name within secret (default: "key")
}

HashiCorpVaultConfig configures HashiCorp Vault integration.

type HealthConfig

type HealthConfig struct {
	Path          string `yaml:"path"`
	ReadinessPath string `yaml:"readiness_path"`
}

type InspectPrivacyConfig

type InspectPrivacyConfig struct {
	// AllowRemote permits providers that do not run in-process to see
	// content at all.
	AllowRemote bool `yaml:"allow_remote"`

	// RemoteKinds restricts which content kinds may reach a remote
	// provider: file, command, network, proxy_body, mcp_args. Empty with
	// AllowRemote set means every kind may.
	RemoteKinds []string `yaml:"remote_kinds,omitempty"`
}

InspectPrivacyConfig gates what content may leave the machine.

The zero value permits nothing remote. This differs from most config in this file, where the zero value is a disabled feature rather than a closed door, and it differs deliberately: inspection sends the content itself, not a name or a hash, so an unconfigured remote provider that silently received request bodies would be the worst possible default.

type InspectProviderConfig

type InspectProviderConfig struct {
	// Enabled must be true for the provider to be built. A disabled
	// provider is not a missing one: a policy profile naming it still
	// fails at startup, with the reason that it is disabled.
	Enabled bool `yaml:"enabled"`

	// Type selects the implementation: regex, sidecar, shieldstral or
	// privacy_filter. regex and privacy_filter run in-process; sidecar and
	// shieldstral send content over HTTP and are gated by privacy below.
	Type string `yaml:"type"`

	// Patterns adds or overrides regex categories, for type: regex. The
	// key is the category name a profile lists under `categories:`.
	Patterns map[string]string `yaml:"patterns,omitempty"`

	// APIKeyEnv names the environment variable holding this provider's
	// credential, for provider types that need one.
	APIKeyEnv string `yaml:"api_key_env,omitempty"`

	// Options carries provider-specific settings.
	Options map[string]any `yaml:"options,omitempty"`
}

InspectProviderConfig configures one inspection provider.

type InspectionConfig

type InspectionConfig struct {
	// Enabled turns the inspection runtime on. A policy containing inspect
	// rules will not load while this is false: every one of those rules
	// would deny, inverting what the operator wrote.
	Enabled bool `yaml:"enabled"`

	// Providers are the available inspectors, keyed by the name a policy
	// profile refers to in its `provider:` field.
	Providers map[string]InspectProviderConfig `yaml:"providers,omitempty"`

	// Privacy gates what content may reach a provider that is not local.
	Privacy InspectPrivacyConfig `yaml:"privacy"`

	// MaxBodyBytes caps how much of a request body is buffered for
	// inspection. Zero uses the proxy package default (8 MiB).
	//
	// Exceeding it is a failed inspection, not a skip, so the rule's
	// on_failure decides -- a deny by default. Set it above the largest
	// payload the agent legitimately sends, or the block will look like a
	// policy that is working rather than a limit that was too low.
	MaxBodyBytes int64 `yaml:"max_body_bytes,omitempty"`

	// ProviderTimeout bounds a single provider call. Zero uses the
	// package default. A rule's own `inspect.timeout` bounds the whole
	// inspection across every profile, and is the tighter of the two in
	// practice.
	ProviderTimeout time.Duration `yaml:"provider_timeout,omitempty"`
}

InspectionConfig configures the content inspection runtime: which providers exist, what may leave the machine, and how long a provider gets.

It is NOT where inspection profiles are defined. Profiles live in the policy's own `inspection.profiles` block, because they are policy — which categories to look for, which questions to ask, what to do about a finding. This block is deployment: which inspector binaries or endpoints this host can actually reach. The same policy therefore runs on a host with a local regex provider and on one with a model-backed provider, without editing.

type LLMRateLimitsConfig

type LLMRateLimitsConfig struct {
	Enabled           bool `yaml:"enabled"`
	RequestsPerMinute int  `yaml:"requests_per_minute"`
	RequestBurst      int  `yaml:"request_burst"`
	TokensPerMinute   int  `yaml:"tokens_per_minute"`
	TokenBurst        int  `yaml:"token_burst"`
}

LLMRateLimitsConfig configures rate limiting for LLM API calls.

type LLMStorageConfig

type LLMStorageConfig struct {
	StoreBodies bool                      `yaml:"store_bodies"`
	Retention   LLMStorageRetentionConfig `yaml:"retention"`
}

func DefaultLLMStorageConfig

func DefaultLLMStorageConfig() LLMStorageConfig

type LLMStorageRetentionConfig

type LLMStorageRetentionConfig struct {
	MaxAgeDays int    `yaml:"max_age_days"`
	MaxSizeMB  int    `yaml:"max_size_mb"`
	Eviction   string `yaml:"eviction"`
}

type LandlockConfig

type LandlockConfig struct {
	Enabled      bool                  `yaml:"enabled"`
	AllowExecute []string              `yaml:"allow_execute"` // Paths where execute is allowed
	AllowRead    []string              `yaml:"allow_read"`    // Paths where read is allowed
	AllowWrite   []string              `yaml:"allow_write"`   // Paths where write is allowed
	DenyPaths    []string              `yaml:"deny_paths"`    // Paths to deny (by omission)
	Network      LandlockNetworkConfig `yaml:"network"`
}

LandlockConfig controls Landlock sandbox settings.

type LandlockNetworkConfig

type LandlockNetworkConfig struct {
	AllowConnectTCP *bool `yaml:"allow_connect_tcp"` // default: true (set by applyDefaults)
	AllowBindTCP    *bool `yaml:"allow_bind_tcp"`    // default: false (set by applyDefaults)
	BindPorts       []int `yaml:"bind_ports"`        // reserved; not yet enforced
}

LandlockNetworkConfig controls Landlock network restrictions (kernel 6.7+).

type LoggingConfig

type LoggingConfig struct {
	Level    string         `yaml:"level"`
	Format   string         `yaml:"format"`
	Output   string         `yaml:"output"`
	Rotation RotationConfig `yaml:"rotation"`
}

type MCPRateLimit

type MCPRateLimit struct {
	CallsPerMinute int `yaml:"calls_per_minute"`
	Burst          int `yaml:"burst"`
}

MCPRateLimit defines rate limit for a server.

type MCPRateLimitsConfig

type MCPRateLimitsConfig struct {
	Enabled      bool                    `yaml:"enabled"`
	DefaultRPM   int                     `yaml:"default_rpm"` // Default calls per minute
	DefaultBurst int                     `yaml:"default_burst"`
	PerServer    map[string]MCPRateLimit `yaml:"per_server"`
}

MCPRateLimitsConfig configures MCP rate limiting.

type MCPServerDeclaration

type MCPServerDeclaration struct {
	ID             string   `yaml:"id"`
	Type           string   `yaml:"type"`            // "stdio" | "http" | "sse"
	Command        string   `yaml:"command"`         // For stdio servers
	Args           []string `yaml:"args"`            // For stdio servers
	URL            string   `yaml:"url"`             // For http/sse servers
	TLSFingerprint string   `yaml:"tls_fingerprint"` // Optional TLS cert pin
	AllowedEnv     []string `yaml:"allowed_env"`     // If set, only these env vars (plus standard ones) are passed
	DeniedEnv      []string `yaml:"denied_env"`      // If set, these env vars are stripped
}

MCPServerDeclaration defines an MCP server and how to connect to it.

type MCPServerRule

type MCPServerRule struct {
	ID string `yaml:"id"`
}

MCPServerRule matches servers by ID (supports "*" wildcard).

type MCPToolRule

type MCPToolRule struct {
	Server      string `yaml:"server"`       // Server ID or "*" for any
	Tool        string `yaml:"tool"`         // Tool name or "*" for any
	ContentHash string `yaml:"content_hash"` // Optional SHA-256 hash
}

MCPToolRule defines a tool matching rule.

type MCPVersionPinningConfig

type MCPVersionPinningConfig struct {
	Enabled        bool   `yaml:"enabled"`
	OnChange       string `yaml:"on_change"`        // block, alert, allow
	AutoTrustFirst bool   `yaml:"auto_trust_first"` // Pin on first use
	PinBinary      bool   `yaml:"pin_binary"`
}

MCPVersionPinningConfig configures version pinning behavior.

type MetricsConfig

type MetricsConfig struct {
	Enabled bool   `yaml:"enabled"`
	Path    string `yaml:"path"`
}

type MitigationLoadInfo

type MitigationLoadInfo struct {
	ID                    string
	Source                string
	Path                  string
	Checksum              string
	SocketRules           int
	BlockedSocketFamilies int
	Syscalls              int
}

type MountProfile

type MountProfile struct {
	BasePolicy string      `yaml:"base_policy"`
	Mounts     []MountSpec `yaml:"mounts"`
}

MountProfile defines a collection of mounts with policies.

type MountSpec

type MountSpec struct {
	Path   string `yaml:"path"`
	Policy string `yaml:"policy"`
}

MountSpec defines a single mount point with its policy.

func GetSystemMounts

func GetSystemMounts() []MountSpec

GetSystemMounts returns the built-in read-only system mounts for the current platform.

type NetworkPolicyConfig

type NetworkPolicyConfig struct {
	DefaultAction string              `yaml:"default_action"`
	Rules         []NetworkPolicyRule `yaml:"rules"`
}

NetworkPolicyConfig configures network access policy.

type NetworkPolicyRule

type NetworkPolicyRule struct {
	Name           string                 `yaml:"name"`
	Domains        []string               `yaml:"domains,omitempty"`
	CIDRs          []string               `yaml:"cidrs,omitempty"`
	Ports          []int                  `yaml:"ports,omitempty"`
	Action         string                 `yaml:"action"` // allow, deny, approve, redirect
	TimeoutSeconds int                    `yaml:"timeout_seconds,omitempty"`
	Redirect       *NetworkRedirectConfig `yaml:"redirect,omitempty"`
}

NetworkPolicyRule defines a network access rule.

type NetworkRateLimitsConfig

type NetworkRateLimitsConfig struct {
	Enabled     bool                       `yaml:"enabled"`
	GlobalRPM   int                        `yaml:"global_rpm"`
	GlobalBurst int                        `yaml:"global_burst"`
	PerDomain   map[string]DomainRateLimit `yaml:"per_domain"`
}

NetworkRateLimitsConfig configures network rate limiting.

type NetworkRedirectConfig

type NetworkRedirectConfig struct {
	Host string `yaml:"host"`
	Port int    `yaml:"port"`
}

NetworkRedirectConfig configures network redirect behavior.

type OIDCClaimMappings

type OIDCClaimMappings struct {
	OperatorID string `yaml:"operator_id"` // Claim for operator ID (default: "sub")
	Groups     string `yaml:"groups"`      // Claim for groups (default: "groups")
}

OIDCClaimMappings maps OIDC claims to agentmon fields.

type OIDCConfig

type OIDCConfig struct {
	Issuer           string            `yaml:"issuer"`            // e.g., "https://corp.okta.com"
	ClientID         string            `yaml:"client_id"`         // e.g., "agentmon-server"
	Audience         string            `yaml:"audience"`          // Expected audience claim
	JWKSCacheTTL     string            `yaml:"jwks_cache_ttl"`    // e.g., "1h"
	DiscoveryTimeout string            `yaml:"discovery_timeout"` // Timeout for OIDC discovery (default: "5s")
	ClaimMappings    OIDCClaimMappings `yaml:"claim_mappings"`
	AllowedGroups    []string          `yaml:"allowed_groups"`   // Groups allowed to access
	GroupPolicyMap   map[string]string `yaml:"group_policy_map"` // group -> policy name
	GroupRoleMap     map[string]string `yaml:"group_role_map"`   // group -> role (admin, approver, agent)
}

OIDCConfig configures OpenID Connect authentication.

type OTELBatchConfig

type OTELBatchConfig struct {
	MaxSize int    `yaml:"max_size"`
	Timeout string `yaml:"timeout"`
}

OTELBatchConfig configures OTEL export batching.

type OTELFilterConfig

type OTELFilterConfig struct {
	IncludeTypes      []string `yaml:"include_types"`
	ExcludeTypes      []string `yaml:"exclude_types"`
	IncludeCategories []string `yaml:"include_categories"`
	ExcludeCategories []string `yaml:"exclude_categories"`
	MinRiskLevel      string   `yaml:"min_risk_level"`
}

OTELFilterConfig controls which events are exported via OTEL.

type OTELResourceConfig

type OTELResourceConfig struct {
	ServiceName     string            `yaml:"service_name"`
	ExtraAttributes map[string]string `yaml:"extra_attributes"`
}

OTELResourceConfig configures the OTEL resource attributes.

type OTELSignalsConfig

type OTELSignalsConfig struct {
	Logs  bool `yaml:"logs"`
	Spans bool `yaml:"spans"`
}

OTELSignalsConfig selects which OTEL signal types to export.

type OTELTLSConfig

type OTELTLSConfig struct {
	Enabled  bool   `yaml:"enabled"`
	CertFile string `yaml:"cert_file"`
	KeyFile  string `yaml:"key_file"`
	Insecure bool   `yaml:"insecure"`
}

OTELTLSConfig configures TLS for the OTEL exporter.

type OutputInspectionConfig

type OutputInspectionConfig struct {
	Enabled     bool   `yaml:"enabled"`
	OnDetection string `yaml:"on_detection"` // "alert" | "block" — default: "alert"
}

OutputInspectionConfig configures scanning of MCP tool call responses.

type PackageCacheConfig

type PackageCacheConfig struct {
	Dir string          `yaml:"dir"`
	TTL PackageCacheTTL `yaml:"ttl"`
}

PackageCacheConfig configures the on-disk check result cache.

type PackageCacheTTL

type PackageCacheTTL struct {
	Vulnerability time.Duration `yaml:"vulnerability"`
	License       time.Duration `yaml:"license"`
	Provenance    time.Duration `yaml:"provenance"`
	Reputation    time.Duration `yaml:"reputation"`
	Malware       time.Duration `yaml:"malware"`
}

PackageCacheTTL defines per-result-type cache lifetimes.

type PackageChecksConfig

type PackageChecksConfig struct {
	Enabled    bool                           `yaml:"enabled"`
	Scope      string                         `yaml:"scope"` // "new_packages_only", "all_installs"
	Cache      PackageCacheConfig             `yaml:"cache"`
	Registries map[string]RegistryTrustConfig `yaml:"registries"`
	Providers  map[string]ProviderConfig      `yaml:"providers"`
	Resolvers  map[string]ResolverConfig      `yaml:"resolvers"`
	Privacy    PackagePrivacyConfig           `yaml:"privacy" json:"privacy"`
	// FailMode controls how the orchestrator reacts to provider failures
	// for external providers (Snyk / Socket / etc.). One of:
	//   "open"     — let the install proceed when an external provider fails.
	//   "closed"   — block the install when an external provider fails.
	//   "degraded" — fall back to OSV findings, annotate the verdict.
	// The env var PKGCHECK_FAIL_MODE overrides this at runtime.
	FailMode string `yaml:"fail_mode" json:"fail_mode"`
	// BlockOn is the per-finding-type severity-threshold shorthand that
	// compiles to a list of policy rules via CompileBlockOn.
	BlockOn BlockOnConfig `yaml:"block_on" json:"block_on"`
}

PackageChecksConfig configures package install security checks.

func DefaultPackageChecksConfig

func DefaultPackageChecksConfig() PackageChecksConfig

DefaultPackageChecksConfig returns the default configuration for package checks.

type PackagePrivacyConfig

type PackagePrivacyConfig struct {
	// ExternalScanRegistries lists registries whose packages may be sent
	// to external providers. An empty list means "no registry filter."
	ExternalScanRegistries []string `yaml:"external_scan_registries" json:"external_scan_registries"`
	// PrivateScopeDenylist lists package name prefixes / glob patterns
	// that should NOT be sent externally even when on an allowed registry.
	PrivateScopeDenylist []string `yaml:"private_scope_denylist" json:"private_scope_denylist"`
}

PackagePrivacyConfig configures the upstream privacy filter applied before any external (Snyk / Socket / etc.) provider is invoked.

LIMITATION: registry detection is CLI-flag-only. If your installs rely on .npmrc / pip.conf / env-var registry overrides, ALSO list those registries in ExternalScanRegistries — otherwise private packages may be treated as public and sent to external providers.

func (PackagePrivacyConfig) Validate

func (p PackagePrivacyConfig) Validate() error

Validate checks that all PrivateScopeDenylist entries are valid glob patterns. A malformed pattern would silently match nothing at runtime, producing a fail-open privacy hole. Call this at config-load time so operators see a startup error instead of silent misbehaviour.

type PlatformConfig

type PlatformConfig struct {
	// Mode selects the platform: auto, linux, darwin, darwin-lima, windows, windows-wsl2
	Mode string `yaml:"mode"`

	// Fallback configures fallback behavior when preferred mode is unavailable
	Fallback PlatformFallbackConfig `yaml:"fallback"`

	// MountPoints configures platform-specific mount points
	MountPoints PlatformMountPointsConfig `yaml:"mount_points"`
}

PlatformConfig configures cross-platform selection and fallback behavior.

type PlatformFallbackConfig

type PlatformFallbackConfig struct {
	// Enabled allows falling back to alternative platforms
	Enabled bool `yaml:"enabled"`

	// Order specifies fallback priority (first available is used)
	Order []string `yaml:"order"`
}

PlatformFallbackConfig configures platform fallback behavior.

type PlatformMountPointsConfig

type PlatformMountPointsConfig struct {
	Linux  string `yaml:"linux"`
	Darwin string `yaml:"darwin"`
}

PlatformMountPointsConfig specifies platform-specific mount points.

type PoliciesConfig

type PoliciesConfig struct {
	Dir               string             `yaml:"dir"`
	Default           string             `yaml:"default"`
	Allowed           []string           `yaml:"allowed"`
	ManifestPath      string             `yaml:"manifest_path"`
	Signing           SigningConfig      `yaml:"signing"`
	EnvPolicy         EnvPolicyConfig    `yaml:"env_policy"`
	EnvShimPath       string             `yaml:"env_shim_path"`
	Remote            RemotePolicyConfig `yaml:"remote"`
	DetectProjectRoot *bool              `yaml:"detect_project_root"` // nil means true (default enabled)
	ProjectMarkers    []string           `yaml:"project_markers"`     // Override default markers
	SymlinkEscape     string             `yaml:"symlink_escape"`      // "evaluate"/"deny"
}

PoliciesConfig configures policy loading.

func (*PoliciesConfig) GetProjectMarkers

func (c *PoliciesConfig) GetProjectMarkers() []string

GetProjectMarkers returns custom project markers if configured, or nil to use defaults.

func (*PoliciesConfig) ShouldDetectProjectRoot

func (c *PoliciesConfig) ShouldDetectProjectRoot() bool

ShouldDetectProjectRoot returns whether project root detection is enabled. Returns true by default if DetectProjectRoot is nil.

func (*PoliciesConfig) SymlinkEscapeDeny

func (c *PoliciesConfig) SymlinkEscapeDeny() bool

SymlinkEscapeDeny reports whether the workspace-escape blanket deny is in effect (i.e. the user set "deny"). Default is "evaluate" -- any value other than literal "deny" returns false.

type PolicyChangeCallback

type PolicyChangeCallback func(old, new *PolicyState, changedBy string)

PolicyChangeCallback is called when policy changes are detected. Parameters are the old policy state, new policy state, and who made the change.

type PolicyFiles

type PolicyFiles struct {
	Env     *EnvProtectionPolicy `yaml:"env_protection"`
	File    *FilePolicyConfig    `yaml:"file_policy"`
	Network *NetworkPolicyConfig `yaml:"network_policy"`
	DNS     *DNSPolicyConfig     `yaml:"dns_policy"`
}

PolicyFiles represents policy configuration loaded from separate files.

func LoadMinimalPolicy

func LoadMinimalPolicy(path string) (*PolicyFiles, error)

LoadMinimalPolicy loads a minimal starter policy from a single file.

func LoadPolicyFiles

func LoadPolicyFiles(dir string) (*PolicyFiles, error)

LoadPolicyFiles loads policy configuration from separate files in a directory.

type PolicySocketConfig

type PolicySocketConfig struct {
	Path   string `yaml:"path" json:"path"`
	TeamID string `yaml:"team_id" json:"team_id"`
}

PolicySocketConfig configures the macOS policy socket server (IPC bridge between the agentmon daemon and the system extension).

type PolicyState

type PolicyState struct {
	Files   *PolicyFiles
	Version string
	Path    string
}

PolicyState holds loaded policies with version tracking.

func LoadPolicyFilesWithVersion

func LoadPolicyFilesWithVersion(dir string) (*PolicyState, error)

LoadPolicyFilesWithVersion loads policies and computes version.

type ProviderConfig

type ProviderConfig struct {
	Enabled   bool           `yaml:"enabled"`
	Type      string         `yaml:"type,omitempty"`    // "" (built-in) | "exec"
	Command   string         `yaml:"command,omitempty"` // for exec providers
	Priority  int            `yaml:"priority"`
	Timeout   time.Duration  `yaml:"timeout"`
	OnFailure string         `yaml:"on_failure"` // "warn" | "deny" | "allow" | "approve"
	APIKeyEnv string         `yaml:"api_key_env,omitempty"`
	Options   map[string]any `yaml:"options,omitempty"`
}

ProviderConfig configures a single check provider.

type ProxyConfig

type ProxyConfig struct {
	Mode       string               `yaml:"mode"`
	Port       int                  `yaml:"port"`
	Providers  ProxyProvidersConfig `yaml:"providers"`
	RateLimits LLMRateLimitsConfig  `yaml:"rate_limits"`
}

ProxyConfig configures the embedded LLM proxy.

func DefaultProxyConfig

func DefaultProxyConfig() ProxyConfig

func (ProxyConfig) IsMCPOnly

func (c ProxyConfig) IsMCPOnly() bool

IsMCPOnly returns true if the proxy runs in MCP-interception-only mode.

type ProxyProvidersConfig

type ProxyProvidersConfig struct {
	Anthropic string `yaml:"anthropic"`
	OpenAI    string `yaml:"openai"`
}

func (ProxyProvidersConfig) IsCustomOpenAI

func (c ProxyProvidersConfig) IsCustomOpenAI() bool

IsCustomOpenAI returns true if a non-default OpenAI URL is configured.

type PtracePerformanceConfig

type PtracePerformanceConfig struct {
	SeccompPrefilter   bool `yaml:"seccomp_prefilter"`
	MaxTracees         int  `yaml:"max_tracees"`
	MaxHoldMs          int  `yaml:"max_hold_ms"`
	StaticAllowFile    bool `yaml:"static_allow_file"`
	StaticAllowNetwork bool `yaml:"static_allow_network"`
	ArgLevelFilter     bool `yaml:"arg_level_filter"`
}

type PtraceTraceConfig

type PtraceTraceConfig struct {
	Execve  bool `yaml:"execve"`
	File    bool `yaml:"file"`
	Network bool `yaml:"network"`
	Signal  bool `yaml:"signal"`
}

type ReadThenSendConfig

type ReadThenSendConfig struct {
	Enabled bool          `yaml:"enabled"`
	Window  time.Duration `yaml:"window"` // default: 30s
}

ReadThenSendConfig detects read-from-one-server-then-send-via-another patterns.

type RealtimeConfig

type RealtimeConfig struct {
	Provider  string        `yaml:"provider"`
	APIKey    string        `yaml:"api_key"`
	Timeout   time.Duration `yaml:"timeout"`
	CacheTTL  time.Duration `yaml:"cache_ttl"`
	OnTimeout string        `yaml:"on_timeout"`
}

RealtimeConfig defines the paid real-time API tier (reserved, not implemented in v1).

type RegistryTrustConfig

type RegistryTrustConfig struct {
	Trust  string   `yaml:"trust"`            // "check_full" | "check_local_only" | "trusted"
	Scopes []string `yaml:"scopes,omitempty"` // e.g., ["@acme"]
}

RegistryTrustConfig defines trust settings for a package registry.

type RemotePolicyConfig

type RemotePolicyConfig struct {
	// URL is the policy endpoint, e.g. https://policy.example/v1/policy.
	URL string `yaml:"url"`
	// PollInterval bounds how long a change takes to arrive when the server
	// does not honour long-polling. Default 5m.
	PollInterval string `yaml:"poll_interval"`
	// LongPoll is the wait= duration sent to the server. Empty or "0s"
	// disables it and the ticker alone drives updates. Default 30s.
	LongPoll string `yaml:"long_poll"`
	// MaxBytes caps the fetched document. Zero uses policy.DefaultRemoteMaxBytes.
	MaxBytes int64 `yaml:"max_bytes"`
	// CacheDir holds the last bundle the server served, so a daemon that
	// restarts while the server is unreachable comes up on the policy that
	// server last published rather than refusing to start. Empty defaults to
	// <data dir>/policy-cache. Set cache: false to disable.
	CacheDir string `yaml:"cache_dir"`
	// Cache enables the on-disk last-known-good bundle. nil means true.
	Cache *bool `yaml:"cache"`
	// AuthHeader and AuthTokenEnv send a credential. The token is read from
	// the environment, never written in config, matching ProviderConfig.APIKeyEnv.
	AuthHeader   string `yaml:"auth_header"`
	AuthTokenEnv string `yaml:"auth_token_env"`
	// SendDecisionContext reports hostname, user and tags so the server can
	// bind a policy to this agent. nil means true.
	SendDecisionContext *bool `yaml:"send_decision_context"`
	// TLS configures the client side of the connection.
	TLS RemotePolicyTLSConfig `yaml:"tls"`
}

RemotePolicyConfig points the policy manager at a policy server instead of the local directory. Setting url is what enables it; there is no separate flag, so a configured URL never sits there doing nothing.

func (*RemotePolicyConfig) CacheEnabled

func (c *RemotePolicyConfig) CacheEnabled() bool

CacheEnabled reports whether the last served bundle is kept on disk.

func (*RemotePolicyConfig) DecisionContextEnabled

func (c *RemotePolicyConfig) DecisionContextEnabled() bool

DecisionContextEnabled reports whether identity is sent with the fetch.

func (*RemotePolicyConfig) Enabled

func (c *RemotePolicyConfig) Enabled() bool

Enabled reports whether a policy server is configured.

func (*RemotePolicyConfig) ResolvedLongPoll

func (c *RemotePolicyConfig) ResolvedLongPoll() time.Duration

ResolvedLongPoll returns the wait= duration, or zero when disabled.

func (*RemotePolicyConfig) ResolvedPollInterval

func (c *RemotePolicyConfig) ResolvedPollInterval() time.Duration

ResolvedPollInterval returns the ticker period.

func (*RemotePolicyConfig) Validate

func (c *RemotePolicyConfig) Validate(signingMode string) error

Validate checks the remote policy source.

The signature is the trust boundary, not the transport: a remote source with signing off hands whoever owns the server, or the wire, full control of what every agent enforces. Refusing the combination is the one rule here that is not a preference.

type RemotePolicyTLSConfig

type RemotePolicyTLSConfig struct {
	CACertFile         string `yaml:"ca_cert_file"`
	ClientCertFile     string `yaml:"client_cert_file"`
	ClientKeyFile      string `yaml:"client_key_file"`
	InsecureSkipVerify bool   `yaml:"insecure_skip_verify"`
}

RemotePolicyTLSConfig is the client half of mTLS to the policy server.

type ResolvedTorConfig

type ResolvedTorConfig struct {
	Enabled           bool
	Mode              string
	Vectors           ResolvedTorVectors
	ClientBinaries    []string
	SocksPorts        []int
	ControlPorts      []int
	SocksLoopbackOnly bool
	RelayFeed         TorRelayFeed
	OnionRules        []TorOnionRule
}

ResolvedTorConfig is the fully-defaulted, value-typed form consumed by internal/tor. All bools are concrete; all lists are non-empty unless the feature is disabled.

func ResolveTorConfig

func ResolveTorConfig(in TorConfig) ResolvedTorConfig

ResolveTorConfig applies deny-by-default semantics. Absent block (zero value) → enabled, mode=deny, all vectors on, default binaries/ports.

type ResolvedTorVectors

type ResolvedTorVectors struct {
	Processes, SocksPorts, Onion, RelayIPs bool
}

type ResolverConfig

type ResolverConfig struct {
	// DryRunCommand is the path to the resolver binary.
	// For additional args to prepend to the resolver-specific args, use DryRunArgs.
	DryRunCommand string `yaml:"dry_run_command" json:"dry_run_command"`
	// DryRunArgs contains args to prepend to the resolver-specific args.
	// Each element is a single token (no shell splitting is performed).
	DryRunArgs []string      `yaml:"dry_run_args" json:"dry_run_args"`
	Timeout    time.Duration `yaml:"timeout"`
}

ResolverConfig configures a single lock-file resolver.

func (ResolverConfig) Validate

func (r ResolverConfig) Validate() error

Validate returns an error if the configuration is malformed.

DryRunCommand is the binary path. Paths with spaces (e.g. Windows `C:\Program Files\nodejs\npm.cmd`) are valid — the resolver preserves them verbatim. The validator only rejects values that look like the pre-`dry_run_args` command-string form, where additional whitespace- separated tokens include a flag-shaped argument (`--foo` or `-x`), which the new code can no longer interpret.

type RotationConfig

type RotationConfig struct {
	MaxSizeMB  int  `yaml:"max_size_mb"`
	MaxAgeDays int  `yaml:"max_age_days"`
	MaxBackups int  `yaml:"max_backups"`
	Compress   bool `yaml:"compress"`
}

type SamplingConfig

type SamplingConfig struct {
	Policy    string            `yaml:"policy"`     // "block" | "alert" | "allow" — default: "block"
	PerServer map[string]string `yaml:"per_server"` // server_id → policy override
}

SamplingConfig configures sampling/createMessage enforcement.

type SandboxCgroupsConfig

type SandboxCgroupsConfig struct {
	Enabled bool `yaml:"enabled"`
	// BasePath is a cgroupfs directory under which per-command cgroups will be created.
	// If empty, agentmon will default to the current process cgroup.
	// Note: this should be a path under /sys/fs/cgroup (or relative to the current process cgroup dir).
	BasePath string `yaml:"base_path"`
	// BestEffort, when true, degrades unenforceable per-command resource limits
	// (e.g. memory.max EPERM on a non-writable nested cgroup) to a logged warning
	// and runs the command WITHOUT the limit, instead of fail-closing the wrap.
	// Defaults to false (fail-closed) to preserve the resource-limit guarantee.
	// Ignored when eBPF enforcement is configured: the cgroup egress path stays strict.
	// See issue #411.
	BestEffort bool `yaml:"best_effort"`
}

type SandboxConfig

type SandboxConfig struct {
	// Enabled enables the sandbox subsystem
	Enabled bool `yaml:"enabled"`

	// AllowDegraded permits running with reduced isolation if full isolation unavailable
	AllowDegraded bool `yaml:"allow_degraded"`

	// Limits configures resource limits for sandboxed processes
	Limits SandboxLimitsConfig `yaml:"limits"`

	FUSE        SandboxFUSEConfig        `yaml:"fuse"`
	Network     SandboxNetworkConfig     `yaml:"network"`
	Cgroups     SandboxCgroupsConfig     `yaml:"cgroups"`
	UnixSockets SandboxUnixSocketsConfig `yaml:"unix_sockets"`
	Seccomp     SandboxSeccompConfig     `yaml:"seccomp"`
	XPC         SandboxXPCConfig         `yaml:"xpc"`
	MCP         SandboxMCPConfig         `yaml:"mcp"`
	Ptrace      SandboxPtraceConfig      `yaml:"ptrace"`

	// EnvInject specifies environment variables to inject into every command execution.
	// These bypass policy filtering as they are operator-configured (trusted).
	EnvInject map[string]string `yaml:"env_inject"`

	WrapEnvPolicy SandboxWrapEnvPolicyConfig `yaml:"wrap_env_policy"`
}

func (SandboxConfig) UnixSocketNotifyEnabled

func (c SandboxConfig) UnixSocketNotifyEnabled() bool

UnixSocketNotifyEnabled reports whether the seccomp wrapper will install unix-socket (socket-family) USER_NOTIF rules based on config alone. It is the OR of sandbox.seccomp.unix_socket.enabled and an explicitly-true sandbox.unix_sockets.enabled, mirroring the wrapper's resolution in internal/api/wrap.go (a nil top-level flag contributes nothing here, matching that path; applyDefaults populates it in production).

Centralised so the wait_killable filter-composition check, the wrap-init path, and the direct exec path all agree on the wrapper's filter shape instead of each re-deriving it from a single field. Issue #369: a top-level-only `sandbox.unix_sockets.enabled` made the composition check miss the socket family, short-circuit to "filter_composition_safe", and skip the behavioral WAIT_KILLABLE_RECV probe entirely.

func (*SandboxConfig) Validate

func (c *SandboxConfig) Validate() error

Validate checks cross-field constraints in the sandbox configuration.

type SandboxEBPFConfig

type SandboxEBPFConfig struct {
	Enabled           bool `yaml:"enabled"`
	Required          bool `yaml:"required"`
	ResolveRDNS       bool `yaml:"resolve_rdns"`         // optional reverse DNS on ebpf net events
	Enforce           bool `yaml:"enforce"`              // deny in BPF if not allowed
	EnforceWithoutDNS bool `yaml:"enforce_without_dns"`  // when true, default deny even if DNS resolution failed
	MapAllowEntries   int  `yaml:"map_allow_entries"`    // optional override for allowlist map size
	MapDenyEntries    int  `yaml:"map_deny_entries"`     // optional override for denylist map size
	MapLPMEntries     int  `yaml:"map_lpm_entries"`      // optional override for LPM map size
	MapLPMDenyEntries int  `yaml:"map_lpm_deny_entries"` // optional override for deny LPM map size
	MapDefaultEntries int  `yaml:"map_default_entries"`  // optional override for default_deny map size
	DNSRefreshSeconds int  `yaml:"dns_refresh_seconds"`  // interval to refresh DNS-derived allowlist (0 disables)
	DNSMaxTTLSeconds  int  `yaml:"dns_max_ttl_seconds"`  // cap TTL used for caching/refresh (0 uses default 60s)
}

type SandboxFUSEConfig

type SandboxFUSEConfig struct {
	Enabled  bool            `yaml:"enabled"`
	Deferred bool            `yaml:"deferred"`
	Audit    FUSEAuditConfig `yaml:"audit"`
	// Optional base dir for mounts; defaults to sessions.base_dir.
	MountBaseDir string `yaml:"mount_base_dir"`
	// DeferredMarkerFile is a file whose existence gates the enable command.
	// If set, the enable command only runs when this file exists.
	DeferredMarkerFile string `yaml:"deferred_marker_file"`
	// DeferredEnableCommand is run when FUSE is unavailable in deferred mode
	// to make /dev/fuse accessible (e.g., ["sudo", "/bin/chmod", "666", "/dev/fuse"]).
	DeferredEnableCommand []string `yaml:"deferred_enable_command"`
	// MaxBackground is the kernel-side per-mount FUSE async request queue
	// depth (the FUSE_INIT max_background value go-fuse passes to the
	// kernel). When unset or 0, agentmon leaves go-fuse's default in place
	// (12). Raising it gives the kernel more headroom for multi-mount
	// daemons under heavy ptrace+seccomp syscall traffic; common tuned
	// values are 32-128.
	MaxBackground int `yaml:"max_background"`
}

SandboxFUSEConfig configures the FUSE workspace mount.

NOTE: adding a yaml-tagged field here requires adding its tag to knownFUSEKeys in this file, or unknownFUSEKeys will emit a spurious "unknown key under sandbox.fuse" warning for configs that use it.

type SandboxLimitsConfig

type SandboxLimitsConfig struct {
	MaxMemoryMB    int `yaml:"max_memory_mb"`
	MaxCPUPercent  int `yaml:"max_cpu_percent"`
	MaxProcesses   int `yaml:"max_processes"`
	MaxDiskIOMbps  int `yaml:"max_disk_io_mbps"`
	MaxNetworkMbps int `yaml:"max_network_mbps"`
}

SandboxLimitsConfig configures resource limits.

type SandboxMCPConfig

type SandboxMCPConfig struct {
	EnforcePolicy     bool                    `yaml:"enforce_policy"`
	FailClosed        bool                    `yaml:"fail_closed"`        // Block unknown tools if true
	AllowedTransports []string                `yaml:"allowed_transports"` // "stdio", "http", "sse"; empty = all allowed
	Servers           []MCPServerDeclaration  `yaml:"servers"`
	ServerPolicy      string                  `yaml:"server_policy"` // allowlist, denylist, none
	AllowedServers    []MCPServerRule         `yaml:"allowed_servers"`
	DeniedServers     []MCPServerRule         `yaml:"denied_servers"`
	ToolPolicy        string                  `yaml:"tool_policy"` // allowlist, denylist, none
	AllowedTools      []MCPToolRule           `yaml:"allowed_tools"`
	DeniedTools       []MCPToolRule           `yaml:"denied_tools"`
	VersionPinning    MCPVersionPinningConfig `yaml:"version_pinning"`
	RateLimits        MCPRateLimitsConfig     `yaml:"rate_limits"`
	CrossServer       CrossServerConfig       `yaml:"cross_server"`
	OutputInspection  OutputInspectionConfig  `yaml:"output_inspection"`
	Sampling          SamplingConfig          `yaml:"sampling"`
}

SandboxMCPConfig configures MCP security policies.

type SandboxNetworkConfig

type SandboxNetworkConfig struct {
	Enabled         bool                            `yaml:"enabled"`
	ProxyPort       int                             `yaml:"proxy_port"`
	DNSPort         int                             `yaml:"dns_port"`
	InterceptMode   string                          `yaml:"intercept_mode"` // all, tcp_only, monitor
	ProxyListenAddr string                          `yaml:"proxy_listen_addr"`
	TLSInspection   TLSInspectionConfig             `yaml:"tls_inspection"`
	Transparent     SandboxTransparentNetworkConfig `yaml:"transparent"`
	EBPF            SandboxEBPFConfig               `yaml:"ebpf"`
	RateLimits      NetworkRateLimitsConfig         `yaml:"rate_limits"`
}

type SandboxPtraceConfig

type SandboxPtraceConfig struct {
	Enabled         bool                    `yaml:"enabled"`
	AttachMode      string                  `yaml:"attach_mode"`
	TargetPID       int                     `yaml:"target_pid"`
	TargetPIDFile   string                  `yaml:"target_pid_file"`
	Trace           PtraceTraceConfig       `yaml:"trace"`
	Performance     PtracePerformanceConfig `yaml:"performance"`
	MaskTracerPid   string                  `yaml:"mask_tracer_pid"`
	OnAttachFailure string                  `yaml:"on_attach_failure"`
}

SandboxPtraceConfig configures the ptrace-based syscall tracer backend.

func DefaultPtraceConfig

func DefaultPtraceConfig() SandboxPtraceConfig

func (SandboxPtraceConfig) IsExecveOnly

func (c SandboxPtraceConfig) IsExecveOnly() bool

IsExecveOnly returns true when ptrace is enabled and configured to trace only execve syscalls (file, network, signal tracing all disabled). This is the "hybrid mode" where ptrace handles execve and the seccomp wrapper handles everything else.

func (*SandboxPtraceConfig) Validate

func (c *SandboxPtraceConfig) Validate() error

Validate checks that the ptrace configuration is internally consistent.

type SandboxSeccompConfig

type SandboxSeccompConfig struct {
	Enabled     bool                            `yaml:"enabled"`
	Mode        string                          `yaml:"mode"` // enforce, audit, disabled
	UnixSocket  SandboxSeccompUnixConfig        `yaml:"unix_socket"`
	Syscalls    SandboxSeccompSyscallConfig     `yaml:"syscalls"`
	Execve      ExecveConfig                    `yaml:"execve"`
	Shellc      SandboxSeccompShellcConfig      `yaml:"shellc"`
	FileMonitor SandboxSeccompFileMonitorConfig `yaml:"file_monitor"`

	// BlockedSocketFamilies lists AF_* families whose socket/socketpair calls
	// are intercepted. A nil value (field omitted in YAML) means "apply
	// defaults"; a non-nil empty slice means "explicitly block nothing"
	// (opt-out). Populated via applyDefaults from
	// seccomp.DefaultBlockedFamilies when nil.
	BlockedSocketFamilies []SandboxSeccompSocketFamilyConfig `yaml:"blocked_socket_families"`
	SocketRules           []SandboxSeccompSocketRuleConfig   `yaml:"socket_rules"`
	MitigationSets        []string                           `yaml:"mitigation_sets"`
	MitigationDirs        []string                           `yaml:"mitigation_dirs"`

	// WaitKillable tri-states SECCOMP_FILTER_FLAG_WAIT_KILLABLE_RECV:
	//   nil   = auto-detect via boot-time behavioral probe
	//   &true = force on (skip probe)
	//   &false = force off (skip probe)
	// Issue #369: kernels >=6 may accept the flag and then misbehave when
	// the filter combines socket-family and file/metadata-family notify rules.
	WaitKillable *bool `yaml:"wait_killable"`
}

SandboxSeccompConfig configures seccomp-bpf filtering.

type SandboxSeccompFileMonitorConfig

type SandboxSeccompFileMonitorConfig struct {
	Enabled            *bool `yaml:"enabled"`
	EnforceWithoutFUSE *bool `yaml:"enforce_without_fuse"`
	InterceptMetadata  *bool `yaml:"intercept_metadata"`
	WriteOnlyOpens     *bool `yaml:"write_only_opens"`
	OpenatEmulation    *bool `yaml:"openat_emulation"`
	BlockIOUring       *bool `yaml:"block_io_uring"`
}

SandboxSeccompFileMonitorConfig configures file I/O interception via seccomp.

type SandboxSeccompShellcConfig

type SandboxSeccompShellcConfig struct {
	// Opaque selects handling for opaque shell-c scripts when the policy has
	// a restrictive command rule (deny/redirect/approve/audit/soft_delete);
	// allow-only policies always run opaque scripts regardless of this setting:
	//   "enforce" (default) — run only when per-exec enforcement is active
	//                         (ptrace, or seccomp.execve + unix_sockets);
	//                         otherwise deny shellc-opaque-script.
	//   "allow"             — run even without per-exec enforcement (accepts
	//                         the bypass risk; emits a warning).
	//   "deny"              — always deny opaque scripts.
	Opaque string `yaml:"opaque"`
}

SandboxSeccompShellcConfig controls how the shell-shim handles opaque `sh -c`/`bash -c` payloads that cannot be statically resolved to a single command for policy pre-check (issue #378).

type SandboxSeccompSocketFamilyConfig

type SandboxSeccompSocketFamilyConfig struct {
	Family string `yaml:"family"` // AF_* name or numeric string
	Action string `yaml:"action"` // errno|kill|log|log_and_kill (defaults to errno)
}

SandboxSeccompSocketFamilyConfig describes one blocked socket family entry. Family is an AF_* name (e.g. "AF_ALG") or a numeric string (e.g. "38"). Action is one of: errno (default), kill, log, log_and_kill.

When blocked_socket_families is omitted from YAML the field is nil and applyDefaults fills it from seccomp.DefaultBlockedFamilies. When the operator sets blocked_socket_families: [] the field is a non-nil empty slice and applyDefaults leaves it untouched (opt-out of all defaults).

type SandboxSeccompSocketRuleConfig

type SandboxSeccompSocketRuleConfig struct {
	Name     string `yaml:"name"`
	Family   string `yaml:"family"`
	Type     string `yaml:"type,omitempty"`
	Protocol string `yaml:"protocol,omitempty"`
	Action   string `yaml:"action"`
}

type SandboxSeccompSyscallConfig

type SandboxSeccompSyscallConfig struct {
	DefaultAction string   `yaml:"default_action"` // allow, block
	Block         []string `yaml:"block"`
	Allow         []string `yaml:"allow"`
	OnBlock       string   `yaml:"on_block"` // errno (default), kill, log, log_and_kill
}

SandboxSeccompSyscallConfig configures syscall blocking.

type SandboxSeccompUnixConfig

type SandboxSeccompUnixConfig struct {
	Enabled bool   `yaml:"enabled"`
	Action  string `yaml:"action"` // enforce, audit
}

SandboxSeccompUnixConfig configures unix socket monitoring via seccomp.

type SandboxTransparentNetworkConfig

type SandboxTransparentNetworkConfig struct {
	Enabled    bool   `yaml:"enabled"`
	SubnetBase string `yaml:"subnet_base"` // e.g. "10.250.0.0/16"
}

type SandboxUnixSocketsConfig

type SandboxUnixSocketsConfig struct {
	Enabled    *bool  `yaml:"enabled"`     // defaults to true for seccomp enforcement
	WrapperBin string `yaml:"wrapper_bin"` // optional override; defaults to "agentmon-unixwrap" in PATH
}

type SandboxWrapEnvPolicyConfig

type SandboxWrapEnvPolicyConfig struct {
	Enabled bool `yaml:"enabled"`
}

SandboxWrapEnvPolicyConfig opts into enforcing env_policy (allow/deny) on the client-spawned wrap path (shell shim / kernel-install / agentmon wrap). Default off; fail-open. Issue #379.

type SandboxXPCConfig

type SandboxXPCConfig struct {
	Enabled       bool                 `yaml:"enabled"`
	Mode          string               `yaml:"mode"` // enforce, audit, disabled
	WrapperBin    string               `yaml:"wrapper_bin"`
	MachServices  SandboxXPCMachConfig `yaml:"mach_services"`
	ESFMonitoring SandboxXPCESFConfig  `yaml:"esf_monitoring"`
}

SandboxXPCConfig configures macOS XPC/Mach IPC control.

type SandboxXPCESFConfig

type SandboxXPCESFConfig struct {
	Enabled bool `yaml:"enabled"`
}

SandboxXPCESFConfig configures ESF-based XPC monitoring.

type SandboxXPCMachConfig

type SandboxXPCMachConfig struct {
	DefaultAction string   `yaml:"default_action"` // allow, deny
	Allow         []string `yaml:"allow"`
	Block         []string `yaml:"block"`
	AllowPrefixes []string `yaml:"allow_prefixes"`
	BlockPrefixes []string `yaml:"block_prefixes"`
}

SandboxXPCMachConfig configures mach-lookup restrictions.

type SeccompConfig

type SeccompConfig struct {
	Execve ExecveConfig `yaml:"execve"`
}

SeccompConfig is a standalone configuration struct for seccomp-related settings. It wraps ExecveConfig for YAML parsing of execve interception configuration.

type SecurityConfig

type SecurityConfig struct {
	Mode         string `yaml:"mode"`          // auto, full, landlock, landlock-only, minimal
	Strict       bool   `yaml:"strict"`        // Fail if mode requirements not met
	MinimumMode  string `yaml:"minimum_mode"`  // Fail if auto-detect picks worse
	WarnDegraded bool   `yaml:"warn_degraded"` // Log warnings in degraded mode
}

SecurityConfig controls security mode selection and strictness.

type ServerConfig

type ServerConfig struct {
	HTTP       ServerHTTPConfig       `yaml:"http"`
	GRPC       ServerGRPCConfig       `yaml:"grpc"`
	UnixSocket ServerUnixSocketConfig `yaml:"unix_socket"`
	TLS        ServerTLSConfig        `yaml:"tls"`
}

type ServerGRPCConfig

type ServerGRPCConfig struct {
	Enabled bool   `yaml:"enabled"`
	Addr    string `yaml:"addr"`
}

type ServerHTTPConfig

type ServerHTTPConfig struct {
	Addr string `yaml:"addr"`

	ReadTimeout    string `yaml:"read_timeout"`
	WriteTimeout   string `yaml:"write_timeout"`
	MaxRequestSize string `yaml:"max_request_size"`
}

type ServerTLSConfig

type ServerTLSConfig struct {
	Enabled  bool   `yaml:"enabled"`
	CertFile string `yaml:"cert_file"`
	KeyFile  string `yaml:"key_file"`
	// CAFile turns on mutual TLS: a client must present a certificate this
	// bundle signs, on both the HTTP and gRPC listeners. Empty means one-way
	// TLS, where the server proves who it is and the client proves nothing.
	CAFile string `yaml:"ca_file"`
}

func (*ServerTLSConfig) MutualTLS

func (c *ServerTLSConfig) MutualTLS() bool

MutualTLS reports whether client certificates are required.

func (*ServerTLSConfig) Validate

func (c *ServerTLSConfig) Validate() error

Validate checks the inbound TLS config.

type ServerUnixSocketConfig

type ServerUnixSocketConfig struct {
	Enabled     bool   `yaml:"enabled"`
	Path        string `yaml:"path"`
	Permissions string `yaml:"permissions"` // e.g. "0660"
}

type SessionsConfig

type SessionsConfig struct {
	BaseDir     string `yaml:"base_dir"`
	MaxSessions int    `yaml:"max_sessions"`

	// Optional defaults (duration strings). If set, these act as additional caps on top of policy resource_limits.
	DefaultTimeout     string `yaml:"default_timeout"`
	DefaultIdleTimeout string `yaml:"default_idle_timeout"`
	CleanupInterval    string `yaml:"cleanup_interval"`

	// RealPaths, when true, mounts workspace at its actual host path instead of
	// virtualizing under /workspace. This preserves path continuity between
	// host and sandbox environments.
	RealPaths bool `yaml:"real_paths"`

	// Checkpoints configures workspace checkpoint/rollback functionality.
	Checkpoints CheckpointConfig `yaml:"checkpoints"`
}

type ShadowToolConfig

type ShadowToolConfig struct {
	Enabled             *bool    `yaml:"enabled"`              // default: true
	SimilarityCheck     *bool    `yaml:"similarity_check"`     // default: false
	SimilarityThreshold *float64 `yaml:"similarity_threshold"` // default: 0.85, range [0,1]
}

ShadowToolConfig detects tool names that shadow/mimic tools from other servers.

type SigningConfig

type SigningConfig struct {
	TrustStore string `yaml:"trust_store"` // Directory of trusted public keys
	Mode       string `yaml:"mode"`        // "enforce", "warn", or "off" (default: "off")
}

SigningConfig configures policy signature verification.

func (*SigningConfig) SigningMode

func (c *SigningConfig) SigningMode() string

SigningMode returns the effective signing mode, defaulting to "off".

func (*SigningConfig) Validate

func (c *SigningConfig) Validate() error

Validate checks that the signing config has valid values.

type SkillcheckConfig

type SkillcheckConfig struct {
	Enabled    bool                                `yaml:"enabled" json:"enabled"`
	WatchRoots []string                            `yaml:"watch_roots" json:"watch_roots"`
	CacheDir   string                              `yaml:"cache_dir" json:"cache_dir"`
	TrashDir   string                              `yaml:"trash_dir" json:"trash_dir"`
	Limits     SkillcheckLimits                    `yaml:"scan_size_limits" json:"scan_size_limits"`
	Thresholds map[string]string                   `yaml:"thresholds" json:"thresholds"`
	Providers  map[string]SkillcheckProviderConfig `yaml:"providers" json:"providers"`
}

SkillcheckConfig configures the skillcheck daemon that scans Claude Code skill installations under ~/.claude/skills and plugin skill directories.

type SkillcheckLimits

type SkillcheckLimits struct {
	PerFileBytes int64 `yaml:"per_file_bytes" json:"per_file_bytes"`
	TotalBytes   int64 `yaml:"total_bytes" json:"total_bytes"`
}

SkillcheckLimits configures per-file and total byte limits for skill scanning.

type SkillcheckProviderConfig

type SkillcheckProviderConfig struct {
	Enabled     bool          `yaml:"enabled" json:"enabled"`
	Timeout     time.Duration `yaml:"timeout" json:"timeout"`
	OnFailure   string        `yaml:"on_failure" json:"on_failure"`
	BinaryPath  string        `yaml:"binary_path,omitempty" json:"binary_path,omitempty"`   // snyk
	BaseURL     string        `yaml:"base_url,omitempty" json:"base_url,omitempty"`         // skills_sh
	ProbeAudits bool          `yaml:"probe_audits,omitempty" json:"probe_audits,omitempty"` // skills_sh
}

SkillcheckProviderConfig configures a single skillcheck provider.

type TLSInspectionConfig

type TLSInspectionConfig struct {
	Enabled bool   `yaml:"enabled"`
	CACert  string `yaml:"ca_cert"`
	CAKey   string `yaml:"ca_key"`
}

TLSInspectionConfig configures TLS interception (requires CA cert).

type ThreatFeedEntry

type ThreatFeedEntry struct {
	Name   string `yaml:"name"`
	URL    string `yaml:"url"`
	Format string `yaml:"format"` // "hostfile" or "domain-list"
}

ThreatFeedEntry defines a single remote threat feed.

type ThreatFeedsConfig

type ThreatFeedsConfig struct {
	Enabled      bool              `yaml:"enabled"`
	Action       string            `yaml:"action"`
	Feeds        []ThreatFeedEntry `yaml:"feeds"`
	LocalLists   []string          `yaml:"local_lists"`
	Allowlist    []string          `yaml:"allowlist"`
	SyncInterval time.Duration     `yaml:"sync_interval"`
	CacheDir     string            `yaml:"cache_dir"`
	Realtime     RealtimeConfig    `yaml:"realtime"`
}

ThreatFeedsConfig configures external threat intelligence feed integration.

type TorConfig

type TorConfig struct {
	Enabled           *bool          `yaml:"enabled"`
	Mode              string         `yaml:"mode"` // deny | audit | allow
	Vectors           TorVectors     `yaml:"vectors"`
	ClientBinaries    []string       `yaml:"client_binaries"`
	SocksPorts        []int          `yaml:"socks_ports"`
	ControlPorts      []int          `yaml:"control_ports"`
	SocksLoopbackOnly *bool          `yaml:"socks_loopback_only"`
	RelayFeed         TorRelayFeed   `yaml:"relay_feed"`
	OnionRules        []TorOnionRule `yaml:"onion_rules"`
}

TorConfig is the raw, as-parsed `tor:` block. A missing block deserializes to the zero value; ResolveTorConfig turns that into the deny-by-default posture. Enabled is a *bool tri-state (nil → true), matching the convention used by SandboxFUSEConfig and WaitKillable.

type TorOnionRule

type TorOnionRule struct {
	Onion    string `yaml:"onion"`
	Decision string `yaml:"decision"` // allow | deny
}

TorOnionRule is one Phase 2 gateway rule: match a SOCKS CONNECT target host (a .onion address or a clearnet host, with filepath.Match globbing) and allow or deny it. Evaluated in listed order, first match wins.

type TorRelayFeed

type TorRelayFeed struct {
	Enabled      bool          `yaml:"enabled"`
	Sources      []string      `yaml:"sources"`
	LocalLists   []string      `yaml:"local_lists"`
	SyncInterval time.Duration `yaml:"sync_interval"`
	CacheDir     string        `yaml:"cache_dir"`
}

TorRelayFeed configures the optional onionoo relay-IP feed.

type TorVectors

type TorVectors struct {
	Processes  *bool `yaml:"processes"`
	SocksPorts *bool `yaml:"socks_ports"`
	Onion      *bool `yaml:"onion"`
	RelayIPs   *bool `yaml:"relay_ips"`
}

TorVectors toggles each enforcement door. Pointers so an operator can relax one door (set false) without the zero value disabling all.

type WatchtowerAuthConfig

type WatchtowerAuthConfig struct {
	TokenFile      string `yaml:"token_file"`
	TokenEnv       string `yaml:"token_env"`
	ClientCertAuth bool   `yaml:"client_cert_auth"`
}

type WatchtowerBackoffConfig

type WatchtowerBackoffConfig struct {
	Base time.Duration `yaml:"base"`
	Max  time.Duration `yaml:"max"`
}

type WatchtowerBatchConfig

type WatchtowerBatchConfig struct {
	MaxEvents     int           `yaml:"max_events"`
	MaxBytes      int           `yaml:"max_bytes"`
	MaxTimespan   time.Duration `yaml:"max_timespan"`
	FlushInterval time.Duration `yaml:"flush_interval"`
	Compression   string        `yaml:"compression"` // zstd | gzip | none (default)
	ZstdLevel     int           `yaml:"zstd_level"`  // 1..22, default 3 (only used when compression="zstd")
	GzipLevel     int           `yaml:"gzip_level"`  // 1..9,  default 6 (only used when compression="gzip")
}

type WatchtowerChainConfig

type WatchtowerChainConfig struct {
	Algorithm string `yaml:"algorithm"` // hmac-sha256 (default) | hmac-sha512

	// KeySource selects exactly one of: file, env, aws_kms, azure_keyvault,
	// hashicorp_vault, gcp_kms. When empty, the source is inferred from
	// whichever single sub-config below is populated.
	KeySource string `yaml:"key_source"`

	// File/Env source (legacy, still supported).
	KeyFile string `yaml:"key_file"`
	KeyEnv  string `yaml:"key_env"`

	// AWS KMS configuration.
	AWSKMS AWSKMSConfig `yaml:"aws_kms"`

	// Azure Key Vault configuration.
	AzureKeyVault AzureKeyVaultConfig `yaml:"azure_keyvault"`

	// HashiCorp Vault configuration.
	HashiCorpVault HashiCorpVaultConfig `yaml:"hashicorp_vault"`

	// GCP Cloud KMS configuration.
	GCPKMS GCPKMSConfig `yaml:"gcp_kms"`
}

WatchtowerChainConfig configures the WTP per-sink hash chain HMAC key. Mirrors the key-source shape from AuditIntegrityConfig so the daemon (Task 27) can reuse the existing kms package plumbing in internal/audit/kms/provider.go.

type WatchtowerDecisionContextConfig

type WatchtowerDecisionContextConfig struct {
	Tags      []string                  `yaml:"tags"`
	Tailscale WatchtowerTailscaleConfig `yaml:"tailscale"`
	Extra     map[string]string         `yaml:"extra"`
}

type WatchtowerFilterConfig

type WatchtowerFilterConfig struct {
	IncludeTypes      []string `yaml:"include_types"`
	ExcludeTypes      []string `yaml:"exclude_types"`
	IncludeCategories []string `yaml:"include_categories"`
	ExcludeCategories []string `yaml:"exclude_categories"`
	MinRiskLevel      string   `yaml:"min_risk_level"`
}

type WatchtowerHeartbeatConfig

type WatchtowerHeartbeatConfig struct {
	Interval             time.Duration `yaml:"interval"`
	ReconnectAfterMisses int           `yaml:"reconnect_after_misses"`
}

type WatchtowerTLSConfig

type WatchtowerTLSConfig struct {
	// Insecure disables TLS entirely and dials plaintext gRPC. This is a
	// load-bearing security choice — the daemon logs a WARN at startup when
	// this is true. Only set this for local test servers or development
	// environments where TLS is not available. Default: false (TLS on).
	Insecure           bool   `yaml:"insecure"`
	InsecureSkipVerify bool   `yaml:"insecure_skip_verify"`
	CACertFile         string `yaml:"ca_cert_file"`
	ClientCertFile     string `yaml:"client_cert_file"`
	ClientKeyFile      string `yaml:"client_key_file"`
}

type WatchtowerTailscaleConfig

type WatchtowerTailscaleConfig struct {
	// Enabled is tri-state: nil => default (resolved at store construction:
	// enabled, but the source self-disables when the socket is absent),
	// false => never query tailscaled, true => always attempt.
	Enabled *bool  `yaml:"enabled"`
	Socket  string `yaml:"socket"` // optional tailscaled socket path override
}

type WatchtowerWALConfig

type WatchtowerWALConfig struct {
	SegmentSize   int64         `yaml:"segment_size"`
	MaxTotalBytes int64         `yaml:"max_total_bytes"`
	SyncMode      string        `yaml:"sync_mode"` // immediate (only mode currently implemented; "deferred" is reserved for the periodic-sync timer hook and rejected by validation until that lands)
	SyncInterval  time.Duration `yaml:"sync_interval"`
}

type WebAuthnConfig

type WebAuthnConfig struct {
	RPID             string   `yaml:"rp_id"`             // e.g., "agentmon.local"
	RPName           string   `yaml:"rp_name"`           // e.g., "agentmon"
	RPOrigins        []string `yaml:"rp_origins"`        // e.g., ["http://localhost:18080"]
	UserVerification string   `yaml:"user_verification"` // preferred, required, discouraged
}

WebAuthnConfig configures WebAuthn/FIDO2 authentication.

Jump to

Keyboard shortcuts

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