secretguard

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2026 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ActionBlock  = "block"
	ActionRedact = "redact"
	ActionLog    = "log"
)

Action values for enabled configuration.

View Source
const (
	AuditFailClosed = "fail_closed"
	AuditBestEffort = "best_effort"
)

Audit failure policy values.

View Source
const (
	DefaultScanMaxBytes   = 2 << 20
	MaxScanMaxBytes       = 64 << 20
	DefaultMinSecretBytes = 8
	DefaultMaskByte       = "*"
)

Defaults applied by DecodeConfig.

View Source
const FailureKindScanLimit = "scan_limit"

FailureKindScanLimit is set on Decision when scan_max_bytes is exceeded.

View Source
const FailureKindUnsupportedJSONToken = "unsupported_json_token"

FailureKindUnsupportedJSONToken is set on Decision when a JSON key or scalar token matched during redact but cannot be mutated in place.

View Source
const ID = "secrets-guard"

ID is the feature plugin id / factory kind for secrets-guard.

Variables

This section is empty.

Functions

func CompositionOptions

func CompositionOptions(cfg Config) (includePopular bool, include, exclude []string, minBytes int, auditPolicy string, maskByte byte, preservePrefix bool)

CompositionOptions extracts inventory and presentation options from a validated Config for composition-time wiring (env catalog / redaction hints).

func EnabledRegistrations

func EnabledRegistrations(regs []lipsdk.Registration) ([]lipsdk.Registration, error)

EnabledRegistrations returns the enabled secrets-guard feature registrations in config order. It rejects more than one enabled secrets-guard registration so startup cannot silently pick an arbitrary instance.

func FeatureBundle

func FeatureBundle(cfg Config) lipfeature.FeatureBundle

FeatureBundle returns a schema-V1 feature bundle contributing one SecretGuard.

func HasSingleUserKey

func HasSingleUserKey(n yaml.Node) bool

HasSingleUserKey reports whether raw YAML is a mapping that contains the single_user key (document wrappers are unwrapped). Used by composition; DecodeConfig does not enforce access-mode rules.

func NewGuard

func NewGuard(cfg Config) sdk.Guard

NewGuard returns a Guard for the given validated config.

func ValidateAccessMode

func ValidateAccessMode(_ Config, multiUser bool, raw yaml.Node) error

ValidateAccessMode rejects single_user config when the effective access mode is multi-user. Composition calls this; DecodeConfig does not.

Types

type Config

type Config struct {
	Order              *int             `yaml:"order"`
	Action             string           `yaml:"action"`
	AuditFailurePolicy string           `yaml:"audit_failure_policy"`
	MinSecretBytes     int              `yaml:"min_secret_bytes"`
	ScanMaxBytes       int              `yaml:"scan_max_bytes"`
	SingleUser         SingleUserConfig `yaml:"single_user"`
	Redaction          RedactionConfig  `yaml:"redaction"`
}

Config is the secrets-guard feature plugin YAML configuration.

func DecodeConfig

func DecodeConfig(n yaml.Node) (Config, error)

DecodeConfig parses and validates secrets-guard YAML. Action is required.

type RedactionConfig

type RedactionConfig struct {
	MaskByte              string `yaml:"mask_byte"`
	PreserveKnownPrefixes bool   `yaml:"preserve_known_prefixes"`
}

RedactionConfig controls mask presentation hints for operators / future matcher wiring.

type RuntimeConfig

type RuntimeConfig struct {
	Enabled               bool
	Action                string
	AuditFailurePolicy    string
	AuditConfigVersion    string
	IncludePopularEnv     bool
	IncludeEnv            []string
	ExcludeEnv            []string
	MinSecretBytes        int
	PreserveKnownPrefixes bool
	MaskByte              byte
}

RuntimeConfig is the decoded secrets-guard feature config used by runtimebundle.

func ComposeRuntimeConfig

func ComposeRuntimeConfig(accessMode string, regs []lipsdk.Registration) (RuntimeConfig, error)

ComposeRuntimeConfig decodes enabled secrets-guard feature YAML.

type SingleUserConfig

type SingleUserConfig struct {
	IncludePopularEnv bool     `yaml:"include_popular_env"`
	IncludeEnv        []string `yaml:"include_env"`
	ExcludeEnv        []string `yaml:"exclude_env"`
}

SingleUserConfig configures single-user environment inventory hints (composition uses these later).

Directories

Path Synopsis
Package engine provides the concrete secret catalog, Aho-Corasick exact pattern matching automaton, credential inventory discovery, and source policy implementation for the secretguard feature plugin.
Package engine provides the concrete secret catalog, Aho-Corasick exact pattern matching automaton, credential inventory discovery, and source policy implementation for the secretguard feature plugin.

Jump to

Keyboard shortcuts

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