8000 [Mailer][Postmark][Webhook] Make allowed IPs configurable · symfony/symfony@5a2bcdd · GitHub
[go: up one dir, main page]

Skip to content

Commit 5a2bcdd

Browse files
committed
[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.
1 parent fa843ce commit 5a2bcdd

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/Symfony/Component/Mailer/Bridge/Postmark/Webhook/PostmarkRequestParser.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,16 +27,18 @@ final class PostmarkRequestParser extends AbstractRequestParser
2727
{
2828
public function __construct(
2929
private readonly PostmarkPayloadConverter $converter,
30+
31+
// https://postmarkapp.com/support/article/800-ips-for-firewalls#webhooks
32+
// localhost is added for testing
33+
private readonly array $allowedIPs = ['3.134.147.250', '50.31.156.6', '50.31.156.77', '18.217.206.57', '127.0.0.1'],
3034
) {
3135
}
3236

3337
protected function getRequestMatcher(): RequestMatcherInterface
3438
{
3539
return new ChainRequestMatcher([
3640
new MethodRequestMatcher('POST'),
37-
// https://postmarkapp.com/support/article/800-ips-for-firewalls#webhooks
38-
// localhost is added for testing
39-
new IpsRequestMatcher(['3.134.147.250', '50.31.156.6', '50.31.156.77', '18.217.206.57', '127.0.0.1']),
41+
new IpsRequestMatcher($this->allowedIPs),
4042
new IsJsonRequestMatcher(),
4143
]);
4244
}

0 commit comments

Comments
 (0)
0