What
Implement server-side PII detection and scrubbing on the Sentry envelope ingest pipeline.
Why
BMAD CLO finding (🔴 CRITICAL): Sentry SDKs routinely capture user emails (session auth), IP addresses, request headers, cookies, and stack traces with variable values (may contain passwords, tokens, PII).
Under UU PDP (Indonesia Law No. 27/2022), TrapFall as a data processor storing this is non-compliant. Fines: up to 2% of annual revenue.
Changes
- IP anonymization: Truncate or hash IPv4 (last octet), IPv6 (last 80 bits) on ingest
- PII pattern scrubbing: Regex-based detection for:
- Email addresses →
[REDACTED:email]
- Credit card numbers →
[REDACTED:cc]
- API keys / tokens (common patterns:
sk-, Bearer , ghp_, AKIA) → [REDACTED:token]
- Phone numbers (ID format) →
[REDACTED:phone]
- Configurable scrubbing rules: Allow users to add custom regex patterns via config
- Stack trace scrubbing: Detect sensitive variable names (
password, token, secret, api_key) and redact their values
- MCP redaction: Apply same scrubbing to MCP tool responses before returning to AI agents
- Add config flag
TRAPFALL_PII_SCRUBBING=true (default: true)
Testing
- Unit tests for each PII pattern type
- Integration test: send envelope with known PII → verify scrubbed in storage
- Integration test: verify MCP responses don't contain raw PII
- Test custom regex rules work correctly
What
Implement server-side PII detection and scrubbing on the Sentry envelope ingest pipeline.
Why
BMAD CLO finding (🔴 CRITICAL): Sentry SDKs routinely capture user emails (session auth), IP addresses, request headers, cookies, and stack traces with variable values (may contain passwords, tokens, PII).
Under UU PDP (Indonesia Law No. 27/2022), TrapFall as a data processor storing this is non-compliant. Fines: up to 2% of annual revenue.
Changes
[REDACTED:email][REDACTED:cc]sk-,Bearer,ghp_,AKIA) →[REDACTED:token][REDACTED:phone]password,token,secret,api_key) and redact their valuesTRAPFALL_PII_SCRUBBING=true(default: true)Testing