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

Auth Token gets returned in the Error #70

Open
robinlarondelle opened this issue Sep 3, 2020 · 1 comment
Open

Auth Token gets returned in the Error #70

robinlarondelle opened this issue Sep 3, 2020 · 1 comment

Comments

@robinlarondelle
Copy link

When you make a request through this package to the Mailchimp API, and the API returns an error, the Error JSON contains the Basic Auth token. You can extract this token and make requests without knowing the API key.

My question/issue is: Does Mailchimp return the Auth token by itself, or is it included by this package to the error response? If so: why? Including the Auth token in your error response creates a security issue, where your access token can be stolen.

Let me know, thanks ;)

@thorning
Copy link
Owner

thorning commented Sep 4, 2020

I think what you refer to is here: https://github.com/thorning/node-mailchimp/blob/master/index.js#L517-L523

The rejected error contains the full response object from request, which could contain data that should not be exposed the the client.

I would be hesitant to change the error content, as much existing error handling depends on it. I would also argue to always be careful when returning raw errors to the client.

I think the best solution would be to have user friendly message on the error, that is safe and useful to send to end users. I will gladly accept a PR for that :)

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

No branches or pull requests

2 participants