Enable Discovery debug logging for production troubleshooting
- Add DISCOVERY_LOG_LEVEL=debug - Add DISCOVERY_SHOW_PROGRESS=true - Temporary changes for debugging InitializerProcessor fixes on production
This commit is contained in:
89
src/Framework/Waf/LayerStatus.php
Normal file
89
src/Framework/Waf/LayerStatus.php
Normal file
@@ -0,0 +1,89 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Framework\Waf;
|
||||
|
||||
/**
|
||||
* Status of a WAF layer analysis result
|
||||
*/
|
||||
enum LayerStatus: string
|
||||
{
|
||||
case CLEAN = 'clean';
|
||||
case THREAT_DETECTED = 'threat_detected';
|
||||
case NEUTRAL = 'neutral';
|
||||
case ERROR = 'error';
|
||||
case SKIPPED = 'skipped';
|
||||
case TIMEOUT = 'timeout';
|
||||
|
||||
/**
|
||||
* Check if status indicates a successful analysis
|
||||
*/
|
||||
public function isSuccessful(): bool
|
||||
{
|
||||
return match ($this) {
|
||||
self::CLEAN,
|
||||
self::THREAT_DETECTED,
|
||||
self::NEUTRAL => true,
|
||||
default => false
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if status indicates an error condition
|
||||
*/
|
||||
public function isError(): bool
|
||||
{
|
||||
return match ($this) {
|
||||
self::ERROR,
|
||||
self::TIMEOUT => true,
|
||||
default => false
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if status indicates a threat was found
|
||||
*/
|
||||
public function isThreat(): bool
|
||||
{
|
||||
return $this === self::THREAT_DETECTED;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if status indicates clean request
|
||||
*/
|
||||
public function isClean(): bool
|
||||
{
|
||||
return $this === self::CLEAN;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get human-readable description
|
||||
*/
|
||||
public function getDescription(): string
|
||||
{
|
||||
return match ($this) {
|
||||
self::CLEAN => 'Request passed all security checks',
|
||||
self::THREAT_DETECTED => 'Security threat detected',
|
||||
self::NEUTRAL => 'Unable to determine threat level',
|
||||
self::ERROR => 'Layer analysis failed',
|
||||
self::SKIPPED => 'Layer analysis was skipped',
|
||||
self::TIMEOUT => 'Layer analysis timed out'
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Get severity level for logging/alerting
|
||||
*/
|
||||
public function getSeverityLevel(): int
|
||||
{
|
||||
return match ($this) {
|
||||
self::CLEAN => 1, // Info
|
||||
self::NEUTRAL => 2, // Notice
|
||||
self::SKIPPED => 3, // Warning
|
||||
self::TIMEOUT => 4, // Error
|
||||
self::ERROR => 5, // Critical
|
||||
self::THREAT_DETECTED => 6 // Alert
|
||||
};
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user