Dev.to Security πŸ” Cybersecurity πŸ‘ 0 πŸ“– 1 min read

Why Drawing a Black Box Over a PDF Leaks Your SSN (and How I Built a 100% Local Rasterizing Redactor)

Every tax season, millions of people try to hide their Social Security Number or account balance on a PDF by drawing a black rectangle in Preview or an online PDF editor. The problem? A black rectangle is just an annota

Every tax season, millions of people try to hide their Social Security Number or account balance on a PDF by drawing a black rectangle in Preview or an online PDF editor.

The problem? A black rectangle is just an annotation sitting on top of the text layer. Anyone who receives that PDF can press Ctrl+A, copy, and paste the "redacted" SSN straight into Notepad.

Even worse, most web-based redaction tools require you to upload your unredacted W-2, paystub, or legal contract to their servers first.

How True Client-Side Redaction Works

When building SafePDFRedact, I wanted two guarantees:

  1. Zero network uploads (the tool keeps working even if you turn off Wi-Fi).
  2. Irreversible redaction (zero recoverable text layer and zero leftover PDF metadata).

Step 1: Render Each Page to an Offscreen 2x DPI Canvas

Instead of editing PDF text streamsβ€”which is notoriously brittle across custom font encodings and overlapping glyphsβ€”we render each page to a high-DPI HTML5 Canvas in browser RAM.

Step 2: Burn Blackout Rectangles Directly Into Pixels

Both manual drag boxes and client-side regex auto-detections (SSNs, EINs, bank account numbers, emails, phone numbers) are painted directly onto the 2D canvas context. Once painted, the underlying pixel data no longer exists.

Step 3: Rebuild a Fresh PDF & Wipe Metadata

We embed the flattened canvas images into a brand-new PDF document with empty Title, Author, Subject, Creator, and Producer fieldsβ€”eliminating hidden edit histories and author tags.

Try the Ctrl+A Test Yourself

You don't need to upload a private file to test this. Open SafePDFRedact, click Load Sample W-2, redact the SSN, export Page 1 (free, no watermark), and press Ctrl+A on the resulting PDF.

If you're a bookkeeper or accountant also dealing with PDF bank statements and receipts locally, you can check out our companion client-side workbench JSONtoSheet as well.

πŸ“° Read the original article on Dev.to Security

Originally published by Dev.to Security. Aggregated on AIWithGhost for educational purposes β€” full credit and traffic to the original publisher.