viper-logging-pii-compliance
Skill22 starsChanged 16 days agoMITView on GitHub
Security Logging, PII Redaction & Error Sanitization Auditor (OWASP Logging Cheat Sheet & ASVS V7). Reviews audit trail coverage, log injection defenses, and secret scrubbing.
In this repository72 other files it gives its agents.
- llms.txtllms.txt
- viper-agent-skill-supplychainSkill
- viper-ai-llm-guardrailsSkill
- viper-api-gateway-apigee-kongSkill
- viper-auth-oauth-jwtSkill
- viper-aws-iam-cloud-auditSkill
- viper-bola-idorSkill
- viper-browser-extension-mv3Skill
- viper-browseros-agentSkill
- viper-cicd-hardeningSkill
- viperclawSkill
- viper-container-k8s-auditSkill
- viper-crypto-tls-auditSkill
- viper-csrf-samesite-auditSkill
- viper-dependency-sbomSkill
- viper-deserialization-parserSkill
- viper-diff-pr-reviewSkill
- viper-dns-email-domainSkill
- viper-electron-tauri-desktopSkill
- viper-fastapi-django-flaskSkill
- viper-file-upload-storageSkill
- viper-gcp-azure-cloud-auditSkill
- viper-github-repo-governanceSkill
- viper-go-service-auditSkill
- viper-graphql-wsSkill
- viper-grpc-protobuf-auditSkill
- viper-headers-csp-corsSkill
- viper-iac-terraform-auditSkill
- viper-incident-forensics-triageSkill
- viper-injection-oracleSkill
- viper-java-spring-auditSkill
- viper-js-harvesterSkill
- viper-kafka-rabbitmq-queueSkill
- viper-linux-systemd-hostSkill
- viper-mcp-server-auditSkill
- viper-mobile-api-configSkill
- viper-multitenant-isolationSkill
- viper-nextjs-react-rscSkill
- viper-nginx-envoy-gatewaySkill
- viper-nodejs-express-nestjsSkill
- viper-oauth-oidc-complianceSkill
- viper-openapi-rest-schemaSkill
- viper-orchestratorSkill
- viper-payment-stripe-pciSkill
- viper-php-laravel-wordpressSkill
- viper-postgres-redis-mongoSkill
- viper-privacy-gdpr-hipaaSkill
- viper-proof-judgeSkill
- viper-proxy-fingerprintSkill
- viper-proxy-parser-alignmentSkill
- viper-race-logicSkill
- viper-rag-vector-auditSkill
- viper-rate-limit-dos-resilienceSkill
- viper-remediation-patch-verifierSkill
- viper-ruby-rails-auditSkill
- viper-rust-memory-unsafeSkill
- viper-saml-sso-enterpriseSkill
- viper-sbom-slsa-provenanceSkill
- viper-secrets-auditSkill
- viper-semgrep-rule-authorSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
4 rules. About 0 are common, 4 are distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈4
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 31
Run the following discovery commands across the target repository before manual code review:
- Distinctive: line 62
Verify whether an upstream API Gateway, global middleware, or ORM hook already enforces the control before flagging a controller.
- Distinctive: line 92
Write a Positive Unit Test confirming authorized, schema-valid requests succeed.
- Distinctive: line 93
Write a Negative Security Regression Test confirming unauthorized, cross-tenant, or malformed inputs are deterministically rejected.
≈ “Common” is an estimate: at least 1 in 5 of the 408,460 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
Security Logging, PII Redaction & Audit Trail Compliance Auditor (viper-logging-pii-compliance)
1. Executive Scope, Standards & CWE/OWASP Mapping
- Frameworks & Standards: OWASP Logging Cheat Sheet, OWASP Top 10:2025 A09 (Security Logging and Alerting Failures), OWASP ASVS V7, CWE-532, CWE-117
- Primary CWE Mapping: CWE-532 (Insertion of Sensitive Information into Log File), CWE-117 (Improper Output Neutralization for Logs / Log Injection), CWE-778 (Insufficient Logging)
- ViperClaw MCP Tools:
viper_taint_scan,viper_verify_and_report - ViperClaw CLI Command:
viperclaw taint ./src --db .viperclaw/graph.db
2. Threat Model & Root-Cause Architecture
flowchart LR
Event["Security / App Event"] --> Scrub["PII & Secret Redaction Filter"] --> JSON["Structured JSON Formatter (No CRLF)"] --> SIEM[("Immutable Audit Log Sink")]Root-Cause Analysis
Applications either log too much (dumping full req.headers or req.body containing plaintext passwords, Bearer JWTs, session cookies, and credit card numbers into Datadog/CloudWatch) or log too little (failing to record failed logins, privilege escalations, and cross-tenant 403 denials, or allowing
log injection).
3. Deterministic Discovery & Grep/AST Audit Commands
Run the following discovery commands across the target repository before manual code review:
# 1. Automated ViperClaw analysis
viperclaw taint ./src --db .viperclaw/graph.db
# 2. Rapid static pattern discovery (ripgrep)
rg -n "(logger\.(info|debug|error|warning)|console\.(log|error))\(.*(password|token|secret|authorization|cookie|ssn|card)" -i
rg -n "(print\(request\.|console\.log\(req\.(headers|body))"4. Senior Security Engineer 8-Point Audit Checklist
| Control ID | Audit Verification Target | Pass Criteria | Fail / Vulnerability Indicator |
LOG-01 | Automatic Credential & Token Redaction | Structured log processors scrub password, secret, token, authorization, cookie, api_key, cvv, and ssn keys at the root logger level. | logger.debug(f"Login body: {request.json}") writes plaintext passwords to log storage. |
LOG-02 | Log Injection & CRLF Neutralization (CWE-117) | Logs are emitted as single-line structured JSON (structlog / pino / zap) or strip \r, \n, and ANSI escape sequences (\x1b[) from user strings. | Plaintext log logger.info(f"User {username} logged in") allows forging fake log lines via username="guest\n2026-11-18 INFO Admin privilege granted". |
LOG-03 | Mandatory Security Event Coverage (CWE-778) | Auth failures, password/MFA resets, role changes, API key creations, and 403 Forbidden authorization failures emit structured audit events. | Administrative role elevation or repeated BOLA probes leave zero audit trail. |
LOG-04 | Correlation / Request ID Propagation | Every incoming HTTP request generates or validates a UUID X-Request-ID propagated across all downstream logs and error responses. | Impossible to trace a security incident across microservices. |
LOG-05 | Exception Handler Secret Scrubbing | Crash reporters (Sentry, Rollbar, Bugsnag) enable send_default_pii=False and scrub local stack variables containing secrets. | Unhandled exception dumps local environment variables and DB connection strings to external crash tracker. |
LOG-06 | HTTP Access Log Query-String Hygiene | Sensitive values are never placed in URL query strings, and access logs redact ?token= / ?code= parameters. | OAuth code or password-reset token logged in plaintext Nginx/ALB access logs. |
LOG-07 | Tamper-Evident Append-Only Audit Storage | Compliance audit trails (audit_logs table / S3 Object Lock) disallow UPDATE and DELETE by the application DB role. | Compromised application role can DELETE FROM audit_logs to erase evidence. |
LOG-08 | Log Level Hygiene in Production | Production environments run at INFO or WARN level, never DEBUG or TRACE. | LOG_LEVEL=DEBUG in production dumps full SQL query parameters and HTTP bodies. |
5. False-Positive Elimination & CVSS v3.1 Triage Rubric
False-Positive Gate
- Verify whether an upstream API Gateway, global middleware, or ORM hook already enforces the control before flagging a controller.
- Confirm the code path is reachable from an external entrypoint (not dead code, CLI-only admin script, or unit-test fixture).
| Severity Tier | Baseline CVSS v3.1 Vector | Qualifying Security Impact |
| HIGH (7.5) | CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N | Plaintext passwords, active session JWTs, or payment card data written to shared log management systems. |
| MEDIUM (5.3) | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:N | Unescaped CRLF / ANSI log injection allowing audit log forgery or terminal escape injection. |
| LOW (3.3) | CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:L/I:N/A:N | Missing security audit events on privilege changes or failed authentication attempts. |
6. Production Remediation Patterns (Vulnerable vs. Hardened Code)
# ❌ VULNERABLE: Logs raw headers/body (leaking Authorization & password) with newline injection risk
logger.info(f"Auth attempt for {request.form.get('username')} with headers {dict(request.headers)}")
# ✅ HARDENED: Structured JSON logging with automatic sensitive-key redaction & CRLF stripping
REDACTED_KEYS = {"authorization", "cookie", "password", "token", "secret", "api_key"}
def redact_dict(d: dict) -> dict:
return {k: ("[REDACTED]" if k.lower() in REDACTED_KEYS else v) for k, v in d.items()}
safe_user = str(request.form.get("username", "")).replace("\r", "").replace("\n", "")[:64]
logger.info("auth_attempt", extra={"username": safe_user, "headers": redact_dict(dict(request.headers))})7. Regression Testing & Continuous Verification
- Write a Positive Unit Test confirming authorized, schema-valid requests succeed.
- Write a Negative Security Regression Test confirming unauthorized, cross-tenant, or malformed inputs are deterministically rejected.
- Re-run
viperclaw taintandviperclaw verifyto confirm zero remaining unmitigated flows in.viperclaw/graph.db.
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.

