Azure / Azure/azure-functions-host

Don't try to read HTTP request body as string if explicitly known as binary

Open
#5,567 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
2k
Forks
482
Avg merge
2d 12h
Merged PRs (30d)
38

Description

Ideally, we would only try to read the body as JSON if its header was application/json.

As a non-breaking change though, we can check if the content [IsMediaTypeOctetOrMultipart](https://github.com/Azure/azure-functions-host/blob/dev/src/WebJobs.Script/Extensions/HttpRequestExtensions.cs#L101) and not [try to apply binding data to a json payload](https://github.com/Azure/azure-webjobs-sdk-extensions/blob/dev/src/WebJobs.Extensions.Http/HttpTriggerAttributeBindingProvider.cs#L293) if we find that that is true

Contributor guide

Open the contributing guide

Research direction

Start with IsMediaTypeOctetOrMultipart in src/WebJobs.Script/Extensions/HttpRequestExtensions.cs and the binding-data path in WebJobs.Extensions.Http/HttpTriggerAttributeBindingProvider.cs. Check how binary or multipart content is handled before string or JSON processing, and verify that binding data is not applied to an explicitly binary payload.

Written by the indexing model from the issue text.

Assessment

Tech stack
azure, csharp
Domain
api, backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.