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

Query parameter values not URL decoded when using HTTP API V2 Gateway with a RequestStreamHandler implementation #1089

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

jpfennelly
Copy link

Issue #, if available: 976

Description of changes:

  • Fixed AwsProxyRequestBuilder, used by unit tests, to be immutable when calling the alb() method. Previously, a call to the alb() method would encode query parameters, modifying the state of the builder. Subsequent usage of the builder for non-ALB unit tests would use the now-encoded query parameters. This wasn't an issue in current current tests because no tests were testing query param decoding. Added unit tests for the builder class itself.
  • Additional unit tests and cleanup to separate form param from query param constants in tests
  • Added overloaded generateParameterMap() method that takes a flag to determine if it should decode query parameters so that functionality for ALB and non-ALB requests can be supported
  • Updated unit tests to test encoded query parameter names and values
  • Update HTTP request methods for parameters to handle decoding for ALB requests
  • Updated HTTP API V2 request to correctly decode values

By submitting this pull request

  • I confirm that my contribution is made under the terms of the Apache 2.0 license.
  • I confirm that I've made a best effort attempt to update all relevant documentation.

Copy link
Contributor

@valerena valerena left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the very detailed PR. I added a couple of minor comments.

Also something that wasn't clear to me is: if the problem is with API GW V2, then why are there changes related to ALB too? Is there a separate bug with ALB encoding as well? Or is it related to the same issue?

}

// decode all keys and values in map
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a fairly minor thing, but all this new code has a mix of spaces and tabs (first indentation is 4 spaces, then only tabs). Even though the project has some files with a mix of both, the vast majority of files are using spaces only. So try to keep this one with spaces only too. (The tests added are also using tabs, and hopefully you can change them to spaces)

List<String> values = new ArrayList<>(Arrays.asList(getQueryParamValues(request.getMultiValueQueryStringParameters(), s, config.isQueryStringCaseSensitive())));
// List<String> values = getQueryParamValuesAsList(request.getMultiValueQueryStringParameters(), s, config.isQueryStringCaseSensitive());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I imagine this comment shouldn't be here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants