Skip to content

[probes.http] Only treat a header as dynamic if substitution changes it - #1453

Merged
manugarg merged 2 commits into
mainfrom
http-dynamic-header-token-detection
Sep 2, 2026
Merged

manugarg merged 2 commits into
mainfrom
http-dynamic-header-token-detection

Conversation

@manugarg

@manugarg manugarg commented Sep 2, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #1449.

We decided a header was dynamic with strings.Contains(val, "@"), but substitution only ever matches @name@. So a value with one stray @ got marked dynamic, substituted to itself, and then logged on probe errors — which is how an API key with an @ in it ended up in the logs.

Detection now runs the substitution and checks whether the value changed, instead of guessing from the presence of an @. That can't drift from SubstituteLabels(), because it is SubstituteLabels().

A value that doesn't change under substitution isn't dynamic: it's sent verbatim, kept out of the error-log attributes, and no longer forces a per-send clone of the request. A value that does change stays tracked — including the @@ → @ escape, which carries no resolvable token but does alter what goes on the wire.

@manugarg
manugarg force-pushed the http-dynamic-header-token-detection branch 3 times, most recently from 673357e to d76076c Compare September 2, 2026 05:55
Detection used strings.Contains(val, "@") while substitution uses the
@name@ grammar, so a header value with a stray '@' was classified as
dynamic and its (unsubstituted) value was attached to error logs. Header
values are where credentials live, so a random API key with an '@' in it
ended up in the logs once per failed probe.

Detection now just runs the substitution and checks whether anything
moved, which is the one check that can't drift from it. A stray '@' is
no longer enough to make a header dynamic, so its value stays out of the
logs and out of the per-send request clone.

Fixes #1449
@manugarg
manugarg force-pushed the http-dynamic-header-token-detection branch from 1e611f0 to ab31e10 Compare September 2, 2026 06:14
initDynamicHeaders() was building a substitution map, and pulling a UUID
from crypto/rand, once per configured header -- including for values with
no '@' in them at all. Hoist it out of the closure: one sample resolution
tells us which values move, and the values we actually send are resolved
per-send by applyDynamicHeaders().
@manugarg manugarg changed the title [probes.http] Only treat a header as dynamic if it carries a real token [probes.http] Only treat a header as dynamic if substitution changes it Sep 2, 2026
@manugarg
manugarg merged commit 5047cac into main Sep 2, 2026
12 of 13 checks passed
@manugarg
manugarg deleted the http-dynamic-header-token-detection branch September 2, 2026 06:36
@manugarg manugarg added this to the v0.14.6 milestone Sep 2, 2026
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.

HTTP probe logs full header values on validation failure when the value contains a stray @

1 participant