We have an application that uses application/merge-patch+json extensively for PATCH requests. When it is deployed behind Azure Front Door, the firewall complains that the content type is not allowed by the policy (see screen shot).
This is a blocker (literally if the firewall is in blocking mode). I have been able to find some workarounds:
Unfortunately, all these options are bad, as they bypass the firewall. Ideally, I would like to update the policy to add application/merge-patch+json as one of the content types that should be allowed. Then all the firewall rules still get to run.
Is there a way to do this, or are the allowed content types hard-coded by Microsoft?
Is there a way to do this, or are the allowed content types hard-coded by Microsoft?
AFAIK, Azure WAF’s managed rule sets (based on the OWASP Core Rule Set) do not support extending or customizing the list of allowed Content-Type
values for rules like 920300. These rules are hard-coded by Microsoft in alignment with OWASP, so there is no way to add application/merge-patch+json
to the allowed content types list used by Azure WAF’s managed rules.
Alternatively, if you want your app to function without fully bypassing the firewall, the best compromise is to add an exclusion for rule 920300 (or 920440), scoped only to the Content-Type
header with the value application/merge-patch+json
This approach offers the below benefits:
The WAF will still inspect the body, path, headers, and other metadata
Only the validation of Content-Type
for that specific rule will be skipped
Reference: What content types does WAF support?