# File Scrubbing: Local RAM PII Redaction for PDFs, Office Docs, Spreadsheets & Images

> **Canonical URL:** https://privacyscrubber.com/file-scrubbing/
> **Markdown Mirror:** https://privacyscrubber.com/file-scrubbing.md
> **Standard:** Zero-Trust Data Sanitization (ZTDS™ RFC v1.0 · IETF `draft-sibiryakov-ztds-protocol`)
> **Release:** Web App v2.5.1 · SDK v2.5.3 · MCP Server v2.5.3

File scrubbing removes Personally Identifiable Information (PII), Protected Health Information (PHI), payment card numbers, secrets, and hidden document metadata across visible text, scanned image pixels (local WebAssembly OCR), and binary headers inside device RAM with zero server uploads.

## Why Visual Black Boxes Fail (3 Exposure Layers)
1. **Selectable Text & XML Runs:** PDF content streams, DOCX XML paragraphs, and Excel cell values remain copyable behind overlay shapes.
2. **Scanned Images & Rasterized Documents:** Tax forms (W-2, 1040), clinical scans, and ID photos require local WebAssembly OCR plus permanent flattened pixel burn-in.
3. **Hidden Binary Metadata:** Office author fields, tracked changes, PDF Info/XMP packets, and image EXIF/GPS coordinates leak identity even when body text looks redacted.

## Format Matrix & Output Modes
| Format | Risks Addressed | Local RAM Scrubbing Output |
| :--- | :--- | :--- |
| Digital & Scanned PDF (`.pdf`) | Selectable text, multi-column financial tables, embedded scans, XMP/Info headers | Tokenized AI text with 1-Click Reveal OR flattened solid blackout PDF with metadata stripped |
| Word Documents (`.docx`) | Paragraph XML runs, signatures, author metadata | Deterministic typed surrogates (`[NAME_1]`, `[CONTRACT_ID_1]`) for safe LLM review |
| Spreadsheets (`.xlsx`, `.csv`) | Multi-tab payroll ledgers, customer emails, national IDs | Row-consistent cell tokenization preserving numeric ledger totals |
| Images (`.jpg`, `.png`, `.webp`) | EXIF device tags, GPS coordinates, XMP provenance, visual text | Binary EXIF/GPS strip (<0.2ms) + solid OCR coordinate blackout |
| Code, Logs & JSON (`.txt`, `.json`, `.log`) | AWS keys, JWTs, PEM blocks, stack trace emails | Schema-preserving key/PII masking in <1ms local memory |

## Architecture Comparison (Local RAM ZTDS vs. Cloud DLP vs. Manual Redaction)
| Criterion | PrivacyScrubber (Local RAM ZTDS) | Cloud DLP SaaS Proxies (e.g. Strac, Nightfall) | Manual PDF Editors |
| :--- | :--- | :--- | :--- |
| Raw File Egress | `0 bytes` (runs in client RAM) | `100%` uploaded to vendor servers | `0 bytes` (local desktop) |
| Text Latency | `< 1 ms` in RAM | `150–400 ms+` network hop | `5–25 min` per file |
| Reverse Reveal for LLMs | Yes (bijective surrogate dictionary in RAM) | Limited / destructive | No |
| Metadata / EXIF Stripping | Automatic | Varies by SaaS connector | Manual sanitize step |
| Air-Gapped / Airplane Mode | Yes | No | Yes |
| Pricing | Free (15k/5k) · PRO `$15/mo` (`$110` Lifetime) · TEAMS `$99/mo` flat · SDK `$299/mo` | Quote-based enterprise / per-GB | `$20–$30/user/mo` |

## 5-Step Airplane Mode Verification Protocol
1. Open `https://privacyscrubber.com/?mode=doc#doc` in your browser.
2. Press `F12` -> **Network** -> enable **Preserve log** and clear existing entries.
3. Disconnect Wi-Fi / turn on OS Airplane Mode or set DevTools throttling to **Offline**.
4. Drop a synthetic PDF, DOCX, XLSX, or geotagged JPEG file and run OCR / PII / metadata scrubbing.
5. Confirm `0 bytes` outbound file requests in DevTools and export an offline-verifiable SHA-256 Compliance Receipt.

## Programmatic SDK & MCP Usage
```typescript
import { sanitize, restore } from '@privacyscrubber/sdk';
import { stripExifMetadata } from '@privacyscrubber/sdk/vision';

const { cleanBuffer } = stripExifMetadata(rawImageBuffer);
const { scrubbedText, tokenMap } = sanitize(docText, { profile: 'finance' });
```

- **Web File Sandbox:** https://privacyscrubber.com/?mode=doc#doc
- **TEAMS Deployment ($99/mo flat):** https://privacyscrubber.com/teams/
- **Developer SDK ($299/mo):** https://privacyscrubber.com/sdk/
- **PII MCP Server (`sanitize_file` / `redact_file`):** https://privacyscrubber.com/pii-mcp/
