cd /news/developer-tools/stop-leaking-api-keys-customer-data-… · home › topics › developer-tools › article
[ARTICLE · art-175982] src=dev.to ↗ pub= topic=developer-tools verified=true sentiment=↑ positive

Stop Leaking API Keys & Customer Data in Looms & AI Prompts: Building a 100% Local PII Scrubber and Demo Mode in Vanilla JS

An independent developer built DemoCloak, a free Manifest V3 Chrome/Edge extension and two zero-upload web tools that detect and mask sensitive data such as API keys, emails, and card numbers entirely client-side in vanilla JavaScript. The engine uses Luhn checksums to avoid false-positive card matches, priority-ordered token detection for secrets like sk_live_ and AKIA keys, and 32-bit FNV-1a hashing to map matched strings to deterministic realistic placeholders that can be restored to the original DOM. The extension requests only activeTab, scripting, storage, and tabs permissions, using optional_host_permissions for per-domain auto-apply, and is currently under review on the Chrome Web Store and Microsoft Edge Add-ons.

recommendation

Validate card candidates with Luhn and order detection so secrets match before generic emails or numbers, and request only activeTab plus optional per-origin host permissions instead of all_urls.

more in playbook: Securing agents and AI tools
by read3 min views3 publishedNov 25, 2026

Every developer has had the same minor heart attack: you share your screen on Zoom, record a Loom walkthrough, or paste a production JSON stack trace into Claude/ChatGPT—and two seconds later notice a real customer email, revenue total, or sk_live_ key sitting right there on screen.

Existing screen-blur extensions mostly fall into two camps: manual click-only blur tools that smear your whole UI into ugly smudges, or cloud/subscription tools that charge monthly fees just to hide text.

So I built two free zero-upload web tools plus a lightweight Manifest V3 Chrome/Edge extension (DemoCloak) powered by the exact same 100% client-side vanilla JS detection engine.

Here are the four engineering problems that actually mattered when building it cleanly:

Naive regex redactors ruin dashboards because a 16-digit order ID looks like a credit card, and 2026-11-25 looks like a phone number.

For card detection, every candidate match runs through a lightweight Luhn checksum before we touch the DOM:

export function isValidLuhn(digitsOnly) {
  const digits = String(digitsOnly || '').replace(/\D/g, '');
  if (digits.length < 13 || digits.length > 19) return false;
  if (/^(\d)\1+$/.test(digits)) return false;
  let sum = 0;
  let dbl = false;
  for (let i = digits.length - 1; i >= 0; i -= 1) {
    let d = digits.charCodeAt(i) - 48;
    if (dbl) { d *= 2; if (d > 9) d -= 9; }
    sum += d;
    dbl = !dbl;
  }
  return sum % 10 === 0;
}

We also enforce strict priority precedence: developer tokens (sk_live_, ghp_, AKIA, AIza, xoxb-, JWTs, Bearer ...) match before generic emails or numbers, and custom user keywords/regex take top priority.

Blurred boxes work for quick meetings, but they look awful in product demos, docs, and landing page screenshots. Instead of random gibberish, we hash each matched string with 32-bit FNV-1a so identical customer emails or revenue totals map deterministically to the same realistic placeholder everywhere on the page—preserving currency symbols ($, €, £, ¥), European vs. US decimal commas, and rough order of magnitude:

$48,920.50 → $62,480.00 ceo@realclient.io → alex.chen@acme.example sk_live_... → sk_live_demo_••••9f2a Every wrapped <span> keeps its original string in memory (data-dc-orig) so clicking Restore All unwraps every node cleanly back to the exact original DOM.

TreeWalker + rAF Batching + MutationObserver) Live dashboards (Stripe, Gmail, AWS, CRMs) inject rows dynamically as you scroll. To prevent jank on large DOM trees:

document.createTreeWalker (skipping <script>, <style>, <textarea>, and contenteditable) and mutated in requestAnimationFrame batchesAlt+Shift+B full-tab Panic Veil) live inside a Many privacy extensions ironically ask for <all_urls> on install. DemoCloak requests zero broad host permissions upfront—only activeTab, scripting, storage, and tabs. Per-domain auto-apply rules use optional_host_permissions and only ask Chrome for the single specific origin you click Auto-Apply on Site for.

If you just want to test the engine directly in your browser right now:

.env snippets, or JSON payloads → mask into [EMAIL_1] / [SECRET_1] or realistic fake data → paste ChatGPT/Claude's reply back and restore your real values locally in 1 click.Ctrl+V / ⌘V) or drop any screenshot, draw blur/pixelate/blackout boxes locally, and export a clean EXIF-stripped PNG.$19 one-time lifetime Pro license — no subscription). Currently under review on Chrome Web Store & Microsoft Edge Add-ons, with the unpacked release ready to try now. If you spot any tricky secret formats, currency formats, or SPA edge cases where the scrubber misses a pattern, drop a comment below and I'll add test cases for them!

── more in #developer-tools 4 stories · sorted by recency
── more on @democloak 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
→ Live at https://your-agent.zahid.host ✓
Get free account → Pricing
from €0/mo · no card required
LIVE [news/stop-leaking-api-key…] indexed:0 read:3min 2026-11-25 · —