Fix Token Endpoint Server Telemetry Parsing, Fixes AB#3604499#3128
Open
fadidurah wants to merge 3 commits into
Open
Fix Token Endpoint Server Telemetry Parsing, Fixes AB#3604499#3128fadidurah wants to merge 3 commits into
fadidurah wants to merge 3 commits into
Conversation
|
✅ Work item link check complete. Description contains link AB#3604499 to an Azure Boards work item. |
Contributor
There was a problem hiding this comment.
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-clientdataheader values before passing them toClientDataInfo.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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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