Skip to content

Conversation

mitchdenny
Copy link
Member

Addresses #46785

Copy link
Member

@captainsafia captainsafia left a comment

Choose a reason for hiding this comment

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

The RequestDelegateFactory processes arrays of things only if DisableInferBodyFromParameters is true. This property is typically set if the request is a non-POST request (see this code). We might want to consider respecting this property here to avoid inadvertently triggering this code path for MapPost types.

@mitchdenny
Copy link
Member Author

The RequestDelegateFactory processes arrays of things only if DisableInferBodyFromParameters is true. This property is typically set if the request is a non-POST request (see this code). We might want to consider respecting this property here to avoid inadvertently triggering this code path for MapPost types.

I don't look at processing arrays from request body at all in this PR. I'm only sourcing from either query string or headers. I can see that we need to handle the from body scenario though. I might follow this up with another PR unless you think what I've got here is unsafe even in the query string/headers scenario.

@mitchdenny
Copy link
Member Author

Ah sorry, I think I misunderstood what you are talking about. Looking more closely at the MapPost behavior I can see what you mean.

@mitchdenny
Copy link
Member Author

@captainsafia reacted to changes on main, but also added logic to decide when to infer parameters from body.

Copy link
Member

@captainsafia captainsafia left a comment

Choose a reason for hiding this comment

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

Looks good overall! We should consolidate the tests that are in RDFTests with these to make sure that we haven't missed any bugs...

@mitchdenny
Copy link
Member Author

Looks good overall! We should consolidate the tests that are in RDFTests with these to make sure that we haven't missed any bugs...

Good call. I've found a few bugs in doing this around arrays of nullables.

@mitchdenny mitchdenny requested a review from captainsafia March 15, 2023 09:24
mitchdenny and others added 2 commits March 16, 2023 09:46
@mitchdenny mitchdenny requested a review from captainsafia March 16, 2023 02:10
Copy link
Member

@captainsafia captainsafia left a comment

Choose a reason for hiding this comment

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

:shipit:

Follow ups include handling DisableInferBodyFromParameters as a runtime value and removing duplicate RDF tests.

@mitchdenny mitchdenny merged commit 354efd4 into dotnet:main Mar 16, 2023
@ghost ghost added this to the 8.0-preview3 milestone Mar 16, 2023
@amcasey amcasey added area-networking Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions and removed area-runtime labels Aug 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-networking Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants