|
1 | 1 | #!/usr/bin/env python3 |
2 | 2 | from collections import abc |
3 | 3 |
|
4 | | -from ddtrace.appsec.iast._taint_tracking import is_pyobject_tainted |
5 | | -from ddtrace.appsec.iast._taint_tracking import taint_pyobject |
6 | 4 | from ddtrace.internal.logger import get_logger |
7 | 5 |
|
8 | 6 |
|
@@ -32,6 +30,9 @@ def __init__(self, original_list, origins=(0, 0), override_pyobject_tainted=Fals |
32 | 30 | def _taint(self, value): |
33 | 31 | if value: |
34 | 32 | if isinstance(value, (str, bytes, bytearray)): |
| 33 | + from ddtrace.appsec.iast._taint_tracking import is_pyobject_tainted |
| 34 | + from ddtrace.appsec.iast._taint_tracking import taint_pyobject |
| 35 | + |
35 | 36 | if not is_pyobject_tainted(value) or self._override_pyobject_tainted: |
36 | 37 | try: |
37 | 38 | # TODO: migrate this part to shift ranges instead of creating a new one |
@@ -200,6 +201,9 @@ def _taint(self, value, key, origin=None): |
200 | 201 | origin = self._origin_value |
201 | 202 | if value: |
202 | 203 | if isinstance(value, (str, bytes, bytearray)): |
| 204 | + from ddtrace.appsec.iast._taint_tracking import is_pyobject_tainted |
| 205 | + from ddtrace.appsec.iast._taint_tracking import taint_pyobject |
| 206 | + |
203 | 207 | if not is_pyobject_tainted(value) or self._override_pyobject_tainted: |
204 | 208 | try: |
205 | 209 | # TODO: migrate this part to shift ranges instead of creating a new one |
@@ -375,6 +379,8 @@ def supported_dbapi_integration(integration_name): |
375 | 379 |
|
376 | 380 | def check_tainted_args(args, kwargs, tracer, integration_name, method): |
377 | 381 | if supported_dbapi_integration(integration_name) and method.__name__ == "execute": |
| 382 | + from ddtrace.appsec.iast._taint_tracking import is_pyobject_tainted |
| 383 | + |
378 | 384 | return len(args) and args[0] and is_pyobject_tainted(args[0]) |
379 | 385 |
|
380 | 386 | return False |
0 commit comments