8000 [Mailer][Postmark][Webhook] Fix webhook testing in dockerized setups by aleho · Pull Request #53869 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[Mailer][Postmark][Webhook] Fix webhook testing in dockerized setups #53869

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

Merged
merged 1 commit into from
Feb 9, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
[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.
  • Loading branch information
aleho committed Feb 8, 2024
commit 5a2bcddbd40c51dc219cf532929d6ac89ec9e8ae
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,18 @@ 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'],
) {
}

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(),
]);
}
Expand Down
0