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

rules/non-negotiables.md

View on GitHub
# Non-Negotiable Rules

These apply always, regardless of stack, language, or context.
No exceptions. No "but we'll fix it later."

---

## Passwords

- **Never** store plaintext — bcrypt (cost ≥ 12), argon2id, or scrypt only
- Field name must be `password_hash` or `hashed_password` — never `password`
- **Never** log passwords, even temporarily or "just for debugging"
- **Never** return password hash in any API response or serializer
- **Never** store plaintext alongside the hash (`password` + `password_hash` = both wrong)

Fix pattern:
```
# Wrong
password: String

# Right
password_hash: String  # bcrypt/argon2id — never store or return raw value
```

---

## CVV / Card Security Codes

- **Never** store — not encrypted, not hashed, not "just temporarily"
- PCI-DSS Requirement 3.2: absolute prohibition, no exceptions
- If a `cvv` field exists anywhere: remove it entirely

---

## Card Numbers (PAN)

- Don't store raw — tokenize via Stripe, Braintree, or Adyen
- If unavoidable: AES-256 encryption, display last 4 digits only
- **Never** log payment request or response bodies (Datadog, Sentry, CloudWatch)

---

## SSN / Government IDs

- AES-256 encryption at rest, stored as BYTEA or BLOB
- **Never** in logs, **never** in API responses
- Display mask always: `***-**-6789`
- Audit log on every read access, not just writes
- If only last 4 digits are needed — only store last 4

Fix pattern:
```
# Wrong
ssn: String  # VARCHAR(11)

# Right
ssn_encrypted: Bytes     # AES-256, never returned in API
ssn_last_four: String    # "6789" — safe to display
```

---

## Health / Medical Data (HIPAA)

- Encryption at rest AND in transit — no exceptions
- Audit log on every **read** (not just mutations)
- Minimum necessary — return only the fields the caller explicitly needs
- **Never** send to: Sentry, Datadog, Mixpanel, HubSpot, Intercom, or any
  tool without a signed Business Associate Agreement (BAA)

---

## Biometric Data (BIPA)

- Flag for written consent requirement — must exist before any storage
- Add `biometric_expires_at TIMESTAMP` — retention must be time-limited
- Use irreversible hash for comparison — never store raw biometric
- Applies across all US states, not just Illinois

---

## IP Addresses (CCPA)

- Treated as PII — don't log permanently without a defined purpose and TTL
- For analytics: mask last octet → `192.168.1.0`
- Don't index IP columns without a documented reason

---

## Generic String Fields on User Models

`notes TEXT`, `metadata JSONB`, `data TEXT`, `extra TEXT` on user-facing models
are potential unstructured PII containers. Always flag them.

Recommended response: document what goes in the field, add input validation,
encrypt if sensitive data is confirmed, add to deletion scope for CCPA erasure.

---

## Deletion (CCPA Right to Erasure)

Every model storing PII needs:
1. `deleted_at TIMESTAMP NULL` for soft delete
2. A hard-delete function that actually purges the row
3. Deletion to cascade to downstream vendors (analytics, CRM, email tools)

Soft-delete-only is not sufficient for CCPA compliance.

---

## Consent Tracking

Any model that stores PII collected directly from a user should have:
```
data_consent_at: Timestamp   # when user consented
consent_version: String      # which version of privacy policy they accepted
```

---

## Audit Trail

For SSN, health data, financial account data, and biometrics:
- Every read access must be logged (not just writes)
- Log: who accessed, what record, when, from what IP
- Either a DB trigger or application-level audit log — one of the two, always
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