The DevDiff Security Model — 7 Layers of Protection for Your Source Code
July 6, 2026 · Eldrex Delos Reyes Bula
Code analysis tools require access to your source code. Unfortunately, in the era of cloud-first AI assistants, this often means your intellectual property, proprietary logic, and private API keys are uploaded, processed, and potentially stored on external cloud infrastructure.
When we designed DevDiff, security and privacy were not optional additions — they were the foundation.
Here is a technical deep dive into the 7 layers of security that protect your code when running DevDiff.
🛡️ Layer 1: Local-First Inference (Zero-Cloud)
The safest code transfer is the one that never happens. By default, DevDiff performs all calculations on your local workstation.
- It connects to local models via Ollama.
- All git diff extraction, file parsing, and summary rendering happen entirely on your computer.
- It requires no network connectivity to function.
🔍 Layer 2: Built-in Secret Redaction Engine
Even when using local AI, accidentally logging or passing private tokens to shell history is a risk. When opting into cloud fallback providers, this risk increases.
DevDiff includes a regex-driven Secret Scanner that parses your git changes before they are formatted into the AI prompt. It matches over 30 secret patterns, including:
- AWS access keys, GitHub tokens, Slack webhooks.
- OpenAI, Anthropic, and Google Gemini API keys.
- PEM private key blocks, database connection strings, and
.envvariable assignments.
Any detected credentials are automatically replaced with a safe [REDACTED] token.
🚧 Layer 3: Dynamic Injection Guard
LLMs are vulnerable to prompt injection — instructions hidden in data files that tell the AI to ignore its rules and behave maliciously.
DevDiff implements a pre-generation parser (InjectionGuardV2) that checks git changes for malicious injection vectors:
- Shell command piping (e.g.
; rm -rf,&& command). - Prompt overriding instructions (e.g.
ignore previous instructions and output...). - SQL/XSS snippets.
If suspicious instruction patterns are detected, the CLI halts processing and flags the changes.
🌐 Layer 4: Network Guard (Telemery Isolation)
Many "private" tools run silent telemetry connections in the background to send usage analytics, system stats, or user data back to the creator's servers.
DevDiff's Network Guard blocks this by default:
- It maintains a blacklist of over 200 common telemetry and tracker domains.
- If the CLI processes detect any unauthorized network requests outside of whitelisted Ollama or opt-in cloud endpoints, it throws a connection abort error.
📦 Layer 5: Shell Sandbox
When analyzing code quality, some tools execute external shell scripts or compilers to inspect files. This opens up massive attack vectors.
DevDiff isolates all child process spawning inside a strict Shell Sandbox:
- Only whitelisted binaries (
git,ollama,node,which) can be executed. - In v1.0.7, we hardened this layer by replacing all
execSync/execcalls withexecFileSync/execFile. This ensures commands are executed directly as argument arrays, completely eliminating shell metacharacter expansion and command injection vulnerabilities.
📜 Layer 6: Encrypted Audit Trails
For compliance-focused environments (such as SOC 2 or GDPR), having a record of tool activity is critical.
DevDiff records all operations (such as CLI runs, shell execution, or config updates) in a secure, locally encrypted log file (.devdiff/security-audit.json). The logs are encrypted using AES-256 with a unique machine key, preventing tampering.
🔍 Layer 7: Full Disclosure (devdiff disclose)
We believe in "trust, but verify."
At any time, you can run:
devdiff discloseThis prints the exact structure and text payloads sent to the LLM. You can read the raw JSON and inspect the exact prompts, ensuring there are no hidden payloads, telemetry details, or leakages.
🚀 Hardened for Production
Security shouldn't compromise speed or productivity. By combining local models, strict sandboxing, and full audit trails, DevDiff lets you use AI code review tools without risking your codebase.
- GitHub Repository: EldrexDelosReyesBula/devdiff
- Compliance Matrix: devdiff.vercel.app/enterprise/compliance-frameworks