fix(mutelist): Handle items starting by * (#4136)

This commit is contained in:
Pepe Fagoaga
2024-05-30 15:04:08 +02:00
committed by GitHub
parent 52955f9c6e
commit a51bdef083
2 changed files with 7 additions and 2 deletions
+2 -2
View File
@@ -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
+5
View File
@@ -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")