Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

REST Connector automatic URL decoding removes already encoded elements #3694

Open
sbuettner opened this issue Nov 21, 2024 · 0 comments
Open
Labels
good first issue kind:bug Something isn't working

Comments

@sbuettner
Copy link
Contributor

sbuettner commented Nov 21, 2024

Describe the Bug

We received a support request from a client: https://jira.camunda.com/browse/SUPPORT-24612?focusedCommentId=382201&atlLinkOrigin=c2xhY2staW50ZWdyYXRpb258Y29tbWVudA%3D%3D

The REST Connector by default decodes incoming URLs to properly encoded them again. This removed already encoded elements of the incoming URL.

Example: "http://your.test.server/test%2Ftest" --> "http://your.test.server/test/test"

The server requires the last path segment to be encoded as "test%2Ftest" is the name of the resource.

One example where this behavior leads to issues is in the GitLab Connector as GitLab requires users to encode slashes in URLs when they are part of branch names: https://forum.gitlab.com/t/how-to-get-with-api-a-branch-name-containing-slashes/59347/5

Steps to Reproduce

  1. Use an URL that contains encoded path segments: http://your.test.server/test%2Ftest
  2. Pass it to the REST Connector as a process variable or a static string
  3. The URL gets decoded and encoded again removing the previously encoded values
  4. The final URL contains the decoded segments which lead to wring values as the path is now changed: "http://your.test.server/test/test instead of "http://your.test.server/test%2Ftest

One case this affects our users is the GitLab Connector.

Expected Behavior

Already encoded elements of the URL should not be decoded and sent as is to the upstream server.

Solutions

  • We could provided an optional property in the request mode to deactivate the automatic URL decoding. This flag disables the decoding on our side and would keep the URL as is. The flag could be marked as hidden defaulting to true and can optionally be disabled for example in the GitLab Connector for calls that support branch names.

  • Update the Gitlab Connector accordingly to avoid URL encoding there.

An alternative would be to refactor our URL decoding in the HTTP base connector by keeping elements that dont require re-encoding as they are like it was done in the previous implementation in the Google HTTP Client library: https://github.com/googleapis/google-http-java-client/blob/main/google-http-client/src/main/java/com/google/api/client/util/escape/CharEscapers.java

Environment

  • Camunda Connectors 8.6
@sbuettner sbuettner added the kind:bug Something isn't working label Nov 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue kind:bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants