|
11 | 11 | from routes import url_for |
12 | 12 |
|
13 | 13 | from ddtrace import config |
| 14 | +from ddtrace.appsec.ddwaf import _DDWAF_LOADED |
14 | 15 | from ddtrace.constants import ANALYTICS_SAMPLE_RATE_KEY |
15 | 16 | from ddtrace.constants import ERROR_MSG |
16 | 17 | from ddtrace.constants import ERROR_STACK |
@@ -525,6 +526,7 @@ def test_response_headers(self): |
525 | 526 | assert spans[0].get_tag("http.response.headers.content-length") == "2" |
526 | 527 | assert spans[0].get_tag("http.response.headers.custom-header") == "value" |
527 | 528 |
|
| 529 | + @pytest.mark.skipif(not _DDWAF_LOADED, reason="Test only makes sense when ddwaf is loaded") |
528 | 530 | def test_pylons_cookie_sql_injection(self): |
529 | 531 | with override_global_config(dict(_appsec_enabled=True)), override_env(dict(DD_APPSEC_RULES=RULES_GOOD_PATH)): |
530 | 532 | self.tracer._appsec_enabled = True |
@@ -592,6 +594,7 @@ def test_pylons_request_body_urlencoded_appsec_disabled_then_no_body(self): |
592 | 594 | assert root_span |
593 | 595 | assert not _context.get_item("http.request.body", span=root_span) |
594 | 596 |
|
| 597 | + @pytest.mark.skipif(not _DDWAF_LOADED, reason="Test only makes sense when ddwaf is loaded") |
595 | 598 | def test_pylons_body_urlencoded_attack(self): |
596 | 599 | with self.override_global_config(dict(_appsec_enabled=True)): |
597 | 600 | with override_env(dict(DD_APPSEC_RULES=RULES_GOOD_PATH)): |
@@ -637,6 +640,7 @@ def test_pylons_body_json(self): |
637 | 640 | assert span |
638 | 641 | assert span["mytestingbody_key"] == "mytestingbody_value" |
639 | 642 |
|
| 643 | + @pytest.mark.skipif(not _DDWAF_LOADED, reason="Test only makes sense when ddwaf is loaded") |
640 | 644 | def test_pylons_body_json_attack(self): |
641 | 645 | with self.override_global_config(dict(_appsec_enabled=True)): |
642 | 646 | with override_env(dict(DD_APPSEC_RULES=RULES_GOOD_PATH)): |
@@ -835,6 +839,7 @@ def test_pylon_path_params(self): |
835 | 839 | assert path_params["month"] == "july" |
836 | 840 | assert path_params["year"] == "2022" |
837 | 841 |
|
| 842 | + @pytest.mark.skipif(not _DDWAF_LOADED, reason="Test only makes sense when ddwaf is loaded") |
838 | 843 | def test_pylon_path_params_attack(self): |
839 | 844 | with override_global_config(dict(_appsec_enabled=True)), override_env(dict(DD_APPSEC_RULES=RULES_GOOD_PATH)): |
840 | 845 | self.tracer._appsec_enabled = True |
|
0 commit comments