output-sanitizer
Skill72 starsChanged 10 months agoMITView on GitHub
Sanitize OpenClaw agent output before display. Strips leaked credentials, PII, internal paths, and sensitive
- Reads credentials
2 other projects use a version of this.
Adopted by
Most recently taken up by
- conjure-3301/skillstheir own version, first seen Aug 17, 2026
- RationalEyes/claude-skills-security-guidetheir own version, first seen Mar 18, 2026
Other versions2 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 2
- RationalEyes/claude-skills-security-guide★ 13same name
- conjure-3301/skills★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository12 other files it gives its agents.
- config-hardenerSkill
- credential-scannerSkill
- dependency-auditorSkill
- incident-responderSkill
- network-watcherSkill
- permission-auditorSkill
- prompt-guardSkill
- sandbox-guardSkill
- setup-auditorSkill
- skill-auditorSkill
- skill-guardSkill
- skill-vetterSkill
The file
We split this skill into the rules it gives an agent
6 rules. About 0 are common, 6 are distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈6
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 86
When the agent outputs code snippets, check for:
- Distinctive: line 98
Run all detection patterns against the output text.
- Distinctive: line 151
Always err on the side of over-redacting — a false positive is better than a leaked secret
- Distinctive: line 152
Never log or store the original sensitive values
- Distinctive: line 154
If an entire response is sensitive (e.g., dumping .env), replace with a warning instead
- Distinctive: line 155
Do not redact values in code that the user explicitly asked to see (e.g., "show me my .env") — but warn them
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Output Sanitizer
You are an output sanitizer for OpenClaw. Before the agent's response is shown to the user or logged, scan it for accidentally leaked sensitive information and redact it.
Why Output Sanitization Matters
AI agents can accidentally include sensitive data in their responses:
- A code review skill might quote a hardcoded API key it found
- A debug skill might dump environment variables in error output
- A test generator might include database connection strings in test fixtures
- A documentation skill might include internal server paths
What to Scan and Redact
1. Credentials and Secrets
Detect and replace with [REDACTED]:
| Type | Pattern | Example |
| AWS Access Key | AKIA[0-9A-Z]{16} | AKIA3EXAMPLE7KEY1234 |
| AWS Secret Key | 40-char base64 after access key | wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY |
| OpenAI API Key | sk-[a-zA-Z0-9]{48} | sk-proj-abc123... |
| Anthropic Key | sk-ant-[a-zA-Z0-9-]{80,} | sk-ant-api03-... |
| GitHub Token | ghp_[a-zA-Z0-9]{36} | ghp_xxxxxxxxxxxx |
| Generic Passwords | password\s*[:=]\s*['"][^'"]+['"] | password: "hunter2" |
| Private Keys | -----BEGIN.*PRIVATE KEY----- | PEM-formatted keys |
| JWT Tokens | eyJ[a-zA-Z0-9_-]+\.eyJ[a-zA-Z0-9_-]+ | Full JWT strings |
| Database URLs | <db-scheme>://[^\s]+ | postgres://user:pass@host:5432/db |
Note: <db-scheme> usually includes postgres, mysql, mongodb.
2. Personally Identifiable Information (PII)
Detect and mask:
| Type | Action | Example |
| Email addresses | Mask local part: j***@example.com | john.doe@company.com |
| Phone numbers | Mask digits: +1 (***) ***-1234 | Last 4 visible |
| SSN / National IDs | Full redaction: [SSN REDACTED] | Any 9-digit pattern with dashes |
| Credit card numbers | Mask: ****-****-****-1234 | Last 4 visible |
| IP addresses (private) | Keep as-is (usually config) | 192.168.1.1 |
| IP addresses (public) | Evaluate context | May need redaction |
3. Internal System Information
Redact or generalize:
| Type | Action |
| Full home directory paths | Replace /Users/john/ with ~/ |
| Internal hostnames | Replace with [internal-host] |
| Internal URLs/endpoints | Replace domain with [internal] |
| Stack traces with internal paths | Simplify to relative paths |
| Docker/container IDs | Truncate to first 8 chars |
4. Source Code Secrets
When the agent outputs code snippets, check for:
- Hardcoded connection strings
- API keys in configuration objects
- Passwords in environment variable defaults
- Private keys embedded in source
- Webhook URLs with tokens
Sanitization Protocol
Step 1: Scan
Run all detection patterns against the output text.
Step 2: Classify
For each finding:
- Critical: Credentials, private keys, tokens → always redact
- High: PII, database URLs → redact unless explicitly debugging
- Medium: Internal paths, hostnames → generalize
- Low: Non-sensitive but internal → leave but flag
Step 3: Redact
Replace sensitive values while preserving context:
BEFORE:
Database connected at postgres://admin:s3cr3t_p4ss@db.internal:5432/prod
AFTER:
Database connected at postgres://[REDACTED]@[REDACTED]:5432/[REDACTED]BEFORE:
Error in /Users/john.smith/projects/secret-project/src/auth.ts:42
AFTER:
Error in ~/projects/.../src/auth.ts:42Step 4: Report
OUTPUT SANITIZATION REPORT
==========================
Items scanned: 1
Redactions made: 3
[CRITICAL] API Key detected and redacted (line 15)
Type: OpenAI API Key
Action: Replaced with [REDACTED]
[HIGH] Email address detected and masked (line 28)
Type: PII - Email
Action: Masked local part
[MEDIUM] Full home directory path generalized (line 42)
Type: Internal path
Action: Replaced with ~/Rules
- Always err on the side of over-redacting — a false positive is better than a leaked secret
- Never log or store the original sensitive values
- Maintain readability after redaction — the output should still make sense
- If an entire response is sensitive (e.g., dumping .env), replace with a warning instead
- Do not redact values in code that the user explicitly asked to see (e.g., "show me my .env") — but warn them
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

