quarkusio / quarkus

Quarkus: Supersonic Subatomic Java.
https://quarkus.io
Apache License 2.0
13.57k stars 2.63k forks source link

AWS Lambda returns a 400 response (bad request) when a special character is in the URL #17341

Open stefvanderwel opened 3 years ago

stefvanderwel commented 3 years ago

Describe the bug

When Quarkus is deployed using quarkus-amazon-lambda-http or quarkus-amazon-lambda-rest, special characters are not allowed in the path params.

For example,GET /greeting/auth0|5ddfd9cab2658c0e34e9e0fa or GET /greeting/auth0%7C5ddfd9cab2658c0e34e9e0fa (urlencoded) immediately return a 400 response without any error message.

Expected behavior

It should return the regular response (200).

Actual behavior

It immediately returns a bad request (status 400 response)

To Reproduce

https://gitlab.com/stefvanderwel/quarkus-lambda-bugreport

Steps to reproduce the behavior:

  1. mvn package
  2. sam local start-api --template target/sam.jvm.yaml
  3. Make an HTTP request (in browser or with any HTTP client): GET http://localhost:3000/hello/auth0|6e27543b74dfe10eaa478c95 or GET http://localhost:3000/hello/auth0%7C5ddfd9cab2658c0e34e9e0fa (urlencoded)
  4. For the Vert.x example: http://localhost:3000/vertx/hello/auth0|6e27543b74dfe10eaa478c95 or http://localhost:3000/vertx/hello/auth0%7C5ddfd9cab2658c0e34e9e0fa
  5. When in any of above cases the | or %7C is removed, the request seems to be working.

Screenshots

image

Environment (please complete the following information):

Output of uname -a or ver

Darwin MacBook-Pro-van-Stef.local 20.4.0 Darwin Kernel Version 20.4.0: Thu Apr 22 21:46:47 PDT 2021; root:xnu-7195.101.2~1/RELEASE_X86_64 x86_64

Output of java -version

openjdk version "11.0.8" 2020-07-14
OpenJDK Runtime Environment AdoptOpenJDK (build 11.0.8+10)
Eclipse OpenJ9 VM AdoptOpenJDK (build openj9-0.21.0, JRE 11 Mac OS X amd64-64-Bit Compressed References 20200715_677 (JIT enabled, AOT enabled)
OpenJ9   - 34cf4c075
OMR      - 113e54219
JCL      - 95bb504fbb based on jdk-11.0.8+10)

Quarkus version or git rev

1.13.4.Final

Build tool (ie. output of mvnw --version or gradlew --version)

Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)
Maven home: /Users/stefvdwel/.sdkman/candidates/maven/current
Java version: 11.0.8, vendor: AdoptOpenJDK, runtime: /Users/stefvdwel/.sdkman/candidates/java/11.0.8.j9-adpt
Default locale: en_GB, platform encoding: UTF-8
OS name: "mac os x", version: "10.16", arch: "x86_64", family: "mac"

Additional context

I have already tried to actually deploy it to AWS lambda (without the sam cli). This gives the same result.

quarkus-bot[bot] commented 3 years ago

/cc @matejvasek, @patriot1burke

niekvangogh commented 3 years ago

I've had this problem before, gave up after a while; probably should be fixed though