Skip to main content

wafrift_encoding/encoding/
mod.rs

1//! Payload encoding strategies — transform payloads to bypass WAF keyword detection.
2//!
3//! Each strategy changes HOW the payload looks without changing WHAT it does.
4//! The server decodes the payload back to its original form, but the WAF
5//! fails to match it against its rules.
6//!
7//! # Module structure
8//!
9//! | Module | Responsibility |
10//! |--------|---------------|
11//! | [`strategy`] | `Strategy` enum and `encode()` dispatcher |
12//! | [`url`] | URL, double-URL, and triple-URL encoding |
13//! | [`unicode`] | Unicode `\uXXXX`, `%uXXXX`, JSON, and HTML entity encoding |
14//! | [`keyword`] | Case alternation, whitespace/comment insertion, SQL obfuscation |
15//! | [`structural`] | Null byte, overlong UTF-8, chunked split, HPP, compression |
16//! | [`layered`] | Multi-strategy chaining and aggressiveness scoring |
17
18/// Keyword manipulation strategies (case, whitespace, comments).
19pub mod keyword;
20/// Multi-strategy layering and aggressiveness scoring.
21pub mod layered;
22/// Strategy enum and encode() dispatcher.
23pub mod strategy;
24/// Structural encoding strategies (null byte, overlong UTF-8, chunked, HPP).
25pub mod structural;
26/// Unicode and HTML entity encoding strategies.
27pub mod unicode;
28/// URL-based encoding strategies (single, double, triple).
29pub mod url;
30
31#[cfg(test)]
32mod tests;
33
34// Re-export everything for backwards compatibility (LAW 2).
35pub use layered::{aggressiveness, encode_layered, layered_combinations};
36pub use strategy::{Strategy, all_strategies, encode};