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
target host whitelist #354
Conversation
oops |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just some feedback in case you use it.
@@ -371,6 +372,13 @@ function getHandler(options, proxy) { | |||
return; | |||
} | |||
|
|||
var targetHost = location.host; | |||
if (corsAnywhere.targetHostWhitelist.length && corsAnywhere.targetHostWhitelist.indexOf(targetHost) === -1) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This logic belongs to proxyRequest
, otherwise a redirect can be abused to bypass this.
Alternatively, disable following of redirects.
@@ -23,7 +24,8 @@ var cors_proxy = require('./lib/cors-anywhere'); | |||
cors_proxy.createServer({ | |||
originBlacklist: originBlacklist, | |||
originWhitelist: originWhitelist, | |||
requireHeader: ['origin', 'x-requested-with'], | |||
targetHostWhitelist: targetHostWhitelist, | |||
requireHeader: [],//['origin', 'x-requested-with'], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't disable requireHeader: ['origin', 'x-requested-with'],
. That's a security issue.
No description provided.