pub enum UrlStrategy {
PercentEncodeAggressive,
DoublePercentEncode,
NonCanonicalSpaces,
Hpp,
}Expand description
Per-value mutation choice.
Variants§
PercentEncodeAggressive
Percent-encode every byte that isn’t alphanumeric. Most signatures match decoded payloads but verify by raw-byte regex — this breaks both checks at once.
DoublePercentEncode
Double-percent-encode (% → %25, then percent-encode again).
Bypasses URL-decode-then-match WAFs that decode exactly once.
NonCanonicalSpaces
Mix in + for spaces, 0x2F for /, etc. — non-canonical
encodings that some upstream parsers normalise but signatures
don’t.
Hpp
DEPRECATED — use query_pollute_pairs with
HppStrategy::ArrBracket instead.
This UrlStrategy::Hpp value-level variant is a stub: a single
value byte slice cannot express HPP (which requires
modifying the (name, value) pair set). Selecting it returns
the value unchanged and logs url:hpp_unimplemented so the
gene-bank doesn’t get poisoned with a fake “winning HPP”
entry. The real implementation moved to query_pollute_pairs
in pass 21 R74; new callers must use that. Retained as pub
for LAW 2 backwards-compat — existing rule files that name
url:hpp keep parsing but emit the honest _unimplemented
label so the operator sees nothing was actually polluted.
Implementations§
Source§impl UrlStrategy
impl UrlStrategy
Sourcepub fn apply(self, value: &str) -> String
pub fn apply(self, value: &str) -> String
Apply the strategy to a single decoded value, returning the mutated raw form (already URL-safe — caller does not re-encode).
Sourcepub fn apply_bytes(self, value: &[u8]) -> String
pub fn apply_bytes(self, value: &[u8]) -> String
Byte-clean variant of Self::apply for percent-encoding
strategies. Lets callers run a non-UTF-8 byte sequence (e.g.
the raw bytes from a percent-decode on %FF%FE) through the
pipeline without it being silently rewritten to U+FFFD by
String::from_utf8_lossy. Each strategy that only operates
on bytes (PercentEncodeAggressive, DoublePercentEncode) is
byte-pure here. Strategies that need character semantics
(NonCanonicalSpaces) lossy-convert internally.
Sourcepub fn apply_bytes_with_label(self, value: &[u8]) -> (String, &'static str)
pub fn apply_bytes_with_label(self, value: &[u8]) -> (String, &'static str)
Apply the strategy and return BOTH the encoded output AND the
label that honestly describes what was done. For most strategies
this is just Self::label(), but DoublePercentEncode silently
downgrades to single-percent encoding above MAX_DOUBLE_ENCODE_INPUT
(to avoid 9× output blowup) — pre-fix the technique log still
reported url:double_percent even though only one pass ran,
poisoning every WAF-decay statistic. Now the downgrade is
surfaced via url:double_percent_downgraded so callers (and
the gene-bank) see what actually shipped.
Audit (2026-05-10).
Trait Implementations§
Source§impl Clone for UrlStrategy
impl Clone for UrlStrategy
Source§fn clone(&self) -> UrlStrategy
fn clone(&self) -> UrlStrategy
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for UrlStrategy
Source§impl Debug for UrlStrategy
impl Debug for UrlStrategy
impl Eq for UrlStrategy
Source§impl PartialEq for UrlStrategy
impl PartialEq for UrlStrategy
Source§fn eq(&self, other: &UrlStrategy) -> bool
fn eq(&self, other: &UrlStrategy) -> bool
self and other values to be equal, and is used by ==.impl StructuralPartialEq for UrlStrategy
Auto Trait Implementations§
impl Freeze for UrlStrategy
impl RefUnwindSafe for UrlStrategy
impl Send for UrlStrategy
impl Sync for UrlStrategy
impl Unpin for UrlStrategy
impl UnsafeUnpin for UrlStrategy
impl UnwindSafe for UrlStrategy
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.