1 | <?php |
||||
2 | |||||
3 | |||||
4 | namespace ReleaseProtection\Http\Middleware; |
||||
5 | |||||
6 | use Closure; |
||||
7 | |||||
8 | class VerifyFirstPartyClientIp |
||||
9 | { |
||||
10 | |||||
11 | /** |
||||
12 | * Handle an incoming request. |
||||
13 | * |
||||
14 | * @param \Illuminate\Http\Request $request |
||||
15 | * @param Closure $next |
||||
16 | * @param string $type |
||||
17 | * |
||||
18 | * @return mixed |
||||
19 | */ |
||||
20 | 3 | public function handle($request, Closure $next, $type = 'default') |
|||
21 | { |
||||
22 | 3 | $allowIPs = config('release-protection.ip.ips.' . $type, config('release-protection.ip.ips.default')); |
|||
23 | if ( |
||||
24 | 3 | app()->environment( |
|||
0 ignored issues
–
show
introduced
by
![]() |
|||||
25 | 3 | config('release-protection.ip.envs.' . $type, config('release-protection.ip.envs.default')) |
|||
26 | 3 | ) && |
|||
27 | 3 | !in_array($request->ip(), $allowIPs) |
|||
28 | ) { |
||||
29 | 2 | abort( |
|||
30 | 2 | config('release-protection.ip.status.restricted.' . $type, config('release-protection.ip.status.restricted.default')), |
|||
31 | 2 | __(config('release-protection.ip.msg.restricted.' . $type, config('release-protection.ip.msg.restricted.default'))) |
|||
0 ignored issues
–
show
It seems like
__(config('release-prote....restricted.default'))) can also be of type array ; however, parameter $message of abort() does only seem to accept string , maybe add an additional type check?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||
32 | 2 | ); |
|||
33 | } |
||||
34 | |||||
35 | 1 | return $next($request); |
|||
36 | } |
||||
37 | } |
||||
38 |