Bypass whitelisting if blacklisted

main
Yasen Pramatarov 2025-01-03 18:02:44 +02:00
parent 528f4829af
commit 0a17b947d7
1 changed files with 9 additions and 0 deletions

View File

@ -145,6 +145,15 @@ class RateLimiter {
// Add to whitelist // Add to whitelist
public function addToWhitelist($ip, $isNetwork = false, $description = '', $createdBy = 'system', $userId = null) { public function addToWhitelist($ip, $isNetwork = false, $description = '', $createdBy = 'system', $userId = null) {
try { try {
// Check if IP is blacklisted first
if ($this->isIpBlacklisted($ip)) {
$message = "Cannot whitelist {$ip} - IP is currently blacklisted";
if ($userId) {
$this->log->insertLog($userId, "IP Whitelist: {$message}", 'system');
}
return false;
}
$stmt = $this->db->prepare("INSERT INTO {$this->whitelistTable} $stmt = $this->db->prepare("INSERT INTO {$this->whitelistTable}
(ip_address, is_network, description, created_by) (ip_address, is_network, description, created_by)
VALUES (?, ?, ?, ?) VALUES (?, ?, ?, ?)