Expand description
lib support for the forbidden-strings scanner.
Structs§
- Cache
Warning - Fixed-token cache warnings remain structured for embedded event reporting. Re-exports warning value for loaded-rules output. One valid cache-warning record storing only fixed protocol tokens.
- Candidate
Scan - Embedded consumers identify candidates independently of redacted display labels. Embedded consumers identify candidates independently of redacted display labels. Embedded consumers identify candidates independently of redacted display labels. What: Caller-owned identity plus safely displayable results from one exact candidate snapshot. Why: Matching pathname components may have identical masked labels; identity must remain independent of display text.
- Compiled
Rules - Re-exports the forbidden-regex rule compiler’s public surface. Re-exports the forbidden-regex rule compiler’s public surface. Re-exports the forbidden-regex rule compiler’s public surface. One compiled rule set paired with the per-rule names that drive finding identity.
- Scanner
- Embedded consumers identify candidates independently of redacted display labels. Embedded consumers identify candidates independently of redacted display labels. Embedded consumers identify candidates independently of redacted display labels. One loaded ruleset reused across candidate snapshots.
Enums§
- Load
Error - Re-exports the forbidden-regex rule compiler’s public surface. Re-exports the redacted load-error type as this module’s public failure. Re-exports the forbidden-regex rule compiler’s public surface. Re-exports the redacted load-error type as this module’s public failure. Re-exports the forbidden-regex rule compiler’s public surface. Re-exports the redacted load-error type as this module’s public failure. A rule-load failure with everything the rule text redacted out.
- Scan
Finding - Public findings contain only source locations and non-secret rule identities. What: One content/name result or explicit inability to complete a scan. Why: Enum variants keep source locations separate from operational failures without sentinel line numbers.
Constants§
- BUILTIN_
NAMES - The builtin baseline’s rule-name sidecar, embedded at build time.
- BUILTIN_
PRECOMPILED - The builtin baseline precompiled into a serialized
RegexSet, embedded at build time. - BUILTIN_
RULES - What:
pub const BUILTIN_RULES: &str = include_str!("../data/builtin-rules.txt");declares an exported constant whose value is the entire betterleaks-ported baseline ruleset, pasted into the binary at COMPILE time by theinclude_str!macro.&stris a read-only view of UTF-8 bytes baked into the binary; the siblingStringwould heap-allocate the same bytes again at runtime for no benefit. Why: Ships the baseline inside the published binary so the opt-in--builtin-rulesflag works with no rules file on disk, and lets consumers (the forbidden-regex bench crate) import the same rules instead ofinclude_str!-ing a fragile relative path into this repository. Gotcha: Editingdata/builtin-rules.txtchanges nothing until the crate is rebuilt, and the file itself is GENERATED bysrc/mise.port-betterleaks.ts; never edit it by hand.
Functions§
- compile_
from_ text - Re-exports the forbidden-regex rule compiler’s public surface.
Re-exports the forbidden-regex rule compiler’s public surface.
Re-exports the forbidden-regex rule compiler’s public surface.
Compiles a rule source (autodetected format) into a combined
RegexSet. - compile_
rules - Re-exports the forbidden-regex rule compiler’s public surface.
Re-exports the forbidden-regex rule compiler’s public surface.
Re-exports the forbidden-regex rule compiler’s public surface.
Compiles a rule source into a combined
RegexSetplus its per-rule names. - load_
precompiled - Re-exports the forbidden-regex rule compiler’s public surface.
Re-exports the forbidden-regex rule compiler’s public surface.
Re-exports the forbidden-regex rule compiler’s public surface.
Loads a precompiled serialized
RegexSetfrom bytes. - run_
cli_ from_ env - Run the scanner from real process arguments and environment values.