Skip to content

Commit a6aaa4a

Browse files
committed
If we dont have enough jwt parts, jwt is invalid
1 parent 5eb5657 commit a6aaa4a

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/Fident.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,12 @@ public function getConfig(): FidentConfiguration
2828

2929
public function verifyJwt(string $rawJwt): bool
3030
{
31-
[$head64, $payload64, $sig64] = explode('.', $rawJwt, 3);
31+
$parts = explode('.', $rawJwt, 3);
32+
if(count($parts) != 3)
33+
{
34+
return false;
35+
}
36+
[$head64, $payload64, $sig64] = $parts;
3237
$header = json_decode(Strings::urlsafeBase64Decode($head64));
3338
if(!$header || !isset($header->typ) || $header->typ !== 'JWT')
3439
{

0 commit comments

Comments
 (0)