Conditions | 3 |
Paths | 2 |
Total Lines | 15 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
10 | public function verify(Request $request): bool |
||
11 | { |
||
12 | $processed = $this->process($request->header('Stripe-Signature')); |
||
|
|||
13 | |||
14 | $tolerance = config('shield.services.stripe.tolerance', 60 * 5); |
||
15 | |||
16 | if(($tolerance > 0) && ((time() - $processed['t']) > $tolerance)) { |
||
17 | return false; |
||
18 | } |
||
19 | |||
20 | $payload = $processed['t'] . '.' . $request->getContent(); |
||
21 | $generated = hash_hmac('sha256', $payload, config('shield.services.stripe.token')); |
||
22 | |||
23 | return hash_equals($generated, $processed['v1']); |
||
24 | } |
||
25 | |||
45 |
This check looks at variables that are passed out again to other methods.
If the outgoing method call has stricter type requirements than the method itself, an issue is raised.
An additional type check may prevent trouble.