Merge pull request #335 from schue30/fix/add-sns-webhook-eusc-partition-support
This commit is contained in:
@@ -53,8 +53,8 @@ export class Webhooks {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Only allow HTTPS requests to official AWS SNS endpoints.
|
// Only allow HTTPS requests to official AWS SNS endpoints.
|
||||||
// The hostname must be exactly sns.<region>.amazonaws.com.
|
// The hostname must be exactly sns.<region>.amazonaws.com or sns.<region>.amazonaws.eu
|
||||||
const SNS_HOST_RE = /^sns\.[a-z0-9-]+\.amazonaws\.com$/;
|
const SNS_HOST_RE = /^sns\.[a-z0-9-]+\.amazonaws\.(com|eu)$/;
|
||||||
if (parsedURL.protocol !== 'https:' || !SNS_HOST_RE.test(parsedURL.hostname)) {
|
if (parsedURL.protocol !== 'https:' || !SNS_HOST_RE.test(parsedURL.hostname)) {
|
||||||
signale.warn(`SNS SubscriptionConfirmation rejected — disallowed SubscribeURL host: ${parsedURL.hostname}`);
|
signale.warn(`SNS SubscriptionConfirmation rejected — disallowed SubscribeURL host: ${parsedURL.hostname}`);
|
||||||
return res.status(400).json({success: false, message: 'Invalid SubscribeURL'});
|
return res.status(400).json({success: false, message: 'Invalid SubscribeURL'});
|
||||||
|
|||||||
Reference in New Issue
Block a user