Skip to content

fix transcoding query overwrites body/route parameters#66401

Closed
DeagleGross wants to merge 3 commits into
dotnet:mainfrom
DeagleGross:dmkorolev/grpc-transcoding-jsonnamealias
Closed

fix transcoding query overwrites body/route parameters#66401
DeagleGross wants to merge 3 commits into
dotnet:mainfrom
DeagleGross:dmkorolev/grpc-transcoding-jsonnamealias

Conversation

@DeagleGross

Copy link
Copy Markdown
Member

Fixed issue where in query parameter processing overwrites route or body-bound fields.

@DeagleGross DeagleGross self-assigned this Apr 21, 2026
Copilot AI review requested due to automatic review settings April 21, 2026 10:08
@DeagleGross DeagleGross added the area-grpc Includes: GRPC wire-up, templates label Apr 21, 2026

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 JSON transcoding request binding precedence so query string parameters cannot overwrite values already bound from route parameters or the HTTP body (including when query keys use JSON-name aliases).

Changes:

  • Prevent query binding for body-bound fields using both proto field names and JSON names (including nested prefixes).
  • Prevent query binding for route-bound fields when query keys match the route field’s JSON path alias.
  • Add/extend tests and update the test proto to cover JSON-name alias scenarios.

Reviewed changes

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

File Description
src/Grpc/JsonTranscoding/src/Microsoft.AspNetCore.Grpc.JsonTranscoding/Internal/JsonRequestHelpers.cs Extends query-binding filter to block overwrites of body/route-bound fields via proto and JSON names.
src/Grpc/JsonTranscoding/src/Microsoft.AspNetCore.Grpc.JsonTranscoding/Internal/CallHandlers/CallHandlerDescriptorInfo.cs Precomputes a set of route parameter JSON paths for fast alias checks during query binding.
src/Grpc/JsonTranscoding/test/Microsoft.AspNetCore.Grpc.JsonTranscoding.Tests/UnaryServerCallHandlerTests.cs Adds regression tests ensuring query params (proto/JSON aliases) don’t overwrite route/body values.
src/Grpc/JsonTranscoding/test/Microsoft.AspNetCore.Grpc.JsonTranscoding.Tests/Proto/transcoding.proto Adds sub_data to exercise JSON-name prefix behavior for body-bound fields.

…anscoding.Tests/UnaryServerCallHandlerTests.cs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@DeagleGross

Copy link
Copy Markdown
Member Author

fixed at #67108

@DeagleGross DeagleGross deleted the dmkorolev/grpc-transcoding-jsonnamealias branch June 10, 2026 08:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-grpc Includes: GRPC wire-up, templates

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants