Skip to content

Commit fbc0586

Browse files
committed
Fix redefined-builtin: filter -> nosql_filter
1 parent 217f058 commit fbc0586

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

aikido_zen/vulnerabilities/nosql_injection/__init__.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,11 @@ def match_filter_part_in_user(user_input, filter_part, path_to_payload=None):
5050
return {"match": False}
5151

5252

53-
def remove_keys_that_dont_start_with_dollar_sign(filter):
53+
def remove_keys_that_dont_start_with_dollar_sign(nosql_filter):
5454
"""
5555
This removes key that don't start with $, since they are not dangerous
5656
"""
57-
return {key: value for key, value in filter.items() if key.startswith("$")}
57+
return {key: value for key, value in nosql_filter.items() if key.startswith("$")}
5858

5959

6060
def find_filter_part_with_operators(user_input, part_of_filter):
@@ -95,17 +95,19 @@ def find_filter_part_with_operators(user_input, part_of_filter):
9595
return {"found": False}
9696

9797

98-
def detect_nosql_injection(request, _filter):
98+
def detect_nosql_injection(request, nosql_filter):
9999
"""
100100
Give a context object and a nosql filter and this function
101101
checks if there is a NoSQL injection
102102
"""
103-
if not is_mapping(_filter) and not isinstance(_filter, list):
103+
if not is_mapping(nosql_filter) and not isinstance(nosql_filter, list):
104104
return {}
105105

106106
for source in UINPUT_SOURCES:
107107
if hasattr(request, source):
108-
result = find_filter_part_with_operators(getattr(request, source), _filter)
108+
result = find_filter_part_with_operators(
109+
getattr(request, source), nosql_filter
110+
)
109111

110112
if result.get("found"):
111113
return {

0 commit comments

Comments
 (0)