secretpath

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package secretpath matches a filesystem path against a configured list of glob-style secret path patterns, so a caller can decide whether a path holds sensitive content before it reads, writes, or logs it. Matches is a pure string decision; it never touches the filesystem.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Matcher

type Matcher struct {
	// contains filtered or unexported fields
}

Matcher holds a compiled, ordered list of secret path patterns.

func NewMatcher

func NewMatcher(patterns []string) (*Matcher, error)

NewMatcher compiles patterns into a Matcher. patterns follow path.Match glob syntax, plus a trailing '/' to match a directory and everything under it, and a leading '!' to negate a later match. An invalid glob returns an error naming the pattern's index.

func (*Matcher) Matches

func (m *Matcher) Matches(input string) bool

Matches reports whether path matches the compiled pattern set. It cleans the input with path.Clean and treats '\' the same as '/' first. Patterns apply in list order; the last matching pattern, positive or negated, decides the result. A nil *Matcher holds no pattern, so it matches nothing and returns false.

Jump to

Keyboard shortcuts

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