-
Notifications
You must be signed in to change notification settings - Fork 33
Adding risk data model validation to integration testing #387
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
aca2b3d
adding risk data model validation
cmcginley-splunk 5c0a493
Merge branch 'main' into feature/risk-model-validation
cmcginley-splunk 300e87f
removing some TODOs and adding better logging
cmcginley-splunk 6c1bc7d
Merge branch 'main' into feature/risk-model-validation
pyth0n1c 1ab9b74
Merge branch 'main' into feature/risk-model-validation
pyth0n1c 1c957fc
Merge branch 'main' into feature/risk-model-validation
pyth0n1c 60bef93
Disable logging before merging.
pyth0n1c File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
from abc import ABC, abstractmethod | ||
|
||
from pydantic import BaseModel, ConfigDict | ||
|
||
from contentctl.objects.detection import Detection | ||
|
||
|
||
class BaseSecurityEvent(BaseModel, ABC): | ||
""" | ||
Base event class for a Splunk security event (e.g. risks and notables) | ||
""" | ||
|
||
# The search name (e.g. "ESCU - Windows Modify Registry EnableLinkedConnections - Rule") | ||
search_name: str | ||
|
||
# The search ID that found that generated this event | ||
orig_sid: str | ||
|
||
# Allowing fields that aren't explicitly defined to be passed since some of the risk/notable | ||
# event's fields vary depending on the SPL which generated them | ||
model_config = ConfigDict(extra="allow") | ||
|
||
@abstractmethod | ||
def validate_against_detection(self, detection: Detection) -> None: | ||
""" | ||
Validate this risk/notable event against the given detection | ||
""" | ||
raise NotImplementedError() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,12 @@ | ||
from pydantic import ConfigDict, BaseModel | ||
|
||
from contentctl.objects.base_security_event import BaseSecurityEvent | ||
from contentctl.objects.detection import Detection | ||
|
||
|
||
# TODO (PEX-434): implement deeper notable validation | ||
class NotableEvent(BaseModel): | ||
# The search name (e.g. "ESCU - Windows Modify Registry EnableLinkedConnections - Rule") | ||
search_name: str | ||
|
||
# The search ID that found that generated this risk event | ||
orig_sid: str | ||
|
||
# Allowing fields that aren't explicitly defined to be passed since some of the risk event's | ||
# fields vary depending on the SPL which generated them | ||
model_config = ConfigDict(extra="allow") | ||
class NotableEvent(BaseSecurityEvent): | ||
# TODO (PEX-434): implement deeper notable validation | ||
|
||
def validate_against_detection(self, detection: Detection) -> None: | ||
""" | ||
Validate this risk/notable event against the given detection | ||
""" | ||
raise NotImplementedError() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
[tool.poetry] | ||
name = "contentctl" | ||
|
||
version = "5.3.2" | ||
version = "5.4.0" | ||
|
||
description = "Splunk Content Control Tool" | ||
authors = ["STRT <[email protected]>"] | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.