Framework-agnostic application-layer API security engine.
Rust port of guard-core's detection engine. Work in progress: currently covers only the CPU-bound detection pipeline. Handlers, protocols, decorators, and I/O layers are not yet ported.
Re-exports the detection engine modules:
- [
compiler] - regex pattern compilation with LRU caching and ReDoS safety validation - [
detect] - the spec 4.0.2 detection pipeline entry point (detect, [detect::DetectConfig], [detect::DetectVerdict]) - [
preprocessor] - unicode NFKC normalization, URL/HTML decoding, null byte removal, whitespace collapsing, and attack-preserving truncation - [
semantic] - token extraction, Shannon entropy, encoding layer detection, attack probability scoring, obfuscation detection, code injection risk analysis, and aggregate threat scoring
Usage
use preprocessor;
use AttackKeywords;
use AttackStructures;
use ;
let raw = "<scr\u{200B}ipt>alert(1)</script>";
let clean = preprocess;
let kw = default;
let st = default;
let result = analyze;
let score = get_threat_score;
assert!;