Data privacy rules
Finds personal data that is logged, stored, sent or kept in ways that break privacy rules such as GDPR, HIPAA and PCI DSS.
- Agent id:
data_privacy - Rules: 15 (source:
data_privacy.yaml) - Deterministic checks:
pii_patterns
PRIV-001: Personal data written to logs
- Severity: high
- Languages: all
- References: CWE-532, CWE-359, OWASP A09:2021, OWASP A09:2025, GDPR Art. 32
Look for log, print or telemetry calls that include emails, phone numbers, names with addresses, government ids, card numbers, health data, passwords, tokens, whole user objects or whole request bodies. Raise it to critical for passwords, session tokens, API keys, card data or government ids. Logging an opaque user id or a masked value (j***@example.com) is not a violation.
PRIV-002: Real personal data in source or fixtures
- Severity: high
- Languages: all
- References: CWE-359, GDPR Art. 32
Look for literal emails, phone numbers, social insurance or social security numbers, card numbers or addresses that look like real people's data in code, seed files or test fixtures. Obviously fake values (example.com domains, 555 numbers, Luhn test card numbers such as 4111 1111 1111 1111) and the check's matches on version strings or dates are not violations.
PRIV-003: Sensitive data stored in cleartext
- Severity: high
- Languages: all
- References: CWE-312, GDPR Art. 32, OWASP A04:2021
Look for database columns, files or caches that store government ids, health records, bank details, or authentication secrets without encryption at rest or hashing. Encryption provided by the storage layer and stated in the configuration (encrypted volumes, column encryption) counts as encrypted.
PRIV-004: Card data stored or logged
- Severity: critical
- Languages: all
- References: PCI DSS Req. 3, CWE-312
Look for CVV or CVC codes, magnetic-stripe data or PINs stored anywhere, and full card numbers (PAN) stored or logged unencrypted or unmasked. Card fields posted to the application's own server put it in PCI scope: report that as medium. Storing the processor's token, the last four digits or the card brand is not a violation.
PRIV-005: Tokens or personal data in browser storage
- Severity: medium
- Languages: javascript, typescript
- References: CWE-922
Look for authentication tokens, passwords, or personal data written to localStorage, sessionStorage or IndexedDB. Non-sensitive UI preferences in browser storage are not violations.
PRIV-006: Personal data sent over plain HTTP
- Severity: high
- Languages: all
- References: CWE-319, GDPR Art. 32, PCI DSS Req. 4
Look for http:// URLs, disabled TLS or unencrypted protocols (FTP, SMTP without STARTTLS) used to send personal or authentication data to another service. Requests to localhost or to an internal sidecar over a loopback interface are not violations.
PRIV-007: Tracking without consent
- Severity: medium
- Languages: javascript, typescript
- References: GDPR Art. 6, GDPR Art. 7, ePrivacy Directive Art. 5(3)
Look for analytics, advertising or session-replay calls (gtag, analytics.track, mixpanel.track, Facebook pixel, Hotjar) and non-essential cookies that fire before a consent check. Strictly necessary cookies (session, CSRF, load balancing) and tracking that runs only after the consent manager reports opt-in are not violations.
PRIV-008: No retention limit for personal data
- Severity: medium
- Languages: all
- References: GDPR Art. 5(1)(e)
Look for tables, buckets, logs or backups holding personal data with no deletion job, TTL or retention setting, and for retention or cleanup flags set to false or null. Only report what the repository shows; a retention policy may live in infrastructure outside the repository, so phrase the finding as a question when the setting is not visible.
PRIV-009: Deletion that leaves personal data behind
- Severity: medium
- Languages: all
- References: GDPR Art. 17
Look for account deletion or erasure flows that only set a flag, delete the main row but leave personal data in related tables, files, search indexes, caches or third-party services. Soft deletion followed by a scheduled hard delete or anonymization is not a violation.
PRIV-010: Collecting more personal data than needed
- Severity: low
- Languages: all
- References: GDPR Art. 5(1)(c), GDPR Art. 25
Look for forms, API payloads, analytics events or database models that collect personal fields the visible code never reads (birth date, full address, phone) or keep precise values where a coarse one would do (full IP address, exact location). Fields a legal or business process clearly needs are not violations.
PRIV-011: Personal data sent to a third party
- Severity: medium
- Languages: all
- References: CWE-359, GDPR Art. 28
Look for calls that send emails, names, user ids, IP addresses or free text written by users to external services (analytics, error tracking, AI or LLM APIs, CRMs). Name the service and the fields sent. Data sent only to the application's own infrastructure is not a violation.
PRIV-012: Special category or health data without extra protection
- Severity: high
- Languages: all
- References: GDPR Art. 9, HIPAA 45 CFR 164.312
Look for fields holding health, biometric, genetic, religious, sexual orientation or political data that are stored, logged or sent with the same handling as ordinary fields, without encryption, restricted access or an explicit consent record. Report only fields whose name or use clearly shows such data.
PRIV-013: Personal data exposed in URLs
- Severity: medium
- Languages: all
- References: CWE-598
Look for emails, tokens, reset codes, government ids or session ids placed in URL paths or query strings, where they end up in server logs, browser history and Referer headers. Opaque, single-use, short-lived tokens in email confirmation links are low.
PRIV-014: Personal data in error tracking or crash reports
- Severity: medium
- Languages: all
- References: CWE-201, GDPR Art. 28
Look for error tracking setup (Sentry, Bugsnag, Rollbar, Datadog) with options that send default PII, request bodies, cookies or local variables, without a scrubbing hook such as before_send. A configuration that turns these off or scrubs known fields is not a violation.
PRIV-015: Missing export path for a user's own data
- Severity: info
- Languages: all
- References: GDPR Art. 20
When the application stores accounts for people in the EU, look for an export or download feature that returns a user's personal data in a machine-readable format. Report a missing one once for the whole application, not per model, and only if the code shows user accounts.