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

AWS Lambda Plugin. Admin API doesn't process "+" sign #2651

Closed
o-alexandrov opened this issue Jun 24, 2017 · 4 comments
Closed

AWS Lambda Plugin. Admin API doesn't process "+" sign #2651

o-alexandrov opened this issue Jun 24, 2017 · 4 comments
Labels
task/needs-investigation Requires investigation and reproduction before classifying it as a bug or not.

Comments

@o-alexandrov
Copy link

Summary

Hello, there is a bug with AWS Lambda plugin when configuring the plugin through a request to Kong Admin API.
It doesn't process + sign.

Steps To Reproduce

  1. Create an API
  2. When adding the AWS Lambda plugin, test for the + sign in the AWS_SECRET
  3. The result is empty space where + signs were located. In other words, it gets skipped

Additional Details & Logs

  • Kong version (0.10.3)
  • Configuration:
curl -X POST http://localhost:8001/apis/apiName/plugins \
--data "name=aws-lambda" \
--data "config.aws_key=AWS_KEY" \
--data "config.aws_secret=aSecretCodeWithAPlusSign" \
--data "config.aws_region=us-east-1" \
--data "config.function_name=helloWorld"

I then checked the AWS_SECRET without plus signs and GET request to the API worked.

I don't think there is a need to provide with additional details & logs, but please let me know if there is.

@p0pr0ck5 p0pr0ck5 changed the title [bug] AWS Lambda Plugin. Admin API doesn't process "+" sign AWS Lambda Plugin. Admin API doesn't process "+" sign Jun 26, 2017
@p0pr0ck5 p0pr0ck5 added the task/needs-investigation Requires investigation and reproduction before classifying it as a bug or not. label Jun 26, 2017
@mostlyjason
Copy link

+1

@thibaultcha
Copy link
Member

Pretty sure this is not coming from Kong, but from your usage of curl. As you are sending a x-www-form-urlencoded payload, you have to URL escape your data, or else when Kong receives it and processes it, it will URL decode your +, and that will become a .

Use --data-urlencode "config.aws_secret=aSecretCodeWithAPlusSign" or send a JSON payload, or use another tool that URL encodes form-urlencoded MIME types by default.

@o-alexandrov
Copy link
Author

o-alexandrov commented Jul 13, 2017

@thibaultcha You might consider updating your doc.
I don't see even a hint left in the official doc of the plugin that it might raise an error.

the line:
--data "config.aws_secret=AWS_SECRET" \
should be updated with:
--data-urlencode "config.aws_secret=AWS_SECRET" \

Thank you very much for the solution

@thibaultcha
Copy link
Member

Yes indeed. One might also argue that this is standard behavior for x-www-form-urlencoded MIME type payloads, but I do agree that a little reminder in the docs would not hurt :)

BTW, our docs are open source and we welcome contributions there as well: https://github.com/Mashape/getkong.org/ ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
task/needs-investigation Requires investigation and reproduction before classifying it as a bug or not.
Projects
None yet
Development

No branches or pull requests

4 participants