Skip to content

Outgoing HttpClient LatencyInfo enricher value has incomplete escaping #7757

Description

@EasyL0ver

Description

The outgoing HttpClient latency enricher (AddHttpClientLatencyTelemetry)
serializes the LatencyInfo tag value as a positional string but escapes nothing,
so legal input can shift the positional layout and corrupt the value a parser
reads.

The value format is (8 sections):

version , serverName , tagNames/ , tagValues/ , checkpointNames/ , checkpointMs/ , measureNames/ , measureValues/
  • Sections are joined by ,.
  • List items are joined by /.

Gaps in HttpClientLatencyLogEnricher:

  1. The section delimiter , is never escaped. A , in any string field
    (server name, tag name, tag value, checkpoint/measure name) shifts every
    downstream section.
  2. List items do not escape /. AppendTags, AppendCheckpoints, and
    AppendMeasures append names and values raw, so a / inside an item corrupts
    the item-level split.
  3. The server name field is not escaped at all (AppendServerName).

Affected code

HttpClientLatencyLogEnricher

  • AppendServerName writes the server name raw.
  • AppendTags / AppendCheckpoints / AppendMeasures append names and values raw, escaping neither , nor /.

Impact

Low severity. Most fields are registered/controlled names (checkpoints, measures,
tags). The one caller-controlled field is the server application name, taken from
a response header, which can legally contain , and /. Newlines are not
reachable (rejected by the server), so this is a data-integrity / parse-corruption
issue for consumers of LatencyInfo, not a log-forging issue.

Proposed fix

Escape , and / in every string field, including the server name, matching the
scheme the incoming enricher uses (/ and , replaced with _).

Notes

Discovered during API review of #7729 (AddHttpLatencyTelemetry). The incoming
enricher had the same class of defect and was fixed in that change; this issue
tracks the remaining gap in the outgoing HttpClient enricher, which currently
escapes nothing.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions