Skip to content

Fix Output Caching query-string cache-key collision - #68792

Merged
Youssef1313 merged 3 commits into
mainfrom
copilot/fix-outputcachekeyprovider
Aug 27, 2026
Merged

Youssef1313 merged 3 commits into
mainfrom
copilot/fix-outputcachekeyprovider

Conversation

Copilot AI commented Aug 26, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #68779

Avoid ambiguity for output caching key.

Copilot AI changed the title [WIP] Fix OutputCacheKeyProvider cache-key collision issue Fix Output Caching query-string cache-key collision Aug 26, 2026
Copilot AI requested a review from Youssef1313 August 26, 2026 07:27
@Youssef1313
Youssef1313 marked this pull request as ready for review August 26, 2026 08:14
Copilot AI lite review requested due to automatic review settings August 26, 2026 08:14

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Fixes a cache-key collision in Output Caching when query-string keys/values contain = by switching the name/value separator in the serialized cache key away from a literal = to a non-ambiguous delimiter, and adding coverage to prevent regressions.

Changes:

  • Updated OutputCacheKeyProvider to use a dedicated name/value delimiter (\x1d) instead of = when serializing header/query/route/vary-by-value pairs.
  • Expanded delimiter validation to reject inputs containing the new delimiter.
  • Updated and extended tests to validate the new key serialization and ensure previously-colliding query shapes produce distinct keys.

Reviewed changes

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

File Description
src/Middleware/OutputCaching/src/OutputCacheKeyProvider.cs Changes cache-key serialization to use a dedicated name/value delimiter and expands delimiter validation to avoid collisions.
src/Middleware/OutputCaching/test/OutputCacheKeyProviderTests.cs Updates expected cache-key strings and adds regression tests for the =-related collision and delimiter rejection.

💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

@Youssef1313
Youssef1313 enabled auto-merge (squash) August 27, 2026 18:07
@Youssef1313
Youssef1313 merged commit f5bdc53 into main Aug 27, 2026
27 checks passed
@Youssef1313
Youssef1313 deleted the copilot/fix-outputcachekeyprovider branch August 27, 2026 18:23
@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 12.0-preview1 milestone Aug 28, 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.

Output Caching query-string key collision on =

4 participants