Skip to content

Getting Started

This guide will help you get OxideShield™ up and running in your environment.

Prerequisites

  • Python: 3.9 - 3.14 (for Python bindings)
  • Node.js: 16+ (for WASM package)

Installation

Rust

Add OxideShield™ to your Cargo.toml:

[dependencies]
oxide-guard = "0.1"

# For ML-based guards (optional)
oxide-guard = { version = "0.1", features = ["semantic"] }

Python

# Using uv (recommended)
uv pip install oxideshield

# Using pip
pip install oxideshield

CLI

cargo install oxide-cli

Or download pre-built binaries from oxideshield.ai/downloads.

First Steps

1. Basic Guard Usage

use oxide_guard::{Guard, LengthGuard, PerplexityGuard};

// Length guard - simple, no dependencies
let length_guard = LengthGuard::new("length")
    .with_max_chars(10000)
    .with_max_tokens(4000);

let result = length_guard.check("Hello, how are you?");
if result.passed {
    println!("Input is safe");
} else {
    println!("Blocked: {}", result.reason);
}

// Perplexity guard - detects adversarial suffixes
let perplexity_guard = PerplexityGuard::new("perplexity")
    .with_max_perplexity(50000.0)
    .with_min_entropy(1.5);

let result = perplexity_guard.check("Normal text here");

2. PII Detection

use oxide_guard::{Guard, PIIGuard, RedactionStrategy, PIICategory};

let guard = PIIGuard::new("pii")
    .with_redaction(RedactionStrategy::Mask)
    .with_categories(&[PIICategory::Email, PIICategory::Phone, PIICategory::CreditCard]);

let result = guard.check("My email is john@example.com");
// result.sanitized = Some("My email is j***@example.com")
println!("Sanitized: {:?}", result.sanitized);

3. Multi-Layer Defense

use oxide_guard::{
    MultiLayerDefense, LayerConfig, AggregationStrategy,
    PatternGuard, PIIGuard, LengthGuard,
};

let defense = MultiLayerDefense::builder("full-defense")
    .add_guard(
        LayerConfig::new("patterns").with_weight(1.0),
        Box::new(PatternGuard::new("patterns"))
    )
    .add_guard(
        LayerConfig::new("pii").with_weight(0.8),
        Box::new(PIIGuard::new("pii"))
    )
    .add_guard(
        LayerConfig::new("length").with_weight(0.5),
        Box::new(LengthGuard::new("length").with_max_chars(10000))
    )
    .with_strategy(AggregationStrategy::FailFast)
    .build();

let result = defense.check(user_input);
println!("Passed: {}, Duration: {:?}", result.passed, result.total_duration);

Configuration

YAML Configuration

Create oxideshield.yaml:

guards:
  pattern:
    enabled: true
    severity_threshold: medium

  pii:
    enabled: true
    redaction: mask
    categories:
      - email
      - phone
      - credit_card

  length:
    enabled: true
    max_chars: 10000
    max_tokens: 4000

  toxicity:
    enabled: true
    threshold: 0.7
    categories:
      - hate
      - violence
      - harassment

pipeline:
  strategy: fail_fast
  timeout_ms: 100

Environment Variables

export OXIDESHIELD_CONFIG=/path/to/config.yaml
export OXIDESHIELD_SEVERITY_THRESHOLD=medium
export OXIDESHIELD_DEFAULT_ACTION=block

Next Steps