From 5a2bcddbd40c51dc219cf532929d6ac89ec9e8ae Mon Sep 17 00:00:00 2001 From: Alexander Hofbauer Date: Thu, 8 Feb 2024 18:21:53 +0100 Subject: [PATCH] [Mailer][Postmark][Webhook] Make allowed IPs configurable Adding "127.0.0.1" to webhooks doesn't always cut it. Testing in e.g. dockerized setups the IP address will most certainly not be 127.0.0.1 when testing requests originate from the host. --- .../Bridge/Postmark/Webhook/PostmarkRequestParser.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/Symfony/Component/Mailer/Bridge/Postmark/Webhook/PostmarkRequestParser.php b/src/Symfony/Component/Mailer/Bridge/Postmark/Webhook/PostmarkRequestParser.php index 03326a697087..033ea8c2808a 100644 --- a/src/Symfony/Component/Mailer/Bridge/Postmark/Webhook/PostmarkRequestParser.php +++ b/src/Symfony/Component/Mailer/Bridge/Postmark/Webhook/PostmarkRequestParser.php @@ -27,6 +27,10 @@ final class PostmarkRequestParser extends AbstractRequestParser { public function __construct( private readonly PostmarkPayloadConverter $converter, + + // https://postmarkapp.com/support/article/800-ips-for-firewalls#webhooks + // localhost is added for testing + private readonly array $allowedIPs = ['3.134.147.250', '50.31.156.6', '50.31.156.77', '18.217.206.57', '127.0.0.1'], ) { } @@ -34,9 +38,7 @@ protected function getRequestMatcher(): RequestMatcherInterface { return new ChainRequestMatcher([ new MethodRequestMatcher('POST'), - // https://postmarkapp.com/support/article/800-ips-for-firewalls#webhooks - // localhost is added for testing - new IpsRequestMatcher(['3.134.147.250', '50.31.156.6', '50.31.156.77', '18.217.206.57', '127.0.0.1']), + new IpsRequestMatcher($this->allowedIPs), new IsJsonRequestMatcher(), ]); } pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy