Azure / apiops

APIOps applies the concepts of GitOps and DevOps to API deployment. By using practices from these two methodologies, APIOps can enable everyone involved in the lifecycle of API design, development, and deployment with self-service and automated tools to ensure the quality of the specifications and APIs that they’re building.
https://azure.github.io/apiops
MIT License
275 stars 162 forks source link

[BUG] Extractor replacing encoded characters in policies #555

Open ochadwick-westminster opened 1 month ago

ochadwick-westminster commented 1 month ago

Release version

v4.10.2

Describe the bug

Whilst extracing another, unrelated API, we have encountered an issue where 2 pre-existing API's that are included in the extractor config. These APIs both contain inbound policies in the policy.xml that were, for example:

When the extract now runs, the encoded & characters are getting set back to ampersands. Nothing has been changed on these APIs and the version of APIOps we are using, 4.10.2, has not been changed.

The API in APIM contains the encoded characters, and APIOps has successfully extracted these APIs mulitple times previously without incident. I have tired running APIOps locally on my machine and the problem seems to be in the extract process, as the files extracted contain the problem before any further pipeline steps are applied.

I have also tried running locally with the latest release but encounter the same problem.

The policy when viewed in APIM looks like:

image

However when viewed in the repo after extraction, it shows:

image

Expected behavior

The policy content is preserved exactly as defined in APIM.

Actual behavior

The encoded characters are being decoded when extracted.

Reproduction Steps

I'm unclear what steps to add as this seems to have started happening with no changes on either the APIs in question or the APIOps version being used.

github-actions[bot] commented 1 month ago
  Thank you for opening this issue! Please be patient while we will look into it and get back to you as this is an open source project. In the meantime make sure you take a look at the [closed issues](https://github.com/Azure/apiops/issues?q=is%3Aissue+is%3Aclosed) in case your question has already been answered. Don't forget to provide any additional information if needed (e.g. scrubbed logs, detailed feature requests,etc.).
  Whenever it's feasible, please don't hesitate to send a Pull Request (PR) our way. We'd greatly appreciate it, and we'll gladly assess and incorporate your changes.
RaguSoftEng commented 3 weeks ago

We also facing the same issue.

itssKrish commented 1 week ago

Hi, I'm also facing the same. I tried switching between versions v4.10.2 and v5.1.2 but no luck. This creates a major issue when we re-deploy the extracted file back to APIM portal (as a backup). I hope this will get resolved as soon as possible!

ochadwick-westminster commented 1 week ago

We were able to work around my original example by re-writing the apim policy to add query parameter policies to include them rather than adding them onto the end of the url rewrite (which is likely the better way to do it in general anyway) but it did mean updating pre-existing APIs that have worked on the extract with older versions and could mainfest elsewhere so be good to have it resolved.

vandriot commented 1 week ago

Hi, I'm also facing the issue with version v5.0.1.