Skip to content

fix: redact independently rendered structlog records in Sentry - #462

Merged
lesnik512 merged 1 commit into
mainfrom
fix/external-structlog-sentry-redaction
Nov 15, 2026
Merged

lesnik512 merged 1 commit into
mainfrom
fix/external-structlog-sentry-redaction

Conversation

@lesnik512

Copy link
Copy Markdown
Member

Independently rendered structlog records with a missing or non-string message can leak sensitive fields into Sentry issues and later breadcrumbs. Add an opt-in SentryJSONRenderer that preserves JSON output and marks the rendered string for the existing redaction pipeline. Identical unmarked stdlib JSON stays unchanged.

Use the renderer in the built-in logging instrument and document external configuration in the migration guide and seam ADR.

Regression tests reproduce the envelope leak before the fix and verify serialized payloads, later breadcrumbs, callback ordering, suppression, and unchanged stdout JSON.

Validation: 679 tests pass with 100% line coverage; Ruff, ty 0.0.100, and the strict docs build pass. Standards and spec reviews found no issues.

Closes #450.

@lesnik512
lesnik512 merged commit 2dc5d46 into main Nov 15, 2026
35 checks passed
@lesnik512
lesnik512 deleted the fix/external-structlog-sentry-redaction branch November 15, 2026 10:34
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.

[P1] Scrub Sentry events and breadcrumbs when a structlog message is missing

1 participant