Skip to content

Fix Token Endpoint Server Telemetry Parsing, Fixes AB#3604499#3128

Open
fadidurah wants to merge 3 commits into
devfrom
fadi/token-parse-fix
Open

Fix Token Endpoint Server Telemetry Parsing, Fixes AB#3604499#3128
fadidurah wants to merge 3 commits into
devfrom
fadi/token-parse-fix

Conversation

@fadidurah
Copy link
Copy Markdown
Contributor

@fadidurah fadidurah commented May 22, 2026

During the acquire token flow, we make a call to /token endpoint to get an access token using PRT. As part of this call, there is a telemetry header returned by ests for telemetry purposes, which we want to send back up to oneauth. it seems that there is an issue in the parsing that i missed, particularly targeting msa accounts. This change fixes that, I validated it manually and Kevin is validating now.

AB#3604499

Copilot AI review requested due to automatic review settings May 22, 2026 16:15
@fadidurah fadidurah requested a review from a team as a code owner May 22, 2026 16:15
@github-actions
Copy link
Copy Markdown

✅ Work item link check complete. Description contains link AB#3604499 to an Azure Boards work item.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Fixes parsing of the x-ms-clientdata server telemetry header on /token responses so that URL-encoded pipe delimiters (as returned by eSTS, notably for MSA scenarios) are decoded before being parsed into ClientDataInfo. This ensures server telemetry attributes are correctly emitted to OpenTelemetry spans and propagated upstream (e.g., to OneAuth), without breaking token parsing on malformed headers.

Changes:

  • URL-decode x-ms-clientdata header values before passing them to ClientDataInfo.fromPipeDelimited().
  • Skip clientdata parsing gracefully when URL-decoding fails (malformed percent-encoding) to avoid impacting token parsing.
  • Add unit tests covering URL-encoded headers and malformed percent-encoding behavior.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
common4j/src/main/com/microsoft/identity/common/java/providers/microsoft/microsoftsts/AbstractMicrosoftStsTokenResponseHandler.java Decodes x-ms-clientdata header prior to parsing and emits parsed telemetry to span/result.
common4j/src/test/com/microsoft/identity/common/java/providers/microsoft/microsoftsts/MicrosoftStsTokenResponseHandlerTest.java Adds coverage for URL-encoded clientdata headers and malformed percent-encoding handling.

@github-actions github-actions Bot changed the title Fix Token Endpoint Server Telemetry Parsing Fix Token Endpoint Server Telemetry Parsing, Fixes AB#3604499 May 22, 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.

2 participants