Automated Directory Auditing: Codebase Secrets & PII Pre-Flight Scanner
Audit Your Entire Codebase Offline

AI Summary / Key Takeaways
"Prevent catastrophic vector poisoning and supply chain leaks. The PrivacyScrubber MCP Server scans entire local repositories in <4 seconds, catching hardcoded API keys, JWTs, and customer test PII before autonomous AI coding agents or RAG pipelines ingest your codebase."
Enterprise-Grade AI Privacy
Add custom redaction rules and priority support with PRO.
Interactive PII Detection & Sanitization Sandbox
Test real-time client-side RAM tokenization. Choose a specialized preset or paste your own raw prompt to test instant reversible redaction.
The Challenge with AI Data Workflows
Developers routinely hardcode API keys or production database credentials during testing and accidentally commit them to GitHub. Existing secret scanners often send code telemetry back to cloud vendors, violating air-gapped security policies.
How It Works
Initialize MCP Server
Connect the PrivacyScrubber MCP Server to your IDE. It runs completely offline.
Trigger the Audit
Instruct your AI agent to run the 'audit_directory_for_pii' tool against your current working directory.
Review the Report
The tool generates a comprehensive list of flagged files, exact line numbers, and entity types (e.g., AWS Key, Email). You can then instruct the AI to call 'sanitize_file' on the flagged items.
What Teams Achieve with Local PII Masking
Swipe to read verified reviews
Supported Formats & Limitations
Supported Formats
System Limitations
- Excludes binary files (images, compiled objects) by default
- Scans are bounded by OS file-read constraints and local memory limits
- Heuristics optimized for code, so prose-heavy documentation may yield false positives for specific variables
Prevent Irreversible Vector Poisoning: Audit Repositories for Secrets in Under 4 Seconds
When engineering organizations deploy autonomous coding agents (Claude Code, Cursor Composer, Windsurf) or feed internal codebases into enterprise Retrieval-Augmented Generation (RAG) vector databases, they confront an irreversible privacy vulnerability. Repositories frequently contain forgotten test fixtures, historical SQL seed scripts with real customer PII, uncommitted .env staging files, and hardcoded API keys.
Once an autonomous agent or RAG vectorizer (Pinecone, Chroma, pgvector) indexes these files, personal data becomes embedded into high-dimensional vector weights. Under GDPR Article 17 (Right to be Forgotten), extracting an individual's data from dense vector indexes is mathematically impossible without wiping and re-indexing the entire database at massive expense. The PrivacyScrubber Automated Directory Audit acts as an instant pre-flight firewall, scanning 10,000+ source files locally in under 4 seconds to sanitize code and data before ingestion occurs.
Enterprise Velocity: Scan 10,000+ Files Locally in <4 Seconds with 0 Network Egress
Engineered for zero-overhead local execution, the directory audit tool processes enterprise monorepos in seconds using non-blocking asynchronous file system streams:
Reads files via Node.js fs.promises pipelines with chunked buffers, scanning 10,000+ files in under 4 seconds without disk locks or memory spikes.
Automatically excludes .git/, node_modules/, dist/, build/, binary executables, and images to focus exclusively on sensitive source code.
All 25+ regulatory profiles and secret heuristics are evaluated against linear-time state machines, eliminating catastrophic backtracking on 50MB minified bundles.
Immediate Actionable Reports: Pinpoint Violations with Exact Line Numbers & Compliance Citations
Whether invoked directly via the CLI or triggered autonomously by an AI agent through the audit_directory_for_pii MCP tool, PrivacyScrubber generates an actionable structured report pinpointing exact file paths, line numbers, and compliance framework violations:
$ npx @privacyscrubber/mcp-server audit ./services --profile=DevOps --verbose
[PRIVACYSCRUBBER] Initializing Zero-Trust Directory Audit Engine...
[STATUS] Target: /workspace/services (Recursive) | Active Profile: DevOps & Cloud Secrets
[STATUS] Scanning 1,482 source files across 84 subdirectories...
========================================================================================
AUDIT FINDINGS SUMMARY: 4 SENSITIVE VIOLATIONS DETECTED ACROSS 2 FILES
========================================================================================
[!] FILE: services/auth/src/config/database.ts:18
FOUND: postgresql://dbadmin:Sup3rS3cr3tP4ss!@prod-cluster.internal:5432/app_prod
ENTITY: [DB_URI_1] (Database Connection String with Credentials)
SEVERITY: CRITICAL | COMPLIANCE: SOC 2 Type II CC6.6, ISO 27001 A.8.24
[!] FILE: services/billing/fixtures/stripe_mock.json:42
FOUND: sk_live_51OzSecretKeyProductionLiveStripeKey991
ENTITY: [TOKEN_1] (Stripe Live Secret Key)
SEVERITY: CRITICAL | COMPLIANCE: PCI DSS v4.0 Requirement 3.4
[!] FILE: services/billing/fixtures/stripe_mock.json:88
FOUND: Marcus Sterling <m.sterling@fintechventures.co.uk>
ENTITY: [NAME_1], [EMAIL_1] (Real Customer PII in Mock Data)
SEVERITY: HIGH | COMPLIANCE: GDPR Article 4(1), CCPA § 1798.140
----------------------------------------------------------------------------------------
EXECUTION BENCHMARK: 1,482 files audited in 1.14s | Network Egress: 0 Bytes (Air-Gapped)
REMEDIATION ACTION: Agent can invoke `sanitize_file` to tokenize flagged files in RAM
======================================================================================== Automated Prevention: Block Unmasked Secrets at Git Pre-Commit in 1 Step
Prevent accidental commits of credentials and customer test dumps by embedding PrivacyScrubber's zero-dependency scanner directly into your Git lifecycle. Add this snippet to .husky/pre-commit or .git/hooks/pre-push:
#!/bin/sh
# PrivacyScrubber Pre-Commit Guard: Verify no unmasked credentials in staged files
echo "[PrivacyScrubber] Auditing staged files for PII and cloud secrets..."
# Run local audit against staged git changes
STAGED_FILES=$(git diff --cached --name-only --diff-filter=ACM | grep -E '\.(ts|js|py|json|env|sql)$')
if [ -n "$STAGED_FILES" ]; then
npx -y @privacyscrubber/mcp-server audit $STAGED_FILES --fail-on-secrets
if [ $? -ne 0 ]; then
echo "[BLOCK] PrivacyScrubber detected raw secrets in staged files!"
echo "Run 'npx @privacyscrubber/mcp-server sanitize [file]' or use .env variables."
exit 1
fi
fi
exit 0 Security & Compliance Comparison: Air-Gapped Directory Audit vs. Cloud SaaS Scanners
How PrivacyScrubber's AI-native, client-side directory audit compares against legacy cloud-based secret scanners:
| Scanning Capability | Cloud Scanners (GitGuardian SaaS) | Static CLI Tools (TruffleHog) | PrivacyScrubber Directory Audit |
|---|---|---|---|
| Execution Privacy | Uploads code snippets to vendor cloud | Local CLI execution | 100% Air-gapped (0 network calls) |
| Customer PII Detection | Zero (Secrets/API keys only) | Zero (High-entropy strings only) | 25+ Profiles (Names, SSN, PHI, IBAN) |
| Autonomous AI Integration | Webhook alerts (No agent loop) | CLI shell only (Manual review) | Native MCP tool (Cursor, Claude Code) |
| Autonomous Remediation | None (Requires manual Git edit) | None (Alert only) | 1-Click sanitize_file token swap |
| Vector Ingestion Defense | Not designed for RAG pipelines | Not designed for RAG pipelines | Prevents irreversible vector poisoning |
Closed-Loop Remediation: Find, Sanitize, and Unblock Autonomous AI Agents in 4 Steps
When integrated with autonomous agent workflows like Cursor Composer or Claude Desktop, the directory audit creates a closed-loop security workflow:
- Pre-Flight Audit: The AI agent triggers
audit_directory_for_piibefore analyzing the repository to fulfill a complex refactoring task. - Report Parsing: The agent receives structured JSON metadata with exact line numbers and entity types without leaking plaintext values to the conversation history.
- Automated Redaction: The agent invokes
sanitize_fileon flagged test fixtures or replaces hardcoded database URIs withprocess.envreferences. - Clean Ingestion: The agent proceeds with code generation and testing against a completely sanitized, compliant context window.
Learn more about integrating local sanitization into your editor with the IDE Prompt Security Gateway (MCP) guide, or inspect our enterprise Developer SDK for programmatic backend integration.
Client-Side Reliability & Audit Verification
Powered by the Zero-Trust Sanitization Engine (ZTDS). All detection, tokenization, and regex evaluation execute 100% inside your local client process boundary — eliminating cloud proxies, intermediate servers, and third-party data retention risks.
Step-by-Step Guide
How to use this feature
Ask the AI Agent
Prompt your AI: 'Run a security audit on this directory using the PrivacyScrubber MCP server.'
Agent Executes Tool
The agent autonomously calls audit_directory_for_pii, parsing your entire file tree locally.
Agent Plans Fixes
Based on the audit report, the agent can autonomously propose code changes or call sanitize_file to redact the hardcoded secrets.
Commit Securely
Your codebase is now clean of PII and secrets, preventing leakage into the AI's training data stream.
Frequently Asked Questions
Technical Details & Privacy Architecture
How fast is the directory audit?
Does it upload my code anywhere?
Which IDEs and agentic tools support the directory audit MCP tool?
Does the directory audit respect .gitignore and .env conventions?
Can the MCP server automatically fix flagged secrets and PII?
What file types are supported during directory auditing?
Audit Monorepos & Secrets Before AI Ingestion
No server uploads. No account required. 100% offline in your browser's local RAM.
