Skip to content

Commit 2aeac79

Browse files
committed
Validate and decode clientSecret in NoLogin constructor.
1 parent ee69eb0 commit 2aeac79

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/NoLogin.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,16 @@ class NoLogin
1818

1919
private Encrypter $encrypter;
2020

21-
public function __construct(private string $url, private readonly string $clientId, #[SensitiveParameter] private readonly string $clientSecret, array $options = [])
21+
public function __construct(private string $url, private readonly string $clientId, #[SensitiveParameter] private string $clientSecret, array $options = [])
2222
{
2323
if (empty($this->url) || empty($this->clientId) || empty($this->clientSecret)) {
2424
throw new InvalidArgumentException('NoLogin URL, Client ID, and Client Secret must be provided.');
2525
}
26+
$clientSecret = base64_decode($this->clientSecret);
27+
if ($clientSecret === false) {
28+
throw new InvalidArgumentException('Client Secret must be a valid base64 encoded string.');
29+
}
30+
$this->clientSecret = $clientSecret;
2631
$this->url = str_starts_with($this->url, 'http') ? $this->url : 'https://'.$this->url;
2732
if (str_ends_with($this->url, '/')) {
2833
$this->url = rtrim($this->url, '/');

0 commit comments

Comments
 (0)