forked from SigmaHQ/pySigma-validators-sigmaHQ
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathauthor.py
More file actions
26 lines (20 loc) · 842 Bytes
/
Copy pathauthor.py
File metadata and controls
26 lines (20 loc) · 842 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
from dataclasses import dataclass
from typing import ClassVar, List
from sigma.correlations import SigmaCorrelationRule
from sigma.rule import SigmaRule
from sigma.validators.base import (
SigmaRuleValidator,
SigmaValidationIssue,
SigmaValidationIssueSeverity,
)
@dataclass
class SigmahqAuthorExistenceIssue(SigmaValidationIssue):
description: ClassVar[str] = "Rule is missing the author field"
severity: ClassVar[SigmaValidationIssueSeverity] = SigmaValidationIssueSeverity.MEDIUM
class SigmahqAuthorExistenceValidator(SigmaRuleValidator):
"""Checks if a rule is missing the author field."""
def validate(self, rule: SigmaRule | SigmaCorrelationRule) -> List[SigmaValidationIssue]:
if rule.author is None:
return [SigmahqAuthorExistenceIssue([rule])]
else:
return []