mirror of
https://github.com/prowler-cloud/prowler.git
synced 2026-07-23 20:42:02 +00:00
fix(mutelist): Handle items starting by * (#4136)
This commit is contained in:
@@ -362,8 +362,8 @@ def __is_item_matched__(matched_items, finding_items):
|
||||
is_item_matched = False
|
||||
if matched_items and (finding_items or finding_items == ""):
|
||||
for item in matched_items:
|
||||
if item == "*":
|
||||
item = ".*"
|
||||
if item.startswith("*"):
|
||||
item = ".*" + item[1:]
|
||||
if re.search(item, finding_items):
|
||||
is_item_matched = True
|
||||
break
|
||||
|
||||
@@ -1323,3 +1323,8 @@ class TestMutelist:
|
||||
assert is_muted_in_resource(mutelist_resources, "prowler-test")
|
||||
assert is_muted_in_resource(mutelist_resources, "test-prowler")
|
||||
assert not is_muted_in_resource(mutelist_resources, "random")
|
||||
|
||||
def test_is_muted_in_resource_starting_by_star(self):
|
||||
allowlist_resources = ["*.es"]
|
||||
|
||||
assert is_muted_in_resource(allowlist_resources, "google.es")
|
||||
|
||||
Reference in New Issue
Block a user