PII, Secrets & Redaction
AI traces and prompts often contain more sensitive data than ordinary application logs because they include conversation text, retrieved documents and tool results.
const secretPatterns = [
/sk-[A-Za-z0-9_-]+/g,
/Bearer\s+[A-Za-z0-9._-]+/gi,
];
function redact(text: string) {
return secretPatterns.reduce((s, re) => s.replace(re, '[REDACTED]'), text);
}
Regex is only one layer. Structured logging, DLP classifiers, allowlisted fields and separate restricted payload storage are safer than trying to clean arbitrary serialized objects afterward.
Practice
- Why are AI traces especially sensitive?
- When is hashing preferable to dropping a value?
- Why can tool outputs expose secrets indirectly?
- What should be prohibited from ordinary telemetry by default?