Skip to main content

Crate redact_gateway

Crate redact_gateway 

Source
Expand description

OpenAI-compatible AI privacy gateway that embeds redact-core in-process.

The gateway sits between an application and a model provider. On the way out it detects sensitive values and applies the action a policy profile specifies for each entity type: allow, block, mask, replace, hash, or tokenize. On the way back it can restore tokenized values so the caller sees a complete answer while the provider only ever saw placeholders.

use redact_gateway::{config::ResolvedConfig, GatewayServer};

let config = ResolvedConfig::load()?;
GatewayServer::new(config).await?.run().await

§Subsystems

ModuleResponsibility
configResolved configuration from files, environment and flags
policyPer-entity actions and profiles
packsPattern packs loaded from YAML at runtime
redactDetection, action application, tokens and payload traversal
vaultPluggable token map backends
authInbound API key and OIDC authentication
telemetryOpenTelemetry traces, metrics and logs
auditAudit records emitted as OpenTelemetry log records

Re-exports§

pub use config::ConfigError;
pub use config::ConfigHandle;
pub use config::ResolvedConfig;
pub use error::GatewayError;
pub use policy::EntityAction;
pub use policy::PolicySet;
pub use policy::Profile;
pub use server::GatewayServer;

Modules§

audit
Audit emission as an OpenTelemetry Logs concern.
auth
Inbound authentication for the gateway.
config
Resolved gateway configuration and the sources that produce it.
error
Gateway error type rendered as OpenAI-compatible error payloads.
openai
packs
Runtime loading of YAML pattern packs into a redact_core::Recognizer.
policy
Redaction policy: per-entity actions evaluated on the request hot path.
proxy
HTTP client for the OpenAI-compatible inference provider.
redact
Policy-driven redaction of text and OpenAI payloads.
routes
HTTP surface: OpenAI-compatible endpoints plus gateway utilities.
server
Server assembly: engine, pattern packs, token map, auth, audit and router.
stream
Server-sent event handling for streaming chat completions.
telemetry
OpenTelemetry SDK bootstrap for traces, metrics and logs.
vault
Pluggable token-map backends.