Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsAllowed ¶
IsAllowed reports whether the target is permitted by the allowlist. target must be a "host/owner/repo" string (e.g. "github.com/bborbe/maintainer"). If the allowlist is empty or nil, all targets are allowed (allow-all semantics). If target is empty and the allowlist is non-empty, returns false. Malformed or invalid wildcard entries are logged with glog.Errorf and skipped.
A leading '!' on an entry (immediately after TrimSpace, with no whitespace between '!' and the entry body) marks the entry as an exclusion. Example: "!github.com/bborbe/go-skeleton" excludes go-skeleton.
A target is allowed iff (includes is empty OR any include matches the target) AND (no exclude matches the target). Excludes always override includes — if both match, the target is rejected.
An exclude-only allowlist (no include entries) means "allow everything except the excluded entries" — the canonical allow-all-except case.
Example:
includes: github.com/bborbe/* excludes: !github.com/bborbe/go-skeleton → allows every bborbe repo except go-skeleton.
No ctx parameter: malformed-entry errors are logged via glog and discarded; they never escape the function, so there is nothing for ctx to enrich. Validate carries the ctx since it returns the error to the caller.
func Validate ¶
Validate checks all entries in the allowlist for well-formedness. Returns nil if the allowlist is empty/nil or all entries are valid. Returns an aggregate error listing every malformed entry found. Whitespace-only and empty entries are silently skipped (not malformed). A leading '!' on an entry marks it as an exclusion; the well-formedness check runs on the post-'!' portion of the entry, but the aggregated error message names the ORIGINAL '!'-prefixed entry so the operator sees what they wrote.
Types ¶
This section is empty.