Skip to main content

decode_chain

Function decode_chain 

Source
pub fn decode_chain(input: &str) -> String
Expand description

Apply the full decode chain: percent → HTML → base64 → Unicode NFKC.

Each layer is best-effort:

  • percent and HTML decoding pass non-matching bytes through unchanged
  • base64 decoding requires the entire input to be a valid base64 token; otherwise the layer returns the input unchanged (no partial decode)
  • NFKC always succeeds

§Examples

use agentsec_core::paste::obfuscation::decode_chain;

// Plain text passes through.
assert_eq!(decode_chain("hello"), "hello");

// Percent-encoded text is decoded.
assert_eq!(decode_chain("hello%20world"), "hello world");