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

Incorrect encoding of %A[0-9] sequences #1096

Closed
akrikheli opened this issue Oct 16, 2019 · 2 comments · Fixed by #1138
Closed

Incorrect encoding of %A[0-9] sequences #1096

akrikheli opened this issue Oct 16, 2019 · 2 comments · Fixed by #1138
Assignees
Labels
bug Unexpected or incorrect behavior feedback provided Feedback has been provided to the author

Comments

@akrikheli
Copy link

Feign 10.x

I have a simple Feign proxy interface in my service named "facade" that just redirects requests to another service. The simple interaction of components looks like this:

Facade Controller -> CisServiceProxy -> FEIGN (HTTP-request) -> Another Service Controller

CisServiceProxy.java

String findByCisId(@RequestParam("cisId") String cisId)

I'd like to pass this string as the cisId parameter: %A1 (without additional encoding, how it looks actually).

curl -X GET "http://127.0.0.1:8095/api/v3/facade/cis/info?cisId=%25A1" -H "accept: /"

Facade controller logs:

#getCisInfo: started with cisId = %A1

But the logs of Another Service Controller were surprised me!

#getCisInfo: started with cisId=�

When I was researching this behaviour I noticed the code of class feign.template.UriUtils and pattern PCT_ENCODED_PATTERN that's used to determine if the value is already pct-encoded.

private static final Pattern PCT_ENCODED_PATTERN = Pattern.compile("%[0-9A-Fa-f][0-9A-Fa-f]");

So, how can I forward parameters that match this pattern "in original"?

@kdavisk6
Copy link
Member

kdavisk6 commented Nov 3, 2019

@akrikheli

Your example should be identified as already encoded. We will need to look into this further.

@kdavisk6 kdavisk6 added the bug Unexpected or incorrect behavior label Nov 3, 2019
@kdavisk6 kdavisk6 added the feedback provided Feedback has been provided to the author label Nov 15, 2019
@kdavisk6
Copy link
Member

kdavisk6 commented Dec 26, 2019

See #1138. This should correct this issue. The root cause is that we were not correctly identifying strings that have already been partially encoded.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Unexpected or incorrect behavior feedback provided Feedback has been provided to the author
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants