fix: Adapt SNS Webhook validation regex pattern to also support AWS eusc partition

This commit is contained in:
Mathias Schüpany
2026-03-29 11:32:04 +02:00
parent 4b290fd0b7
commit 7b6540a748
+2 -2
View File
@@ -53,8 +53,8 @@ export class Webhooks {
}
// Only allow HTTPS requests to official AWS SNS endpoints.
// The hostname must be exactly sns.<region>.amazonaws.com.
const SNS_HOST_RE = /^sns\.[a-z0-9-]+\.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|eu)$/;
if (parsedURL.protocol !== 'https:' || !SNS_HOST_RE.test(parsedURL.hostname)) {
signale.warn(`SNS SubscriptionConfirmation rejected — disallowed SubscribeURL host: ${parsedURL.hostname}`);
return res.status(400).json({success: false, message: 'Invalid SubscribeURL'});