goSprinto/compliance-skills / pii-detector
pii-detector
VerifiedProactive 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).
| File | Kind | Size |
|---|---|---|
| README.md | markdown | 3.6 KB |
| SKILL.md | skill md | 6.3 KB |
| layers/api-layer.md | markdown | 8.9 KB |
| layers/auth-sessions.md | markdown | 6.6 KB |
| layers/data-in-transit.md | markdown | 7.1 KB |
| layers/data-lifecycle.md | markdown | 9.3 KB |
| layers/frontend.md | markdown | 5.8 KB |
| layers/legal-consent.md | markdown | 3.9 KB |
| layers/testing-seeding.md | markdown | 6.0 KB |
| modes/inline.md | markdown | 5.7 KB |
| modes/planning.md | markdown | 4.7 KB |
| modes/repo-scan.md | markdown | 6.5 KB |
| patterns/fields.md | markdown | 3.8 KB |
| rules/leakage-vectors.md | markdown | 5.7 KB |
| rules/non-negotiables.md | markdown | 3.5 KB |
layers/frontend.md
View on GitHub# Layer: Frontend / Client-Side Privacy
## When This Layer Loads
Auto-trigger inline when Claude is about to generate:
- A React / Vue / Svelte / Angular component, page, or form
- Any `localStorage`, `sessionStorage`, or `document.cookie` code
- Any third-party script or analytics SDK initialization (GA, Mixpanel, Sentry, Hotjar, LogRocket)
- Client-side routing that puts user data in path or query params
- Cookie-setting code (client or server-side `Set-Cookie`)
Also loads during full repo scan.
---
## F-01: PII in localStorage / sessionStorage
What to grep:
```
localStorage.setItem(
sessionStorage.setItem(
localStorage.setItem('user'
window.localStorage
```
Flag when:
- Full user objects stored: `localStorage.setItem('user', JSON.stringify(user))`
- PII fields stored directly: email, name, phone, dob, token, ssn
- Auth tokens stored in localStorage (XSS-accessible)
Why it matters: localStorage is readable by any JavaScript on the page —
including third-party scripts, browser extensions, and XSS payloads.
Fix pattern:
```javascript
// Wrong
localStorage.setItem('user', JSON.stringify({ email, name, phone, token }))
// Right — store only non-sensitive session state
localStorage.setItem('ui_preferences', JSON.stringify({ theme, language }))
// Auth tokens → HttpOnly cookies (set server-side, not accessible to JS)
```
Regulation: CCPA (PII exposure), FTC Act
---
## F-02: Cookie Flags Missing
What to grep:
```
res.cookie(
document.cookie
Set-Cookie:
cookies.set(
cookie.serialize(
```
Flag when:
- `HttpOnly` flag missing on auth/session cookies
- `Secure` flag missing (cookie sent over HTTP)
- `SameSite` not set (CSRF risk + cross-site tracking)
- PII stored directly in cookie value
Fix pattern:
```javascript
// Wrong
res.cookie('session', token)
res.cookie('user_data', JSON.stringify({ email, name }))
// Right
res.cookie('session', token, {
httpOnly: true, // not accessible to JavaScript
secure: true, // HTTPS only
sameSite: 'strict', // no cross-site sending
maxAge: 3600000 // 1 hour — always set expiry
})
// Never store PII in cookie value — store only opaque session ID
```
Regulation: CCPA, FTC Act, PCI-DSS (session management)
---
## F-03: Third-Party Scripts Loading Without Consent Gate
What to grep:
```
<script src="https://www.googletagmanager.com
<script src="https://connect.facebook.net
<script src="https://static.hotjar.com
<script src="https://cdn.segment.com
gtag( fbq( _hsq.push(
mixpanel.init( amplitude.init( analytics.load(
```
Flag when:
- Analytics/tracking scripts load unconditionally on page load
- No consent check before initializing tracking
- Pixel fires on page load without checking consent state
Why it matters: Loading tracking scripts before consent is a CCPA/GDPR violation.
The script starts collecting IP, device data, and behavior immediately on load.
Fix pattern:
```javascript
// Wrong — fires immediately
<script src="https://www.googletagmanager.com/gtm.js"></script>
// Right — load only after consent
function initAnalytics() {
if (!userHasConsented()) return
const script = document.createElement('script')
script.src = 'https://www.googletagmanager.com/gtm.js'
document.head.appendChild(script)
}
```
Regulation: CCPA, FTC Act
---
## F-04: PII in console.log (Frontend)
What to grep:
```
console.log(user
console.log(response.data
console.log(formData
console.error(user
console.debug(
```
Flag when:
- User objects logged: `console.log('User:', user)`
- Form data logged: `console.log(formData)` (may contain email, password, PII)
- API responses logged: `console.log(response.data)` (may contain PII)
Why it matters: Browser console logs are visible to anyone with DevTools open,
and some monitoring tools forward console output.
Fix pattern:
```javascript
// Wrong
console.log('Login response:', response.data) // may contain user PII
console.log('Form submitted:', formData) // may contain password
// Right
console.log('Login successful, userId:', response.data.id)
if (process.env.NODE_ENV === 'development') {
console.log('Form submitted') // no payload in any environment
}
```
Regulation: FTC Act, CCPA
---
## F-05: Session Replay / Error Tools Capturing PII
What to grep:
```
LogRocket.init(
Hotjar.init(
FullStory.init(
Sentry.init(
replay: (in Sentry config)
```
Flag when:
- LogRocket/Hotjar/FullStory initialized without input masking config
- Sentry Session Replay enabled without privacy config
- No `inputMask` or `blockClass` configuration to suppress PII fields
Fix pattern:
```javascript
// Wrong
LogRocket.init('app/id')
// Right
LogRocket.init('app/id', {
dom: {
inputSanitizer: true, // masks all input fields
textSanitizer: true, // masks text nodes
}
})
// Sentry with replay
Sentry.init({
replaysSessionSampleRate: 0.1,
integrations: [
new Sentry.Replay({
maskAllText: true, // mask all text
blockAllMedia: true, // block images
maskAllInputs: true, // mask all form inputs
})
]
})
```
Regulation: HIPAA (if health data visible), CCPA, FTC Act
---
## F-06: PII in URL Parameters
What to grep:
```
?email=
?phone=
?ssn=
?token=
router.push(`/users/${email}
window.location = `/verify?email=
<Link to={`/profile?name=
history.push(`?dob=
```
Flag when:
- PII passed as query parameters: `/reset?email=john@doe.com`
- PII in route path: `/users/john@doe.com/settings`
- Tokens in URLs: `/verify?token=abc123` (shows in browser history + server logs)
Fix pattern:
```javascript
// Wrong
router.push(`/reset-password?email=${email}&token=${token}`)
// Right — POST body or short-lived opaque reference
// Server generates a one-time code, URL contains only that
router.push(`/reset-password?code=${opaqueOneTimeCode}`)
// email resolved server-side from the code — never in URL
```
Regulation: CCPA, HIPAA (if health data), PCI-DSS
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| 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: 472k | Updated | Claude CodeCodex | Verified | Install |
| 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: 472k | Updated | Claude CodeCodex | Verified | Install |
| rea-tool-designmorluto/reaAudit, investigate, design, or change REA investigation tools, CLI/MCP contracts, provider capabilities, and Evidence semantics. | Stars: 472k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-auditDietrichGebert/ponytailQuality audit of the whole repo: bugs, security, real load, missing tests, speed, and what to delete. Most important first. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |