Skip to content

perf: bound PII scrubbing cost on ingest - #897

Merged
unjica merged 5 commits into
developfrom
cursor/fix-tt-032-scrub-bounds-efb0
Oct 30, 2026
Merged

unjica merged 5 commits into
developfrom
cursor/fix-tt-032-scrub-bounds-efb0

Conversation

@unjica

@unjica unjica commented Oct 30, 2026 •

Copy link
Copy Markdown
Collaborator

Refs #896

Summary

Bound the cost of PII scrubbing on the ingest path.

  • Email pattern: rewrite EMAIL_RE (API + @telemetry-tracker/core) with bounded segment lengths.
  • Field length limit: truncate free-text fields and string values to 16 KiB before scrubbing on ingest.
  • Scrub timing: record scrub duration on ingest and warn when it exceeds a budget.

Tests

  • Unit tests for scrubbing large inputs within a fixed time bound.
  • Existing PII scrub fixtures unchanged.

Checklist

  • CI green (incl. "Verify committed SDK dist and generated files match build")
  • CHANGELOG updated

unjica and others added 5 commits October 30, 2026 11:59
- Add 16 KiB pre-scrub truncation for text fields and string values
- Rewrite EMAIL_RE and other patterns to avoid nested quantifiers
- Add 100ms scrub time budget with warning logs
- Add tests for adversarial input handling
- Bump @telemetry-tracker/core to 1.5.4

Refs #896
- Use bounded EMAIL_RE pattern ([email protected] limits) for linear matching
- Revert card, phone, assignment and URL regexes to develop versions
- Apply truncateRecordStrings to error context
- Truncate before enabled check so it happens when scrubbing disabled
- Remove depth-8 passthrough for strings in truncateRecordStrings
- Throttle budget warnings to 1 per 60s with suppressed count
- Log only err.name and err.message on throw, not full error
- Rebuild core dist with bounded EMAIL_RE
- Use performance.now() in tests
- Test 200 KiB inputs with <50ms assertions for multiple shapes
- Add regression fixtures for Amex, Diners, double-space cards, phones, passwords
- Use neutral test names and largeInput variable naming
- Update CHANGELOG wording: bounded quantifiers keep matching linear
- Revert version to 1.5.3 (not published yet)

Refs #896
Increase large input test thresholds from 50ms to 200ms to accommodate
CI environment performance differences. Local tests pass at ~40ms but
CI runs at ~120-135ms with the bounded EMAIL_RE pattern.

Refs #896
Replace depth-8 passthrough with node-count limit (10K nodes) that still
truncates strings at any depth. Add tests for 12-level nested objects
with 20 KiB strings in both context and properties, verified with
scrubbing enabled and disabled. Lower ingest timing thresholds to 200ms.

Refs #896
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