pub struct RawRule {
pub find: Find,
pub describe: &'static str,
pub importance: u8,
pub min_entropy: Option<f64>,
pub before_assert: Option<Assertion>,
pub after_assert: Option<Assertion>,
pub is_and_assert: bool,
pub check: Option<fn(&str, &str) -> bool>,
}Expand description
原始规则定义。
包含了触发一次敏感信息扫描所需的所有静态配置(正则、描述、熵值要求、断言等)。
最终会被转换并装载进 AnyRule 的执行流中。
Fields§
§find: Find基础匹配查找器(正则表达式或闭包)。
describe: &'static str规则的名称或描述。
importance: u8规则重要程度(0-100),用于计算最终的风险评分。
min_entropy: Option<f64>最低复合熵值要求,低于此值的命中将被过滤(用于过滤死板的测试数据)。
before_assert: Option<Assertion>向前断言 (Lookbehind):检查匹配文本之前的上下文。
after_assert: Option<Assertion>向后断言 (Lookahead):检查匹配文本之后的上下文。
is_and_assert: bool组合逻辑控制:true 表示必须同时满足前后断言 (AND),false 表示满足其一即可 (OR)。默认为 true。
check: Option<fn(&str, &str) -> bool>最终的自定义校验闭包,参数为 (&匹配片段, &完整文本),返回 true 表示校验通过。
Implementations§
Auto Trait Implementations§
impl Freeze for RawRule
impl RefUnwindSafe for RawRule
impl Send for RawRule
impl Sync for RawRule
impl Unpin for RawRule
impl UnsafeUnpin for RawRule
impl UnwindSafe for RawRule
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more