Skip to content

Conversation

@damacus
Copy link
Owner

@damacus damacus commented Feb 9, 2026

Summary

Implements sensitive data scrubbing for OpenTelemetry traces to prevent PII leakage in observability data.

Closes Beads issue: med-tracker-ry5

Changes

New Files

  • lib/otel/span_sanitizer.rb — Core sanitizer that redacts PII patterns (emails, dates, IPs) from string values and identifies sensitive attribute keys
  • lib/otel/span_sanitizing_processor.rb — OpenTelemetry SpanProcessor that applies sanitization on span start

Modified Files

  • config/initializers/opentelemetry.rb — Changed PG db_statement from :include to :obfuscate, registered SpanSanitizingProcessor

Test Files

  • 34 new tests across 3 spec files covering sanitizer, processor, and integration

Sensitive Data Protection

Vector Before After
SQL statements Raw SQL with PII Obfuscated
PII attribute keys Passed through [REDACTED]
Email patterns Passed through [EMAIL REDACTED]
Date patterns Passed through [DATE REDACTED]
IP addresses Passed through [IP REDACTED]
Auth/cookie headers Passed through [REDACTED]

- Add Otel::SpanSanitizer to redact PII (emails, dates, IPs) from span attributes

- Add Otel::SpanSanitizingProcessor registered in both test and production configs

- Change PG instrumentation db_statement from :include to :obfuscate

- Sensitive key detection for authorization, cookie, password, name, email, DOB fields

- 34 new tests covering sanitizer, processor, and integration

Closes: med-tracker-ry5
@damacus damacus merged commit 428524a into main Feb 9, 2026
9 checks passed
@damacus damacus deleted the cascade/sensitive-data-scrubbing-f6bbdc branch February 9, 2026 21:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant