Security Fix: Credential Leaks in Training Dataset Pipeline
Severity: High — Passwords and credentials were leaking into training datasets in three forms that bypassed existing sanitization patterns.
What Was Leaking
1. Vault lookup tool results (JSON)
{"credentials": "{\"password\": \"2022Martina1987!!\"}"}The password key inside escaped JSON strings was not matched by the existing password: value regex pattern.
2. Natural language in user messages
"password is 2022Martina1987!!"
The existing pattern only matched password: X and password = X, not password is X.
3. Escaped JSON in stringified tool results
\"password\": \"2022Martina1987!!\"
Double-escaped JSON from tool result serialization was not covered.
What Was Fixed
core/dataset_builder.py — Added 3 new SECRET_PATTERNS:
password is X/the password is X/my password is X(natural language)\"password\": \"value\"(JSON-escaped strings)"credentials": "{...password...}"(credential blob redaction)- Extended existing password pattern to match
isin addition to:and=
core/pii_guard.py — Added matching patterns system-wide:
- New
PASSWORDPII type with standalone password detection - New
CREDENTIALSPII type for vault credential blobs - JSON-escaped password pattern for stringified tool results
- These patterns now protect: tool results, knowledge indexing, memory storage, swarm context, and datasets
Verification
All three leaked examples from production are now properly redacted:
# Tool result → "credentials": "[REDACTED]"
# User message → "[REDACTED] and i want you to..."
# Escaped JSON → "[REDACTED]"
22 existing PII guard tests continue to pass.
Upgrade
git pull && uv syncNo config changes needed. The fix is automatic for all new dataset collections.
Note: Existing leaked data in your local SQLite database is NOT retroactively cleaned. If you've been collecting training data, consider purging your dataset_interactions table.
Full Changelog: v2026.03.04.1...v2026.03.04.2