Repository navigation
feat(api): ingest PII scrubbing (Phase 1 of #470) - #472
Merged
Merged
Conversation
Default server-side redaction for error messages/stacks/context and event properties; shared scrubber reused by brief sanitization. Disable with TELEMETRY_INGEST_PII_SCRUB=false for self-host overrides. Implements Phase 1 of #470. Co-authored-by: Cursor <[email protected]>
When maxDepth/maxNodes are exceeded, continue a key/string remainder pass so crafted deep payloads cannot persist raw emails under nested keys. Co-authored-by: Cursor <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements Phase 1 of #470: default server-side PII scrubbing on the ingest write path.
pii-scrub.ts) with stable placeholders ([email],[token],[bearer-token],[api-key], …)/ingest/error,/ingest/event, and/ingest/batch(events only — same helper as/event)computeFingerprint+ Prisma writes so redacted values are stored and groupedscrubPiiTextpreserves stack newlines (no brief whitespace collapse; brief still collapses after reuse)TELEMETRY_INGEST_PII_SCRUB=falsescrubPiiTextdocs/PII-SCRUBBING.md,.env.example,DEPLOYMENT.md, README, CHANGELOGImplements Phase 1 of #470.
Intentionally deferred (later phases of #470)
session.user_emailcolumn rewriting@telemetry-tracker/core)Verification (pre-PR)
scrubPiiText/errorcallsscrubIngestErrorFieldsthencomputeFingerprint; test asserts emails do not affect fingerprints/batchconsistent with/eventscrubIngestEventFields(batch has no error payloads)TELEMETRY_INGEST_PII_SCRUB=falseself-host override, default onisIngestPiiScrubEnabledtestsTest results
Focused scrubber suites:
pii-scrub.test.ts(20),ingest-pii-scrub.test.ts(8),brief-snapshot-sanitize.test.ts(11).Test plan
POST /ingest/errorwith an email inmessage→ stored as[email]TELEMETRY_INGEST_PII_SCRUB=falsestores raw emailMade with Cursor