|
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 |
@@ -524,6 +525,7 @@ def test_response_headers(self): |
524 | 525 | assert spans[0].get_tag("http.response.headers.content-length") == "2" |
525 | 526 | assert spans[0].get_tag("http.response.headers.custom-header") == "value" |
526 | 527 |
|
| 528 | + @pytest.mark.skipif(not _DDWAF_LOADED, reason="Test only makes sense when ddwaf is loaded") |
527 | 529 | def test_pylons_cookie_sql_injection(self): |
528 | 530 | with override_global_config(dict(_appsec_enabled=True)), override_env(dict(DD_APPSEC_RULES=RULES_GOOD_PATH)): |
529 | 531 | self.tracer._appsec_enabled = True |
@@ -591,6 +593,7 @@ def test_pylons_request_body_urlencoded_appsec_disabled_then_no_body(self): |
591 | 593 | assert root_span |
592 | 594 | assert not _context.get_item("http.request.body", span=root_span) |
593 | 595 |
|
| 596 | + @pytest.mark.skipif(not _DDWAF_LOADED, reason="Test only makes sense when ddwaf is loaded") |
594 | 597 | def test_pylons_body_urlencoded_attack(self): |
595 | 598 | with self.override_global_config(dict(_appsec_enabled=True)): |
596 | 599 | with override_env(dict(DD_APPSEC_RULES=RULES_GOOD_PATH)): |
@@ -636,6 +639,7 @@ def test_pylons_body_json(self): |
636 | 639 | assert span |
637 | 640 | assert span["mytestingbody_key"] == "mytestingbody_value" |
638 | 641 |
|
| 642 | + @pytest.mark.skipif(not _DDWAF_LOADED, reason="Test only makes sense when ddwaf is loaded") |
639 | 643 | def test_pylons_body_json_attack(self): |
640 | 644 | with self.override_global_config(dict(_appsec_enabled=True)): |
641 | 645 | with override_env(dict(DD_APPSEC_RULES=RULES_GOOD_PATH)): |
@@ -834,6 +838,7 @@ def test_pylon_path_params(self): |
834 | 838 | assert path_params["month"] == "july" |
835 | 839 | assert path_params["year"] == "2022" |
836 | 840 |
|
| 841 | + @pytest.mark.skipif(not _DDWAF_LOADED, reason="Test only makes sense when ddwaf is loaded") |
837 | 842 | def test_pylon_path_params_attack(self): |
838 | 843 | with override_global_config(dict(_appsec_enabled=True)), override_env(dict(DD_APPSEC_RULES=RULES_GOOD_PATH)): |
839 | 844 | self.tracer._appsec_enabled = True |
|
0 commit comments