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

API Gateway Authorizers Insecure Authentication Token Logging #521

Closed
ejohn20 opened this issue Jul 24, 2018 · 0 comments
Closed

API Gateway Authorizers Insecure Authentication Token Logging #521

ejohn20 opened this issue Jul 24, 2018 · 0 comments
Labels
area/bestpractices contributors/good-first-issue Good first issue for a contributor

Comments

@ejohn20
Copy link

ejohn20 commented Jul 24, 2018

The API Gateway default templates are logging the client's authentication token into the CloudWatch logs. While this may be helpful when debugging the function, this should be avoided in production as it leaks valid user tokens to the log files, which can be seen by users that likely should not have access to invoke all of the APIs on behalf of that user.

Yes, folks should restrict access to their log files. But, it is highly unlikely that all users viewing logs should be able to impersonate all users across the API using their token. I have seen the token logging code left in place in several security reviews recently, and the log data could have resulted in a major incident.

Here are 2 instances that I identified (there could be more):

https://github.com/awslabs/serverless-application-model/blob/a09929bcdd7cd6083d5c344ce5a64208a56bc4a6/examples/apps/api-gateway-authorizer-nodejs/index.js#L315

https://github.com/awslabs/serverless-application-model/blob/a09929bcdd7cd6083d5c344ce5a64208a56bc4a6/examples/apps/api-gateway-authorizer-python/lambda_function.py#L7

Can I suggest that these lines be removed from the default template? If the intent is to show users how to access the token, can we just set this to a variable instead with a comment explaining it contains the incoming token value?

Example:

var token = event.authorizationToken;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/bestpractices contributors/good-first-issue Good first issue for a contributor
Projects
None yet
Development

No branches or pull requests

2 participants