Azure / api-management-developer-portal

Developer portal provided by the Azure API Management service.
MIT License
490 stars 319 forks source link

header with dictionary value has optional whitespace removed #2059

Closed davildaran closed 8 months ago

davildaran commented 1 year ago

Bug description

Whitespaces in header values are removed by default, with no apparent way to preserve the original header values

Tracing an http request in API Management Service shows in api-inspector that a header with a dictionary value has its whitespace removed.

Reproduction steps

  1. Go to APIM
  2. Select an API
  3. Select a route
  4. Click Test
  5. Provide a header like the following x-header-dict: alg="RS256", typ="JOSE"
  6. Send the request
  7. Click Trace and the Trace tab to the right of the Message under HTTP Response to view the trace output
  8. Verify the x-header-dict is transformed prior to any other APIM custom policies, e.g. set-header, to the following "alg=\"RS256\",typ=\"JOSE\"

Expected behavior

The header values are not mutated by APIM. This default behavior seems to go against this spec https://datatracker.ietf.org/doc/html/rfc8941#name-dictionaries

Preserving the whitespaces is essential for message signing purposes.

Is your portal managed or self-hosted?

Managed / Self-hosted

Release tag or commit SHA (if using self-hosted version)

[e.g., release 2.0.0, commit c45da9778b70d369aba60fa2e63c191efe2b548f]

API Management service name

[e.g., contoso-api]

Environment

Additional context

ghost commented 1 year ago

@davildaran, thank you for opening this issue. We will triage it within the next few business days.

jsorohova commented 1 year ago

Hello @davildaran , from your reproduction steps I understand that you are talking about a request tracing in Azure portal. This repository is for a Developer portal only. Please, contact Azure support. Thank you.

mrcarlosdev commented 8 months ago

This issue is related to managed developer portal. We advise you to create a Azure support request to get assistance on this issue. Please refer to the below link to create a new Azure support request, Please select Problem Type = "Developer Portal" in the request to route it appropriately.

https://learn.microsoft.com/en-us/azure/azure-portal/supportability/how-to-create-azure-support-request