惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

宝玉的分享
宝玉的分享
Engineering at Meta
Engineering at Meta
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
博客园 - 聂微东
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Last Week in AI
Last Week in AI
酷 壳 – CoolShell
酷 壳 – CoolShell
博客园 - 三生石上(FineUI控件)
T
Tailwind CSS Blog
Apple Machine Learning Research
Apple Machine Learning Research
Hugging Face - Blog
Hugging Face - Blog
爱范儿
爱范儿
博客园 - 司徒正美
人人都是产品经理
人人都是产品经理
Jina AI
Jina AI
博客园 - 叶小钗
雷峰网
雷峰网
罗磊的独立博客
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
博客园 - Franky
WordPress大学
WordPress大学
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
阮一峰的网络日志
阮一峰的网络日志
量子位

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant
Why Your Diff Tool Shouldn't See Your Code
Shivam · 2026-04-27 · via DEV Community

Shivam

Here's something most developers don't think about: every time you paste code into an online diff tool, that content hits a server somewhere.

Config files. API keys. Internal service names. Database connection strings. Infrastructure YAML. It all gets sent to a third party, logged, and potentially retained — and you agreed to it somewhere in a terms of service you didn't read.

For most diffs that's fine. For the ones that matter, it's not.


The Problem With Server-Side Diff Tools

The popular online diff tools work like this:

  1. You paste your content
  2. It's sent to their server
  3. The server computes the diff
  4. The result is returned to your browser

That round-trip to a server is unnecessary. Your browser is perfectly capable of computing a diff locally — the same Myers diff algorithm that Git uses runs fine in JavaScript. But server-side processing is the default architecture, so that's what most tools use.

The risk is real: developers routinely paste things like:

  • Terraform state files containing AWS credentials
  • .env files with API keys and database URLs
  • Kubernetes secrets (yes, even base64-encoded ones)
  • Internal API responses with customer data
  • CI/CD configs with tokens and webhook secrets

A single careless paste into the wrong tool and that content is sitting on someone else's server.


How Client-Side Diffing Works

Online Diff runs the entire diff in your browser using JavaScript. There is no server involved in the comparison — the content never leaves your machine.

The architecture is simple:

Your browser
  ├── Left panel (your original text)
  ├── Right panel (your modified text)
  └── Diff engine (Myers algorithm, runs locally)
       └── Output rendered in your browser

Enter fullscreen mode Exit fullscreen mode

Nothing is transmitted. Nothing is stored. If you close the tab, it's gone.

This works for text, JSON, YAML, CSV, XML, and code — all computed locally, all syntax-highlighted in-browser.


PII Detection Before You Share

Client-side processing is table stakes. The more interesting problem is sharing.

Sometimes you want to send a diff to a teammate — a link they can click and see exactly what you're looking at. That's where things get complicated, because the sharing URL has to encode the content somehow.

Before generating a share link, Online Diff scans your content for six categories of sensitive data:

Type What it detects
API keys / tokens Strings of 32+ alphanumeric characters
Email addresses Standard email format
IP addresses IPv4 addresses
Credit card numbers 16-digit card patterns
Phone numbers US phone number formats
Social Security numbers SSN format (XXX-XX-XXXX)

If anything is found, you get three options before the link is generated:

1. Redact — Sensitive values are replaced inline:

API_KEY=sk-abc123...  →  API_KEY=[REDACTED_TOKEN]
user@company.com      →  [REDACTED_EMAIL]
192.168.1.100         →  [REDACTED_IP]

Enter fullscreen mode Exit fullscreen mode

The diff still shows the structural changes. You just can't see the actual values.

2. Encrypt — The entire content is encrypted with a password you choose before being encoded into the URL. The recipient needs the password to view it.

3. Share anyway — If you've reviewed the content and it's fine, skip the warning.


How the Encryption Actually Works

The encryption uses the browser's built-in Web Crypto API — no third-party crypto libraries, no server involvement.

When you choose to encrypt:

  1. A random 16-byte salt is generated
  2. Your password is run through PBKDF2 with 100,000 iterations and SHA-256 to derive a key
  3. The content is encrypted with AES-GCM 256-bit using a random 12-byte IV
  4. The result (salt + IV + ciphertext) is base64-encoded and embedded in the URL

The recipient opens the link, enters the password, and decryption happens entirely in their browser. The server never sees the password or the plaintext — it only ever serves the page HTML and JavaScript.

This means:

  • The share URL is safe to send over Slack, email, or a PR comment
  • Even if the URL is intercepted, the content is unreadable without the password
  • Online Diff itself cannot decrypt it — there's nothing server-side to compromise

When This Actually Matters

Code reviews with sensitive configs
Reviewing a PR that touches .env.example, Terraform variables, or Kubernetes manifests? Paste both versions, get the diff, share an encrypted link in the PR comment. Your reviewer sees exactly what changed without you having to sanitise the content manually.

Sharing API response diffs
Debugging a production API that returns customer data? Diff two responses locally, redact the PII, share the structural diff with your team.

Cross-team infrastructure reviews
Infrastructure changes often touch files with internal hostnames, IPs, and service names that shouldn't leave the company. A client-side diff with an encrypted share link keeps that data internal even when collaborating across tools.

Compliance-sensitive environments
If you're working in a HIPAA, SOC 2, or PCI-DSS environment, "we pasted patient data into a random website" is not a conversation you want to have. Client-side processing means there's nothing to explain.


The Takeaway

The next time you reach for an online diff tool, it's worth asking: does this need to go to a server?

For most diffs, it doesn't. The computation is trivial for a modern browser. The only reason to send it to a server is if the tool was built that way by default — not because it needs to be.

If you're working with anything sensitive, Online Diff keeps it in your browser. The PII scanner and encrypted sharing are there for the cases where you need to collaborate without exposing the content.


Try it at online-diff.com — compare text, JSON, YAML, CSV, XML and code entirely in your browser.