Skip to content

GibberishGuard

GibberishGuard detects nonsensical, random, or garbage input that may indicate adversarial noise, random token spam, or obfuscated attacks.

Overview

Property Value
Latency <5ms
Memory 50 KB
Async No
ML Required No
License Community

Detection Methods

Method Description
Entropy analysis High Shannon entropy indicates random/compressed data
Dictionary word ratio Low ratio of recognized words suggests gibberish
Character distribution Unusual character class distribution flags anomalies
Repetition detection Excessive character/pattern repetition

Usage

Rust

use oxideshield_guard::guards::GibberishGuard;
use oxideshield_guard::{Guard, GuardAction};

let guard = GibberishGuard::new("gibberish")
    .with_action(GuardAction::Block);

let result = guard.check("asdkjh qwer zxcv bnm poiu lkjh gfds");
assert!(!result.passed);

Python

from oxideshield import gibberish_guard

guard = gibberish_guard(action="block", entropy_threshold=4.5, word_ratio_threshold=0.3)
result = guard.check("asdkjh qwer zxcv bnm poiu lkjh gfds")
assert not result.passed

Configuration

guards:
  - type: gibberish
    action: block
    entropy_threshold: 4.5
    word_ratio_threshold: 0.3

Research References