-
Notifications
You must be signed in to change notification settings - Fork 10.3k
Properly reject non-json FromBody parameter binding #35976
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Did someone click "re-run failed jobs"? |
a40e8c1
to
6112761
Compare
@@ -2393,7 +2451,7 @@ private class CustomTodo : Todo | |||
Assert.Equal(typeof(CustomTodo), parameter.ParameterType); | |||
Assert.Equal("customTodo", parameter.Name); | |||
|
|||
var body = await context.Request.ReadFromJsonAsync<CustomTodo>(); | |||
var body = await JsonSerializer.DeserializeAsync<CustomTodo>(context.Request.Body); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ReadFromJsonAsync
throws for non json content type, and for testing I am sending Json without a json content type. I can make a separate type for the test to make it more focused.
/backport to release/6.0 |
Started backporting to release/6.0: https://github.com/dotnet/aspnetcore/actions/runs/1195893192 |
@BrennanConroy backporting to release/6.0 failed, the patch most likely resulted in conflicts: $ git am --3way --ignore-whitespace --keep-non-patch changes.patch
Applying: Properly reject non-json FromBody parameter binding
Using index info to reconstruct a base tree...
M src/Http/Http.Extensions/src/RequestDelegateFactory.cs
M src/Http/Http.Extensions/test/RequestDelegateFactoryTests.cs
Falling back to patching base and 3-way merge...
Auto-merging src/Http/Http.Extensions/test/RequestDelegateFactoryTests.cs
Auto-merging src/Http/Http.Extensions/src/RequestDelegateFactory.cs
CONFLICT (content): Merge conflict in src/Http/Http.Extensions/src/RequestDelegateFactory.cs
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
Patch failed at 0001 Properly reject non-json FromBody parameter binding
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".
Error: The process '/usr/bin/git' failed with exit code 128 Please backport manually! |
/backport to release/6.0 |
Started backporting to release/6.0: https://github.com/dotnet/aspnetcore/actions/runs/1196025743 |
Fixes #35856