Skip to content

[BUG]: fields represented as bytes are not redacted automatically #14199

@msladecek

Description

@msladecek

Tracer Version(s)

3.10.3

Python Version(s)

3.13.4

Pip Version(s)

N/A, using uv 0.7.21

Bug Report

Summary

We've leaked an authorization token into datadog error tracking because the captured locals were not properly sanitized.

Details

  • We run ddtrace with DD_EXCEPTION_REPLAY_ENABLED=true to capture local variables on errors.
  • An error occurred in our authentication middleware and the locals were captured.
  • The request object, along with its component, headers were captured in full
  • The authorization header was captured unredacted

The default list of redacted identifiers includes terms like "authorization", so one would think that the relevant http headers would get sanitized, but the framework we use (fastapi/starlette) lists the headers as the bytes type, not str, so the sanitization logic didn't catch it.

In the error tracking it showed up as b'authorization': b'Basic abc123...'

Reproduction Code

No response

Error Logs

No response

Libraries in Use

No response

Operating System

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions