Dev.to Security 🔐 Cybersecurity 👁 0 📖 2 min read

How We Built 11 Browser-Only Security Tools Enforced by CSP: default-src 'none' and SHA-256 Script Hashes

Almost every "free online security tool" — JWT debuggers, PDF watermarkers, .env scanners, SSH key generators, QR generators — claims "we don't store your data". That is a privacy policy promise, not a technical guarant

Almost every "free online security tool" — JWT debuggers, PDF watermarkers, .env scanners, SSH key generators, QR generators — claims "we don't store your data".

That is a privacy policy promise, not a technical guarantee. One third-party analytics script, CDN compromise, or accidental fetch() call can quietly ship your JWT payload, passport photo, or .env secrets off your device.

When we built Keyrook's 11 Free Offline Security Tools, we decided the browser itself should enforce the offline guarantee so users don't have to trust us — they can verify 0 bytes sent in DevTools Network in two seconds.

The Architecture: Make Network Exfiltration Impossible by Default

Every tool page under keyrook.com/tools/* is compiled into a self-contained static HTML file with a strict Content Security Policy:

Content-Security-Policy:
  default-src 'none';
  script-src 'sha256-<exact-inline-hash>';
  style-src 'sha256-<exact-inline-hash>';
  img-src 'self' data: blob:;
  connect-src 'none';
  form-action 'none';
  frame-ancestors 'none';
  base-uri 'none';

What this guarantees at the browser engine level:

  1. Zero network requests after HTML load — connect-src 'none' and default-src 'none' mean fetch(), XMLHttpRequest, WebSocket, EventSource, navigator.sendBeacon(), and external <script>/<img> tags are all blocked by Chrome, Firefox, and Safari before a single packet leaves the NIC.
  2. Zero external CDNs or runtime imports — every pure-JS crypto, PDF, Canvas, QR, and ASN.1 parser is bundled inline and pinned to its exact SHA-256 hash at build time.
  3. Zero accounts, zero cookies, zero telemetry — open a tool, turn off Wi-Fi or switch on Airplane Mode, and every single feature keeps working identically.

All 11 Offline Tools

  1. ID & PDF Watermark (/tools/id-watermark/) — Stamp diagonal purpose watermarks onto passport/ID scans and multi-page PDFs right in Canvas/PDF without uploading identity documents.
  2. Screenshot Redactor (/tools/redact/) — Pixelate/black-out API keys, emails, and PII before posting bug reports or social demos (strips EXIF metadata on export).
  3. .env Secret Scanner & Sanitizer (/tools/env-scan/) — Detects leaked tokens, AWS/Stripe/GitHub keys, and produces a safe redacted .env.example locally.
  4. JWT Debugger & Verifier (/tools/jwt/) — Decode headers/claims and verify HMAC/RSA/ECDSA signatures using native Web Crypto (crypto.subtle).
  5. SSH Key Generator (/tools/ssh-key/) — Generate Ed25519 / RSA keypairs in OpenSSH format strictly inside your browser tab.
  6. TLS Certificate & CSR Inspector (/tools/cert-inspector/) — Parse PEM/DER X.509 certificates, SANs, validity windows, and fingerprints locally.
  7. Offline QR Code Generator (/tools/qr/) — Create Wi-Fi, URL, and otpauth:// QR codes as SVG/PNG without leaking payloads to third-party QR APIs.
  8. 2FA / Google Authenticator Migration Decoder (/tools/otpauth-migrate/) — Decode otpauth-migration:// protobuf exports locally when migrating authenticators.
  9. WebAuthn PRF & Passkey Tester (/tools/webauthn-prf/) — Inspect authenticator capabilities and test deterministic PRF key derivation on your hardware key or platform passkey.
  10. Unbiased Password & Passphrase Generator (/tools/password/) — Rejection-sampled crypto.getRandomValues() generator with zero modulo bias.
  11. Hash & HMAC Calculator (/tools/hash/) — Streaming SHA-256/SHA-512/HMAC verification for local files and strings.

Verify It Yourself in 5 Seconds

  1. Open any tool at https://keyrook.com/tools/.
  2. Open DevTools → Network tab (or turn on Airplane Mode).
  3. Drop in a test PDF, .env file, or JWT and run the tool — 0 outgoing requests.

All 11 tools are completely free with no sign-up required. What other sensitive developer/privacy utilities do you wish had a strict default-src 'none' offline version?

📰 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.