pub struct WafCfg {
pub mode: String,
pub sqli: bool,
pub xss: bool,
pub path_traversal: bool,
pub inspect_path: bool,
pub inspect_headers: bool,
pub inspect_body: bool,
pub rules: Vec<WafRule>,
}Expand description
WAF-lite input inspection (Phase 4 / v2). Screens a request for common attack signatures
before it is forwarded, using built-in heuristic rulesets (SQLi/XSS/path-traversal) plus
any operator-defined deny patterns. Disabled by default — these are heuristics, so the
intended rollout is report (log + count matches without blocking) until the operator is
confident, then block (return 403). Compiled into a crate::waf::WafEngine.
Fields§
§mode: String“off” (default) | “report” | “block”. report evaluates rules and logs/counts matches
but forwards the request anyway; block rejects a matching request with 403.
sqli: boolEnable the built-in SQL-injection heuristic ruleset.
xss: boolEnable the built-in cross-site-scripting heuristic ruleset.
path_traversal: boolEnable the built-in path-traversal heuristic ruleset.
inspect_path: boolInspect the request path + query string (matched raw and percent-decoded). Default true.
inspect_headers: boolInspect request header values. Off by default: header bytes (cookies, tokens, opaque blobs) are noisy and prone to false positives.
inspect_body: boolInspect the request body (already capped by validation.max_body). Off by default.
rules: Vec<WafRule>Operator-defined deny patterns, evaluated alongside the enabled built-in rulesets.