pub struct CustomRule {
pub id: String,
pub name: String,
pub description: String,
pub severity: Severity,
pub category: FindingCategory,
pub match_spec: MatchSpec,
pub source_file: Option<PathBuf>,
}Expand description
A user-defined rule loaded from YAML. Fires when source, sink, and path predicates all match a propagation path produced by the engine.
Fields§
§id: StringStable identifier, embedded into every emitted finding’s message and
extracted by SARIF / JSON sinks via extract_custom_rule_id. Validated
at deserialise time against ^[A-Za-z_][A-Za-z0-9_-]{0,63}$ so a
malicious or sloppy YAML cannot inject ]/[/whitespace and corrupt
the message-encoding contract or empty out the rule attribution.
name: String§description: String§severity: Severity§category: FindingCategory§match_spec: MatchSpec§source_file: Option<PathBuf>Path of the YAML file this rule was loaded from. Set by
load_rules_dir / parse_rules_multi_doc_with_source. Threaded into
every Finding this rule emits (FindingSource::Custom) so an
operator inspecting JSON / SARIF output can distinguish authentic
built-in findings from any rule that may have been planted in a
shared --invariants-dir. Defaults to None for rules constructed
in tests or in code paths that didn’t go through the loader.
Trait Implementations§
Source§impl Clone for CustomRule
impl Clone for CustomRule
Source§fn clone(&self) -> CustomRule
fn clone(&self) -> CustomRule
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more