mcpField
P
pii-redaction-logging-policy-builder

pii-redaction-logging-policy-builder

github.com/patricio0312revSecurity63267 installsUpdated 41w ago
Repository

About pii-redaction-logging-policy-builder

A skill for building application logging policies that reduce exposure of personally identifiable information. It provides sample redaction patterns and guidance on what to log safely.

Key features

  1. 01PII pattern examples
  2. 02Log redaction guidance
  3. 03Logging policy template
  4. 04Safe logger checklist
  5. 05Team and monitoring checklist

Use cases

  1. 01Define redaction rules for logs
  2. 02Draft a privacy-conscious logging policy
  3. 03Review logger and monitoring practices

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/patricio0312rev/skills --skill pii-redaction-logging-policy-builder

After installing, type/pii-redaction-logging-policy-builderin Claude Code to confirm it loaded.

Details

From the project README

PII Redaction & Logging Policy Builder

Protect user privacy in application logs.

PII Redaction

const PII_PATTERNS = {
  email: /\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Z|a-z]{2,}\b/g,
  ssn: /\b\d{3}-\d{2}-\d{4}\b/g,
  phone: /\b\d{3}[-.]?\d{3}[-.]?\d{4}\b/g,
  creditCard: /\b\d{4}[\s-]?\d{4}[\s-]?\d{4}[\s-]?\d{4}\b/g,
};

function redactPII(message: string): string {
  let redacted = message;
  Object.entries(PII_PATTERNS).forEach(([type, pattern]) => {
    redacted = redacted.replace(pattern, `[REDACTED_${type.toUpperCase()}]`);
  });
  return redacted;
}

// Safe logging
logger.info(redactPII(\`User registered: \${email}\`));
// Output: "User registered: [REDACTED_EMAIL]"

Logging Policy

# Logging Policy

## ✅ DO Log

- Request IDs
- User IDs (hashed)
- HTTP status codes
- Response times
- Error types
- Feature flags

## ❌ DON'T Log

- Passwords
- Credit card numbers
- SSNs
- API keys
- Full emails (hash first)
- Full names
- Addresses

Output Checklist

  • Redaction rules defined
  • Logging policy documented
  • Safe logger wrapper
  • Team trained
  • Log monitoring ENDFILE

Comments

Markdown supported