Skip to content

Commit 8bc9234

Browse files
committed
rename cached forced_protection_off to should_skip_attack_scan
1 parent edab74b commit 8bc9234

File tree

5 files changed

+18
-18
lines changed

5 files changed

+18
-18
lines changed

aikido_zen/context/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ def __init__(self, context_obj=None, body=None, req=None, source=None):
5454
self.headers: Headers = Headers()
5555
self.cookies = dict()
5656
self.query = dict()
57-
self.protection_forced_off = None
57+
self.should_skip_attack_scan = None
5858

5959
# Parse WSGI/ASGI/... request :
6060
self.method = self.remote_address = self.url = None
@@ -139,5 +139,5 @@ def get_route_metadata(self):
139139
def get_user_agent(self):
140140
return self.headers.get_header("USER_AGENT")
141141

142-
def set_force_protection_off(self, value: bool):
143-
self.protection_forced_off = value
142+
def set_should_skip_attack_scan(self, value: bool):
143+
self.should_skip_attack_scan = value

aikido_zen/context/init_test.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ def test_wsgi_context_1():
7272
"outgoing_req_redirects": [],
7373
"executed_middleware": False,
7474
"route_params": [],
75-
"protection_forced_off": None,
75+
"should_skip_attack_scan": None,
7676
}
7777
assert context.get_user_agent() is None
7878

@@ -104,7 +104,7 @@ def test_wsgi_context_2():
104104
"outgoing_req_redirects": [],
105105
"executed_middleware": False,
106106
"route_params": [],
107-
"protection_forced_off": None,
107+
"should_skip_attack_scan": None,
108108
}
109109
assert context.get_user_agent() == "Mozilla/5.0"
110110

@@ -288,11 +288,11 @@ def test_set_valid_json_with_special_characters_bytes():
288288
assert context.body == {"key": "value with special characters !@#$%^&*()"}
289289

290290

291-
def test_set_protection_forced_off():
291+
def test_set_should_skip_attack_scan():
292292
context = Context(req=basic_wsgi_req, body=None, source="flask")
293-
context.set_force_protection_off(True)
294-
assert context.protection_forced_off is True
295-
context.set_force_protection_off(False)
296-
assert context.protection_forced_off is False
297-
context.set_force_protection_off(None)
298-
assert context.protection_forced_off is None
293+
context.set_should_skip_attack_scan(True)
294+
assert context.should_skip_attack_scan is True
295+
context.set_should_skip_attack_scan(False)
296+
assert context.should_skip_attack_scan is False
297+
context.set_should_skip_attack_scan(None)
298+
assert context.should_skip_attack_scan is None

aikido_zen/helpers/should_skip_attack_scan.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ def should_skip_attack_scan(context: Context) -> bool:
1313
if not context:
1414
return False
1515

16-
if context.protection_forced_off is not None:
16+
if context.should_skip_attack_scan is not None:
1717
# Retrieving from cache, we don't want to constantly go through
1818
# all the endpoints for every single vulnerability check.
19-
return context.protection_forced_off
19+
return context.should_skip_attack_scan
2020

2121
thread_cache = get_cache()
2222
if not thread_cache:

aikido_zen/sinks/tests/clickhouse_driver_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ def __init__(self, body):
1717
self.source = "express"
1818
self.route = "/"
1919
self.parsed_userinput = {}
20-
self.protection_forced_off = False
20+
self.should_skip_attack_scan = False
2121

2222

2323
@pytest.fixture(autouse=True)

aikido_zen/vulnerabilities/init_test.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -209,9 +209,9 @@ def test_ssrf_vulnerability_scan_protection_gets_forced_off(get_context):
209209
dns_results = MagicMock()
210210
hostname = "example.com"
211211
port = 80
212-
assert get_context.protection_forced_off is None
212+
assert get_context.should_skip_attack_scan is None
213213
run_vulnerability_scan(kind="ssrf", op="test", args=(dns_results, hostname, port))
214-
assert get_context.protection_forced_off is False
214+
assert get_context.should_skip_attack_scan is False
215215

216216

217217
def test_sql_injection_with_protection_forced_off(caplog, get_context, monkeypatch):
@@ -227,7 +227,7 @@ def test_sql_injection_with_protection_forced_off(caplog, get_context, monkeypat
227227
op="test_op",
228228
args=("INSERT * INTO VALUES ('doggoss2', TRUE);", "mysql"),
229229
)
230-
get_context.set_force_protection_off(True)
230+
get_context.set_should_skip_attack_scan(True)
231231
run_vulnerability_scan(
232232
kind="sql_injection",
233233
op="test_op",

0 commit comments

Comments
 (0)