Expand description
lib support for the forbidden-strings scanner.
Structs§
- Compiled
Rules - Re-exports the forbidden-regex rule compiler’s public surface. One compiled rule set paired with the per-rule names that drive finding identity.
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. A rule-load failure with everything the rule text redacted out.
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.
Compiles a rule source (autodetected format) into a combined
RegexSet. - compile_
rules - 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.
Loads a precompiled serialized
RegexSetfrom bytes. - run_
cli_ from_ env - Run the scanner from real process arguments and environment values.