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

JerseyHandlerFilter breaks query string encoding #140

Closed
sedovalx opened this issue Apr 5, 2018 · 1 comment
Closed

JerseyHandlerFilter breaks query string encoding #140

sedovalx opened this issue Apr 5, 2018 · 1 comment
Assignees
Labels
Milestone

Comments

@sedovalx
Copy link

sedovalx commented Apr 5, 2018

  • Framework version: 1.0
  • Implementations: Jersey

Scenario

When the JerseyHandlerFilter handles requests that contain encoded + signs in query parameters it breaks the encoding. As a result, such a query parameter retrieved via @QueryParam in an endpoint is wrongly decoded. As an example, the parameter param=p%2Fz%2B3 of the original request is decoded as param=p/z 3 via the @QueryParam.

Though, the same query parameter that is retrieved as HttpServletRequest#getParameter is properly decoded. The difference is that the serverless contained gets the query parameter directly from the AwsProxyRequest without intermediate decoding/encoding actions.

Expected behavior

Original query parameter param=p%2Fz%2B3 of a request should be retrieved as follows:

  • @QueryParam("param") String param -> "p/z+3"
  • @QueryParam("param") @Encoded String param -> "p%2Fz%2B3"
  • request.getParameter("param") -> "p/z+3"

Actual behavior

  • @QueryParam("param") String param -> "p/z 3"
  • @QueryParam("param") @Encoded String param -> "p%2Fz+3"
  • request.getParameter("param") -> "p/z+3"

Steps to reproduce

Create an endpoint

@GET
@Path("/test")
public Response getAll(@QueryParam("param") String param) {
  ...
}

Run the code in AWS Lambda or locally in SAM Local. Then, try to GET /test?param=p%2Fz%2B3

Full log output

@sapessi
Copy link
Collaborator

sapessi commented Apr 6, 2018

Fixed in the latest release. I'm now using the raw query string with pre-encoding/decoding.

@sapessi sapessi closed this as completed Apr 6, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants