-
Notifications
You must be signed in to change notification settings - Fork 2
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
feat gsn-11659: make logic in line with security hub filtering #27
feat gsn-11659: make logic in line with security hub filtering #27
Conversation
return any(search(pattern, resource) | ||
for resource in self.resource_ids | ||
for pattern in resource_id_patterns) | ||
else: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This else is not needed.
return any(search(pattern, resource) | ||
for resource in self.resource_ids | ||
for pattern in resource_id_patterns) | ||
else: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This else is not needed.
return any(search(pattern, resource) | ||
for resource in self.resource_ids | ||
for pattern in resource_id_patterns) | ||
else: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This else is not needed.
return any(search(pattern, resource) | ||
for resource in self.resource_ids | ||
for pattern in resource_id_patterns) | ||
else: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This else is not needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe this is nicer?
return (
not resource_id_patterns
or any(search(pattern, resource)
for resource in self.resource_ids
for pattern in resource_id_patterns
)
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome!
@@ -311,11 +311,15 @@ def is_matching_resource_ids(self, resource_id_patterns) -> bool: | |||
|
|||
Returns: | |||
True if any match is found, False otherwise. | |||
An empty resource_id_patterns list will always return True, like Security Hub does per resource. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
True if any resource ID matches any pattern, or if patterns list is empty. False otherwise.
return any(search(pattern, resource) | ||
for resource in self.resource_ids | ||
for pattern in resource_id_patterns) | ||
else: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe this is nicer?
return (
not resource_id_patterns
or any(search(pattern, resource)
for resource in self.resource_ids
for pattern in resource_id_patterns
)
)
for rule_tag in rule_tags | ||
for tag in self.tags) | ||
|
||
if rule_tags: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you like the comment above then to make it consistent:
return (
not rule_tags
or any(
tag.get(rule_tag['key']) == rule_tag.get('value')
for rule_tag in rule_tags
for tag in self.tags
)
)
7b46666
to
6400d25
Compare
No description provided.