Skip to content

Commit 00aaea2

Browse files
committed
check that the secret passed to RequestParser is not empty
1 parent e434a54 commit 00aaea2

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)