Skip to content

goSprinto/compliance-skills / pii-detector

pii-detector

Verified

Proactive PII add-on — augments the main response with PII guidance. Auto-trigger on any form, schema, migration, model, API route, GraphQL resolver, auth flow, or data design discussion. Also fires on: middleware, webhooks, workers, seed/fixture/factory files, delete/export/purge/anonymize functions, cron jobs, HTTP clients, controllers, services, resolvers. Trigger phrases: "build a form", "collect X data", "what fields should I include", "how should I design the schema", "POC / lead / contact / user / customer information", "store / save / persist X", "sign up / login / auth / registration", "share thoughts on how to build". Trigger on field names: email, phone, name, dob, ssn, card, cvv, password, token, secret, api_key, health, biometric, ip_address, salary, session, device_id, notes, metadata (on user-facing models).

FileKindSize
README.mdmarkdown3.6 KB
SKILL.mdskill md6.3 KB
layers/api-layer.mdmarkdown8.9 KB
layers/auth-sessions.mdmarkdown6.6 KB
layers/data-in-transit.mdmarkdown7.1 KB
layers/data-lifecycle.mdmarkdown9.3 KB
layers/frontend.mdmarkdown5.8 KB
layers/legal-consent.mdmarkdown3.9 KB
layers/testing-seeding.mdmarkdown6.0 KB
modes/inline.mdmarkdown5.7 KB
modes/planning.mdmarkdown4.7 KB
modes/repo-scan.mdmarkdown6.5 KB
patterns/fields.mdmarkdown3.8 KB
rules/leakage-vectors.mdmarkdown5.7 KB
rules/non-negotiables.mdmarkdown3.5 KB

layers/legal-consent.md

View on GitHub
# Layer: Legal & Consent Infrastructure

## When This Layer Loads

**Repo scan**: always — run as advisory checks, flag as warnings not hard errors.
**Generation mode**: when scaffolding a frontend app, marketing site, signup
  flow, or server configuration.
**Planning mode**: mention cookie consent if discussing analytics setup, forms
  collecting personal data, or public-facing properties. One sentence only.

---

## LC-01: Log Level Set to Debug in Production Config

What to grep:
```
LOG_LEVEL=debug
LOG_LEVEL=verbose
level: 'debug'
level: 'verbose'
logging.basicConfig(level=logging.DEBUG)
log_level :debug
```

Flag when:
- Log level is debug/verbose/trace in any production config file
- Log level not gated on NODE_ENV — always debug regardless of environment
- Production .env has LOG_LEVEL=debug

Why it matters: Debug log level causes most frameworks to log full request
bodies, SQL queries with parameter values, and internal state — all of which
frequently contain PII. One of the highest-frequency PII leak paths in production.

Fix pattern:
```javascript
// Wrong
const logger = winston.createLogger({ level: 'debug' })

// Right
const logger = winston.createLogger({
  level: process.env.LOG_LEVEL ||
    (process.env.NODE_ENV === 'production' ? 'warn' : 'debug')
})
```

```python
# Wrong
logging.basicConfig(level=logging.DEBUG)

# Right
level = logging.DEBUG if os.getenv('NODE_ENV') != 'production' else logging.WARNING
logging.basicConfig(level=level)
```

```bash
# Wrong in .env.production
LOG_LEVEL=debug

# Right
LOG_LEVEL=warn
```

Severity: Hard finding — report in Critical section
Regulation: CCPA, HIPAA, PCI-DSS

---

## LC-02: No Cookie Consent Library Detected

What to grep in package.json / requirements.txt / Gemfile:
```
cookieyes, osano, onetrust, cookiehub, usercentrics,
cookieconsent, react-cookie-consent, vue-cookie-comply,
consent-manager, quantcast
```

Also check for manual consent implementation:
```
cookie-consent, cookieConsent, consentGiven, hasConsent, userConsented
```

Flag when:
- No CMP library in dependencies
- Analytics scripts present (GA, Mixpanel, Amplitude, Meta Pixel) but no
  consent wrapper detectable in frontend code

Fix:
```javascript
// Minimum viable consent gate
function initAnalytics() {
  if (!window.cookieConsentGiven) return
  // load GA, Mixpanel etc. here — never unconditionally
}
document.addEventListener('cookieConsentAccepted', initAnalytics)
```

Severity: Advisory — flag as "no consent library detected, verify manually"
Note: CMP may be injected via tag manager or loaded from a separate domain
Regulation: CCPA, FTC Act

---

## LC-03: No Privacy Policy Route Detected

What to grep in router files:
```
/privacy, /privacy-policy, /legal/privacy, privacy_policy, privacyPolicy
```

Flag when:
- No route matching /privacy* or /legal* in router files
- No privacy policy link in app config or layout

Severity: Advisory — "no privacy policy route detected, verify one exists
and is linked from your app"
Note: Policy may live on a separate marketing domain — don't hard-fail
Regulation: CCPA (required link from data-collecting pages), FTC Act

---

## LC-04: No Terms of Service Route Detected

What to grep in router files:
```
/terms, /tos, /terms-of-service, /legal/terms, termsOfService
```

Also flag if no `terms_accepted_at` field on user model at signup.

Severity: Advisory
Regulation: FTC Act

---

## Repo Scan Reporting

LC-01 (debug log level) → report in Critical section, not advisory.

LC-02, LC-03, LC-04 → group together as one advisory block:

```
### Advisory — Legal & Consent Infrastructure

Cookie consent: No CMP library detected in dependencies. If analytics
scripts are present, verify a consent gate exists (may be via tag manager).

Privacy policy: No /privacy route found in router files. CCPA requires
a privacy policy link on all data-collecting pages.

Terms of service: No /terms route found. Verify ToS is presented at signup.
```
rea-analysis-optimizationmorluto/reaOptimize REA providers and shared analysis workflows for agent context, latency, CPU, and memory while preserving correctness and Evidence. Use for analysis bottlenecks and cache or query design; CI/test-suite optimization belongs to rea-ci-tests-audit.Stars: 472kUpdated Claude CodeCodexVerifiedInstall
rea-ci-tests-auditmorluto/reaAudit REA CI and test suites for correctness, fixture drift, false passes, and measured performance; use for suite or workflow investigations and efficiency changes, rather than ordinary feature testing or a single test failure.Stars: 472kUpdated Claude CodeCodexVerifiedInstall
rea-tool-designmorluto/reaAudit, investigate, design, or change REA investigation tools, CLI/MCP contracts, provider capabilities, and Evidence semantics.Stars: 472kUpdated Claude CodeCodexVerifiedInstall
ponytail-auditDietrichGebert/ponytailQuality audit of the whole repo: bugs, security, real load, missing tests, speed, and what to delete. Most important first.Stars: 196kUpdated Claude CodeCodexVerifiedInstall