Skip to content

Add option to redact (mask) sensitive URL parameters like ?password=... or ?token=... #6987

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
Mazgis47 opened this issue Mar 25, 2025 · 1 comment
Labels
area: instrumentation Related to an instrumentation package enhancement New feature or request instrumentation: otelhttp

Comments

@Mazgis47
Copy link

Mazgis47 commented Mar 25, 2025

Problem Statement

Some of the external APIs use authentication via URL parameters e.g.:
https://myapi.com/query?token=abcd
When using otelhttp Transport, transaction contains sensitive information in the attributes like http.url.

	otelHttpClient := http.Client{
		Transport: otelhttp.NewTransport(http.DefaultTransport),
	}

Proposed Solution

Have an Option to pass, something like WithParameterRedact(keysToSanitize []string), to the function:
func NewTransport(base http.RoundTripper, opts ...Option) *Transport
Which would replace actual token with the masked string like ?token=xxxxx

Alternatives

Prior Art

See alternatives

Additional Context

I just need this option to protect sensitive data leakage.

@Mazgis47 Mazgis47 added area: instrumentation Related to an instrumentation package enhancement New feature or request instrumentation: otelhttp labels Mar 25, 2025
@dmathieu
Copy link
Member

There is a plugin that allows doing that more broadly than just within otelhttp.
https://github.com/MrAlias/redact

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: instrumentation Related to an instrumentation package enhancement New feature or request instrumentation: otelhttp
Projects
None yet
Development

No branches or pull requests

2 participants