mcpField
P
pii-redaction-logging-policy-builder

pii-redaction-logging-policy-builder

github.com/patricio0312revセキュリティ63267 回インストール41 週間前に更新
リポジトリ

pii-redaction-logging-policy-builder について

アプリケーションログで個人情報が露出するリスクを抑えるポリシー作成向けのスキルです。マスキングパターン例と安全な記録方法を示します。

主な機能

  1. 01PII パターン例
  2. 02ログのマスキング指針
  3. 03ログポリシーテンプレート
  4. 04安全なロガーのチェック項目
  5. 05チームと監視のチェック項目

活用シーン

  1. 01ログのマスキング規則を定義
  2. 02プライバシーを考慮したログポリシーの作成
  3. 03ロガーと監視の運用を確認

インストール

コマンドをコピーしてターミナルで実行します。

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

インストール後、Claude Code で/pii-redaction-logging-policy-builderを入力して読み込まれたか確認します。

詳細

PII のマスキングとログポリシーの作成

アプリケーションのログでユーザーのプライバシーを保護します。

PII のマスキング

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

## ✅ 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

出力チェックリスト

  • マスキングルールを定義済み
  • ログポリシーを文書化済み
  • 安全なロガーラッパー
  • チームへのトレーニングを実施済み
  • ログの監視 ENDFILE

コメント