Exclude caller SDK telemetry from access token cache keys#6074
Merged
Conversation
Caller SDK metadata is telemetry-only and should not partition access token cache entries even when supplied through WithExtraQueryParameters with IncludeInCacheKey=true. Fixes #6073 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR ensures the telemetry-only extra query parameters caller-sdk-id and caller-sdk-ver never influence access token cache key computation (even when callers explicitly request IncludeInCacheKey=true), preventing avoidable app token cache fragmentation.
Changes:
- Remove
caller-sdk-id/caller-sdk-verfromAuthenticationRequestParameters.CacheKeyComponentsduring request initialization. - Add a regression unit test proving cache key components retain only non-telemetry entries when
IncludeInCacheKey=true.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/client/Microsoft.Identity.Client/Internal/Requests/RequestBase.cs | Strips caller SDK telemetry keys from request cache key components before cache lookup/storage. |
| tests/Microsoft.Identity.Test.Unit/TelemetryTests/HttpTelemetryTests.cs | Adds regression coverage ensuring caller SDK telemetry does not partition the app access token cache. |
Assert cache key components after each AcquireTokenForClient call so both initial storage and subsequent cache lookup preserve caller SDK telemetry exclusion. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
4gust
approved these changes
Jun 18, 2026
neha-bhargava
approved these changes
Jun 18, 2026
This was referenced Jun 19, 2026
Closed
Closed
fix: Bump Microsoft.Identity.Client from 4.84.2 to 4.85.0
Halceyon/open-telemetry-trace-listener#199
Closed
This was referenced Jun 23, 2026
Merged
Closed
Closed
Open
Open
Closed
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.
Summary
caller-sdk-idandcaller-sdk-verfrom remaining in cache key components after caller SDK telemetry is extracted.IncludeInCacheKey=true.Fixes #6073
Testing
dotnet test tests\Microsoft.Identity.Test.Unit\Microsoft.Identity.Test.Unit.csproj --framework net8.0 --filter "FullyQualifiedName~CallerSdkDetails_AreNeverIncludedInCacheKeyComponentsAsync" --no-restore --verbosity minimaldotnet test tests\Microsoft.Identity.Test.Unit\Microsoft.Identity.Test.Unit.csproj --framework net8.0 --filter "FullyQualifiedName~HttpTelemetryTests" --no-restore --verbosity minimalNote: a multi-target run without
--framework net8.0also attempted net48 and hit an existing MSTest adapter dependency load error forSystem.Memory, Version=4.0.1.2before net8.0 passed.