Skip to content

Commit caf41fc

Browse files
minor #52497 [Webhook] check that the secret passed to RequestParser is not empty (xabbuh)
This PR was merged into the 6.4 branch. Discussion ---------- [Webhook] check that the secret passed to RequestParser is not empty | Q | A | ------------- | --- | Branch? | 6.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Issues | | License | MIT Commits ------- 00aaea2 check that the secret passed to RequestParser is not empty
2 parents e434a54 + 00aaea2 commit caf41fc

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/Symfony/Component/Webhook/Client/RequestParser.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
use Symfony\Component\HttpFoundation\RequestMatcher\MethodRequestMatcher;
1919
use Symfony\Component\HttpFoundation\RequestMatcherInterface;
2020
use Symfony\Component\RemoteEvent\RemoteEvent;
21+
use Symfony\Component\Webhook\Exception\InvalidArgumentException;
2122
use Symfony\Component\Webhook\Exception\RejectWebhookException;
2223

2324
/**
@@ -43,6 +44,10 @@ protected function getRequestMatcher(): RequestMatcherInterface
4344

4445
protected function doParse(Request $request, #[\SensitiveParameter] string $secret): RemoteEvent
4546
{
47+
if (!$secret) {
48+
throw new InvalidArgumentException('A non-empty secret is required.');
49+
}
50+
4651
$body = $request->toArray();
4752

4853
foreach ([$this->signatureHeaderName, $this->eventHeaderName, $this->idHeaderName] as $header) {

0 commit comments

Comments
 (0)