Skip to content

Conversation

@jamescrosswell
Copy link
Collaborator

@jamescrosswell jamescrosswell changed the title fix: Never capture authorization headers, even if SendDefaultPii is true fix: Redact Authorization header before sending events to Sentry May 5, 2025
@jamescrosswell jamescrosswell marked this pull request as ready for review May 5, 2025 10:06

internal class RedactedHeaders : IDictionary<string, string>
{
private static readonly string[] SensitiveKeys = ["Authorization", "Proxy-Authorization"];
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could be a bit more aggressive there. The Python SDK redacts a bunch of headers.

See Potential suspects.

Cookies = cookies,
Data = data,
InternalHeaders = headers?.WhereNotNullValue().ToDict(),
InternalHeaders = headers.Redact(),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With the implicit operator, do we need to call the method here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We do unfortunately. InternalHeaders is nullable and that can't be done with an implicit operator.

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.

Always redact Authorization headers before sending to Sentry

5 participants