Nick Stocks

Project · AI tooling

Data Loss Prevention

Inspect sensitive data in AI tool traffic, with configurable detection and redaction policies.

Simplified architecture
  1. InputTool request or response
  2. InspectNormalised views and original spans
  3. PolicyEvaluate findings by group
  • FilterRedact mapped spans
  • Warn or allowReturn content and findings
  • BlockReturn a policy error

Inspect data as tools exchange it

I built a DLP pipeline for requests and responses moving through an AI tool gateway. Detection groups cover personal information, credentials and other secrets, with policy deciding whether a finding should trigger redaction, a warning or a block.

The work spans the original filtering service and a Rust engine rewrite. The rewrite uses shared document views, span provenance and a common finding model so that detection and policy can evolve independently.

Preserve evidence through transformation

Normalisation helps expose content hidden by encoding or formatting. Findings also need to map back to the original input so redaction changes the intended bytes. That makes span mapping and deterministic overlap handling part of the engine’s core design.

Document and archive handling introduces a second concern: bounded work. The review covered request size checks, streaming memory use, archive recursion limits and adversarial performance.

Test the difficult cases

My review process included obfuscated inputs, false positives, prompt-injection patterns and regression fixtures. Recorded fixes included limiting streaming accumulation and closing a zero-width-character bypass. Detection policy needs explicit handling for ambiguous findings and scanner failures.