Skip to content

Commit 26f4aef

Browse files
committed
Added: bypass flag to skip a rule if user has a high priv user role.
1 parent ebe4fa4 commit 26f4aef

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

src/Processor.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,9 @@ public function launch($mustExit = true)
142142
return true;
143143
}
144144

145+
// Determine if the current request is whitelisted or not (role based).
146+
$isWhitelisted = $this->extension->canBypass();
147+
145148
// Merge the rules together. First iterate through the whitelist rules.
146149
$rules = array_merge($this->whitelistRules, $this->firewallRules);
147150
foreach ($rules as $rule) {
@@ -150,6 +153,11 @@ public function launch($mustExit = true)
150153
continue;
151154
}
152155

156+
// If this rule should respect the whitelist, we check this before we continue.
157+
if (isset($rule['bypass_whitelist']) && ($rule['bypass_whitelist'] === 0 || $rule['bypass_whitelist'] === false) && $isWhitelisted) {
158+
continue;
159+
}
160+
153161
// Transform rule object to array, then execute the firewall rule.
154162
$rule_hit = $this->executeFirewall($rule['rules']);
155163

0 commit comments

Comments
 (0)