Skip to content

Commit 61f8684

Browse files
committed
Firewall excludes
1 parent a2a9e34 commit 61f8684

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
lines changed

config/firewall.php

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,19 @@
3030
'backdoor' => env('MOOX_FIREWALL_BACKDOOR', true),
3131

3232
// Backdoor bypass token
33-
'backdoor_token' => env('MOOX_FIREWALL_BACKDOOR_TOKEN', 'let-me-in'),
33+
'backdoor_token' => env('MOOX_FIREWALL_BACKDOOR_TOKEN', 'v4a'),
3434

3535
// Firewall page message
3636
'message' => env('MOOX_FIREWALL_MESSAGE', 'Moox Firewall'),
3737

38+
// Firewall page description
39+
'description' => env('MOOX_FIREWALL_DESCRIPTION', 'Please enter your access token to continue.'),
40+
3841
// Firewall page color, currently hex, will be Tailwind color in the future
3942
'color' => env('MOOX_FIREWALL_COLOR', 'darkblue'),
4043

41-
// Firewall page description
42-
'description' => env('MOOX_FIREWALL_DESCRIPTION', 'Please enter your access token to continue.'),
44+
// Exclude routes from firewall
45+
'exclude' => [
46+
'api/expiries/*',
47+
],
4348
];

src/Listeners/FirewallListener.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,14 @@ public function handle(RouteMatched $event)
2222
'ip' => $request->ip(),
2323
]);
2424

25+
$excludedRoutes = $config['exclude'] ?? [];
26+
27+
foreach ($excludedRoutes as $pattern) {
28+
if ($request->is($pattern)) {
29+
return;
30+
}
31+
}
32+
2533
if (in_array($request->ip(), $config['whitelist'] ?? [])) {
2634
return;
2735
}

0 commit comments

Comments
 (0)