redactString (sre/redact-logs.mjs)

mongral5976-hue/Omniroute · scripts/sre/redact-logs.mjs · javascript · MIT
ai

!/usr/bin/env node * PII redaction for log shipping. Streams input (stdin or files) to stdout, replacing sensitive tokens with stable redaction markers. Pure Node.js stdlib — no `npm install`. Recognised patterns (in order, longest match wins per position):

#!/usr/bin/env node
// Source: https://github.com/mongral5976-hue/Omniroute | License: MIT | Copyright 2026 diegosouzapw
// Provided via justclaw.it.com; keep this notice with the code.
/**
 * PII redaction for log shipping.
 *
 * Streams input (stdin or files) to stdout, replacing sensitive tokens
 * with stable redaction markers. Pure Node.js stdlib — no `npm install`.
 *
 * Recognised patterns (in order, longest match wins per position):
 *
 *   1. Anthropic API keys (sk-ant-...)     → [REDACTED_API_KEY]
 *   2. Google API keys (AIza...)           → [REDACTED_API_KEY]
 *   3. GitHub tokens (ghp_/gho_/ghu_/...)  → [REDACTED_API_KEY]
 *   4. OpenAI keys (sk-..., sk-proj-...)   → [REDACTED_API_KEY]
 *   5. AWS access keys (AKIA/ASIA)         → [REDACTED_AWS_KEY]
 *   6. Bearer tokens      

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key