Skip to content

Commit

Permalink
Fix various linter issues
Browse files Browse the repository at this point in the history
  • Loading branch information
misje committed May 9, 2024
1 parent 76812dc commit 405d1bb
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 14 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ is optionally created for an incident. Cases help visualise incidents by
providing a graph of all entities involved, starting from the entitiy the
connector was run on, sightings, incidents and enriched entities.


## Screenshots

![Incident response case overview tab](docs/source/images/ir_case_example2_overview1.png)
Expand Down
6 changes: 2 additions & 4 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@

# -- Project information -----------------------------------------------------
project = "opencti-wazuh-connector"
copyright = "2024, Andreas Misje"
copyright = "2024, Andreas Misje" # pylint: disable=redefined-builtin
author = "Andreas Misje"
release = "0.0.1"
release = "0.1.0"
## The full version, including alpha/beta/rc tags
# with open("../../../version.txt", "r") as f:
# release = f.readline().rstrip()
Expand Down Expand Up @@ -89,6 +89,4 @@
),
}

# TODO: gloassary and :term:

sys.path.insert(0, os.path.abspath("../../src"))
20 changes: 11 additions & 9 deletions src/wazuh/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,18 +103,18 @@ class AlertRuleSeverity(int, Enum):
Critical severity
"""

search: SearchConfig = Field(default_factory=lambda: SearchConfig())
search: SearchConfig = Field(default_factory=SearchConfig)
"""
Settings for how searching should be performed
"""
enrich: EnrichmentConfig = Field(default_factory=lambda: EnrichmentConfig())
enrich: EnrichmentConfig = Field(default_factory=EnrichmentConfig)
"""
Settings for what and how to enrich
"""
opensearch: OpenSearchConfig = Field(
default_factory=lambda: OpenSearchConfig.model_validate({})
)
api: WazuhAPIConfig = Field(default_factory=lambda: WazuhAPIConfig())
api: WazuhAPIConfig = Field(default_factory=WazuhAPIConfig)

max_tlp: TLPLiteral
"""
Expand Down Expand Up @@ -497,29 +497,31 @@ def validate_id(cls, ids: Iterable[str]):

@field_validator("max_extrefs_per_alert_rule", mode="after")
@classmethod
def max_ext_refs_below_total_max(cls, max: int | None, info: ValidationInfo):
def max_ext_refs_below_total_max(
cls, max_per_rule: int | None, info: ValidationInfo
):
"""
Ensure that max_extrefs is not below max_extrefs_per_alert_rule
"""
if max > info.data["max_extrefs"]:
if max_per_rule > info.data["max_extrefs"]:
raise ValueError(
"max_extrefs_per_alert_rule must be less or equal to max_extrefs"
)

return max
return max_per_rule

@field_validator("max_notes_per_alert_rule", mode="after")
@classmethod
def max_notes_below_total_max(cls, max: int | None, info: ValidationInfo):
def max_notes_below_total_max(cls, max_per_rule: int | None, info: ValidationInfo):
"""
Ensure that max_notes is not below max_notes_per_alert_rule
"""
if max > info.data["max_notes"]:
if max_per_rule > info.data["max_notes"]:
raise ValueError(
"max_notes_per_alert_rule must be less or equal to max_notes"
)

return max
return max_per_rule

@field_validator("app_url", mode="before")
@classmethod
Expand Down

0 comments on commit 405d1bb

Please sign in to comment.