Documentation
¶
Index ¶
- Constants
- Variables
- func AddPattern(repoRoot, pattern string) error
- func ContainsProtectedPath(text string, patterns []string) (pattern, token string, found bool)
- func LoadPatterns(repoRoot string) ([]string, error)
- func MatchesAny(targetPath string, patterns []string) (string, bool)
- func RemovePattern(repoRoot, pattern string) error
Constants ¶
const PrivatePathsFile = "private-paths"
PrivatePathsFile is the filename inside .envault/ that stores registered patterns.
Variables ¶
var ErrPatternNotFound = fmt.Errorf("pattern not found in private-paths")
ErrPatternNotFound is returned when RemovePattern cannot find the target.
Functions ¶
func AddPattern ¶
AddPattern registers pattern in .envault/private-paths. Idempotent.
func ContainsProtectedPath ¶
ContainsProtectedPath checks whether the given text (typically a Bash command string) contains any token that matches a protected pattern. Returns the first matching pattern and the matched token, or ("", "", false). This is a best-effort heuristic; adversarial bypass coverage is in v0.8.4.
func LoadPatterns ¶
LoadPatterns reads .envault/private-paths and returns the list of patterns. Returns an empty slice (not an error) when the file does not exist.
func MatchesAny ¶
MatchesAny checks whether targetPath matches any of the given patterns. Returns the first matching pattern and true, or ("", false) if no match. Matching strategy (in order):
- filepath.Match(pattern, targetPath) — exact or glob match on full path
- filepath.Match(pattern, filepath.Base(targetPath)) — basename match for simple names
- Prefix directory match: pattern "config/" matches "config/secrets.json"
func RemovePattern ¶
RemovePattern deletes pattern from .envault/private-paths. Returns ErrPatternNotFound if the pattern is not registered.
Types ¶
This section is empty.