GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

Issues (41)

src/Http/Middlewares/VerifySignature.php (1 issue)

Severity
1
<?php
2
3
namespace Multicoin\Api\Http\Middlewares;
4
5
use Closure;
6
use Multicoin\Api\Exceptions\WebhookFailed;
7
8
class VerifySignature
9
{
10
    public function handle($request, Closure $next)
11
    {
12
        $signature = $request->header('X-Multicoin-Signature');
13
14
        if (! $signature) {
15
            throw WebhookFailed::missingSignature();
16
        }
17
18
        if (! $this->isValid($signature, $request)) {
19
            throw WebhookFailed::invalidSignature($signature);
20
        }
21
22
        return $next($request);
23
    }
24
25
    protected function isValid(string $signature, $request): bool
26
    {
27
        $payload = $request->getContent();
0 ignored issues
show
The assignment to $payload is dead and can be removed.
Loading history...
28
        $secret = config('multicoin.api_key');
29
        if (empty($secret)) {
30
            throw WebhookFailed::signingSecretNotSet();
31
        }
32
        $timestamp = $request->header('timestamp');
33
        $token = $request->header('token');
34
        $computedSignature = hash_hmac('sha256', $token.$timestamp, $secret);
35
36
        return hash_equals($signature, $computedSignature);
37
    }
38
}
39