You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The `\aikido\should_whitelist_request` function allows the protected app to check whether the current request is whitelisted based on IP configuration. This can be used to skip custom security checks or apply special handling for requests coming from trusted or configured IPs.
|`whitelisted`| bool | Whether the request is whitelisted. Defaults to `false`. |
16
+
|`type`| string | The type of whitelist that matched. Empty string if not whitelisted.|
17
+
|`trigger`| string | What triggered the whitelist (e.g., `"ip"`). Empty if not whitelisted. |
18
+
|`description`| string | A human-readable description of why the request is whitelisted. |
19
+
|`ip`| string | The IP address of the request. Empty if not whitelisted. |
20
+
21
+
## Whitelist types
22
+
23
+
The function checks three conditions in order. The first match wins:
24
+
25
+
1.**`endpoint-allowlist`** — The endpoint has a route-level IP allowlist configured and the request IP is in it. This indicates that IP-based access control is active for this route.
26
+
2.**`bypassed`** — The request IP is in the global firewall bypass list.
27
+
3.**`allowlist`** — The request IP is found in the global allowed IP list (e.g., geo-location allow lists).
28
+
29
+
If none of the above conditions match, `whitelisted` is `false` and all other fields are empty strings.
30
+
31
+
## Example
32
+
33
+
```php
34
+
<?php
35
+
36
+
if (extension_loaded('aikido')) {
37
+
$decision = \aikido\should_whitelist_request();
38
+
39
+
if ($decision->whitelisted) {
40
+
// The request is whitelisted — skip custom security checks
41
+
// $decision->type contains the reason: "endpoint-allowlist", "bypassed", or "allowlist"
42
+
// $decision->description has a human-readable explanation
0 commit comments