Domain models and related functionality
Interface
Criterion
dataclass
Criterion()
Bases: ABC
Abstract base class for AWS Security Finding Filter criterion.
Criterions are the individual filter conditions that make up a Filter.
Methods:
-
match–Check if a finding value matches this criterion.
match
abstractmethod
match(finding_value: TInput) -> bool
Check if a finding value matches this criterion.
Parameters:
-
(finding_valueTInput) –The value from the finding to compare against the criterion
Returns:
-
bool–True if the finding_value matches the criterion, False otherwise
Filter
dataclass
Filter(
criterions: tuple[TFilter, ...],
combined_comparison: Callable = any,
)
Bases: ABC
Abstract base class for an AWS Security Finding Filter.
A Filter is made up of one or more single-typed Criterions combined with a logical operation Criterions are more strictly defined than a Filter. Therefore, a filter has a criterion_type attribute to indicate which type of Criterion it contains.
Methods:
-
match–Check if a finding value matches the filter's criterions.
Attributes:
-
criterion_type(type) –The type of criterion this class relates to.
criterion_type
abstractmethod
property
criterion_type: type
The type of criterion this class relates to.
match
match(finding_value: TInput) -> bool
Check if a finding value matches the filter's criterions.
Parameters:
-
(finding_valueTInput) –The value from the finding to compare against the criterions
Returns:
-
bool–True if the finding_value matches the combined criterions, False otherwise
Type-specific models
StringComparisons
StringCriterion
dataclass
StringCriterion(Comparison: str, Value: str)
Bases: _StringLikeCriterion
Dataclass representing a SecurityHub String Criterion.
Parameters:
Methods:
-
__post_init__–Get the comparison function based on the Comparison attribute.
-
match–Check if a string from a finding matches this string criterion.
__post_init__
__post_init__() -> None
Get the comparison function based on the Comparison attribute.
match
match(finding_value: str) -> bool
StringFilter
dataclass
StringFilter(
criterions: tuple[StringCriterion, ...],
combined_comparison: Callable = any,
)
Bases: Filter[str, StringCriterion]
Dataclass representing a SecurityHub StringFilter to be applied on a single finding attribute.
Methods:
-
__post_init__–Initialize the combined comparison function based on the types of criterions.
-
match–Check if a finding value matches the filter's criterions.
__post_init__
__post_init__() -> None
Initialize the combined comparison function based on the types of criterions.
All criterions must be either positive or negative. Raise ValueError if mixed criterions are found.
match
match(finding_value: TInput) -> bool
Check if a finding value matches the filter's criterions.
Parameters:
-
(finding_valueTInput) –The value from the finding to compare against the criterions
Returns:
-
bool–True if the finding_value matches the combined criterions, False otherwise
DateCriterion
dataclass
DateCriterion(
DateRange: dict[str, str] = dict(),
End: str = "",
Start: str = "",
)
Bases: Criterion
Dataclass representing a SecurityHub Date Criterion.
Either DateRange, or Start or End must be specified.
Parameters:
-
(DateRangedict[str, str], default:dict()) –Optionally specify a relative date range with a 'Value' key indicating the number of days
-
(Endstr, default:'') –Optionally specify an absolute end date in ISO format
-
(Startstr, default:'') –Optionally specify an absolute start date in ISO format
Methods:
-
__post_init__–Initialize the date criterion on DateRange or Start/End.
-
match–Check if a datetime string from a finding matches this date criterion.
__post_init__
__post_init__() -> None
Initialize the date criterion on DateRange or Start/End.
match
match(finding_value: str) -> bool
DateFilter
dataclass
DateFilter(
criterions: tuple[DateCriterion, ...],
combined_comparison: Callable = any,
)
Bases: Filter[str, DateCriterion]
Dataclass representing a SecurityHub DateFilter to be applied on a single finding attribute.
Methods:
-
match–Check if a finding value matches the filter's criterions.
match
match(finding_value: TInput) -> bool
Check if a finding value matches the filter's criterions.
Parameters:
-
(finding_valueTInput) –The value from the finding to compare against the criterions
Returns:
-
bool–True if the finding_value matches the combined criterions, False otherwise
NumberComparisons
NumberCriterion
dataclass
NumberCriterion(
Eq: float | None = None,
Gt: float | None = None,
Gte: float | None = None,
Lt: float | None = None,
Lte: float | None = None,
)
Bases: Criterion
Dataclass representing a SecurityHub Number Criterion.
Parameters:
-
(Eqfloat, default:None) –The value to compare for equality
-
(Gtfloat, default:None) –The value to compare for greater than
-
(Gtefloat, default:None) –The value to compare for greater than or equal to
-
(Ltfloat, default:None) –The value to compare for less than
-
(Ltefloat, default:None) –The value to compare for less than or equal to
Methods:
-
__post_init__–Get the comparison functions based on which attributes are set.
-
match–Check if a number from a finding matches this number criterion.
__post_init__
__post_init__() -> None
Get the comparison functions based on which attributes are set.
match
match(finding_value: float) -> bool
NumberFilter
dataclass
NumberFilter(
criterions: tuple[NumberCriterion, ...],
combined_comparison: Callable = any,
)
Bases: Filter[float, NumberCriterion]
Dataclass representing a SecurityHub NumberFilter to be applied on a single finding attribute.
Methods:
-
match–Check if a finding value matches the filter's criterions.
match
match(finding_value: TInput) -> bool
Check if a finding value matches the filter's criterions.
Parameters:
-
(finding_valueTInput) –The value from the finding to compare against the criterions
Returns:
-
bool–True if the finding_value matches the combined criterions, False otherwise
MapStringComparisons
MapCriterion
dataclass
MapCriterion(Comparison: str, Value: str, Key: str)
Bases: _StringLikeCriterion
Dataclass representing a SecurityHub Map Criterion.
Parameters:
-
(Comparisonstr) –The comparison operation to use
-
(Keystr) –The key in the map to compare against
-
(Valuestr) –The value to compare against
Methods:
-
__post_init__–Get the comparison function based on the Comparison attribute.
-
match–Check if a string from a map in the finding matches this string criterion.
__post_init__
__post_init__() -> None
Get the comparison function based on the Comparison attribute.
MapFilter
dataclass
MapFilter(
criterions: tuple[MapCriterion, ...],
combined_comparison: Callable = any,
)
Bases: Filter[dict[str, str], MapCriterion]
Dataclass representing a SecurityHub MapFilter to be applied on a single finding attribute.
Methods:
-
__post_init__–Initialize the combined comparison function based on the types of criterions.
-
match–Check if a finding value matches the filter's criterions.
__post_init__
__post_init__() -> None
Initialize the combined comparison function based on the types of criterions.
All criterions must be either positive or negative. Raise ValueError if mixed criterions are found.
match
match(finding_value: TInput) -> bool
Check if a finding value matches the filter's criterions.
Parameters:
-
(finding_valueTInput) –The value from the finding to compare against the criterions
Returns:
-
bool–True if the finding_value matches the combined criterions, False otherwise
CidrCriterion
dataclass
CidrCriterion(Cidr: str = '')
CidrFilter
dataclass
CidrFilter(
criterions: tuple[CidrCriterion, ...],
combined_comparison: Callable = any,
)
Bases: Filter[str, CidrCriterion]
Dataclass representing a SecurityHub CidrFilter to be applied on a single finding attribute.
Methods:
-
match–Check if a finding value matches the filter's criterions.
match
match(finding_value: TInput) -> bool
Check if a finding value matches the filter's criterions.
Parameters:
-
(finding_valueTInput) –The value from the finding to compare against the criterions
Returns:
-
bool–True if the finding_value matches the combined criterions, False otherwise
Factory utilities
Public functions
create_filters
create_filters(
filters_dicts: list[dict[str, Any]],
) -> Filter
Create an AwsSecurityFindingFilters instance from a list of filters dicts.
Filters dicts must all correspond to the same AwsSecurityFindingFilters type.
Parameters:
-
(filters_dictslist[dict[str, Any]]) –The filters dicts to create the AwsSecurityFindingFilters instance from
Returns:
-
Filter–The created AwsSecurityFindingFilters instance