Skip to content

Commit

Permalink
chore(iast): skip package tests for denylist packages (#11914)
Browse files Browse the repository at this point in the history
  • Loading branch information
gnufede authored and juanjux committed Jan 14, 2025
1 parent 122d4e8 commit 5760821
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 47 deletions.
3 changes: 2 additions & 1 deletion ddtrace/appsec/_iast/_ast/ast_patching.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@
"cycler.",
"cython.",
"dnspython.",
"elasticdeform." "numpy.",
"elasticdeform.",
"numpy.",
"matplotlib.",
"skbase.",
"scipy.",
Expand Down
99 changes: 53 additions & 46 deletions tests/appsec/iast_packages/test_packages.py
Original file line number Diff line number Diff line change
Expand Up @@ -400,16 +400,17 @@ def uninstall(self, python_cmd):
import_module_to_validate="multidict._multidict_py",
test_propagation=True,
),
## Skip due to numpy added to the denylist
# Python 3.12 fails in all steps with "import error" when import numpy
PackageForTesting(
"numpy",
"1.24.4",
"9 8 7 6 5 4 3",
[3, 4, 5, 6, 7, 8, 9],
5,
skip_python_version=[(3, 12)],
import_module_to_validate="numpy.core._internal",
),
# PackageForTesting(
# "numpy",
# "1.24.4",
# "9 8 7 6 5 4 3",
# [3, 4, 5, 6, 7, 8, 9],
# 5,
# skip_python_version=[(3, 12)],
# import_module_to_validate="numpy.core._internal",
# ),
PackageForTesting(
"oauthlib",
"3.2.2",
Expand All @@ -428,8 +429,9 @@ def uninstall(self, python_cmd):
{"is_version_valid": True, "requirement": "example-package>=1.0.0", "specifier": ">=1.0.0", "version": "1.2.3"},
"",
),
## Skip due to pandas added to the denylist
# Pandas dropped Python 3.8 support in pandas>2.0.3
PackageForTesting("pandas", "2.2.2", "foobar", "Written value: foobar", "", skip_python_version=[(3, 8)]),
# PackageForTesting("pandas", "2.2.2", "foobar", "Written value: foobar", "", skip_python_version=[(3, 8)]),
PackageForTesting(
"platformdirs",
"4.2.2",
Expand Down Expand Up @@ -477,15 +479,16 @@ def uninstall(self, python_cmd):
),
# # TODO: patching Pytest fails: ImportError: cannot import name 'Dir' from '_pytest.main'
# PackageForTesting("pytest", "8.2.1", "", "", "", test_e2e=False),
PackageForTesting(
"python-dateutil",
"2.8.2",
"Sat Oct 11 17:13:46 UTC 2003",
"Sat, 11 Oct 2003 17:13:46 GMT",
"And the Easter of that year is: 2004-04-11",
import_name="dateutil",
import_module_to_validate="dateutil.relativedelta",
),
## Skip due to python-dateutil added to the denylist
# PackageForTesting(
# "python-dateutil",
# "2.8.2",
# "Sat Oct 11 17:13:46 UTC 2003",
# "Sat, 11 Oct 2003 17:13:46 GMT",
# "And the Easter of that year is: 2004-04-11",
# import_name="dateutil",
# import_module_to_validate="dateutil.relativedelta",
# ),
PackageForTesting(
"python-multipart",
"0.0.5", # this version validates APPSEC-55240 issue, don't upgrade it
Expand All @@ -498,13 +501,14 @@ def uninstall(self, python_cmd):
test_import=False,
test_propagation=True,
),
PackageForTesting(
"pytz",
"2024.1",
"America/New_York",
"Current time in America/New_York: replaced_time",
"",
),
## Skip due to pytz added to the denylist
# PackageForTesting(
# "pytz",
# "2024.1",
# "America/New_York",
# "Current time in America/New_York: replaced_time",
# "",
# ),
PackageForTesting(
"PyYAML",
"6.0.1",
Expand Down Expand Up @@ -581,7 +585,8 @@ def uninstall(self, python_cmd):
"",
import_module_to_validate="tomlkit.items",
),
PackageForTesting("tqdm", "4.66.4", "", "", "", test_e2e=False, import_module_to_validate="tqdm.std"),
## Skip due to tqdm added to the denylist
# PackageForTesting("tqdm", "4.66.4", "", "", "", test_e2e=False, import_module_to_validate="tqdm.std"),
# Python 3.8 and 3.9 fail with ImportError: cannot import name 'get_host' from 'urllib3.util.url'
PackageForTesting(
"urllib3",
Expand Down Expand Up @@ -660,15 +665,16 @@ def uninstall(self, python_cmd):
"",
skip_python_version=[(3, 6), (3, 7), (3, 8)],
),
PackageForTesting(
"pillow",
"10.3.0",
"Hello, Pillow!",
"Image correctly generated",
"",
import_name="PIL.Image",
skip_python_version=[(3, 6), (3, 7), (3, 8)],
),
## Skip due to pillow added to the denylist
# PackageForTesting(
# "pillow",
# "10.3.0",
# "Hello, Pillow!",
# "Image correctly generated",
# "",
# import_name="PIL.Image",
# skip_python_version=[(3, 6), (3, 7), (3, 8)],
# ),
PackageForTesting(
"aiobotocore", "2.13.0", "", "", "", test_e2e=False, test_import=False, import_name="aiobotocore.session"
),
Expand Down Expand Up @@ -742,16 +748,17 @@ def uninstall(self, python_cmd):
"",
test_e2e=False,
),
# scipy dropped Python 3.8 support in scipy > 1.10.1
PackageForTesting(
"scipy",
"1.13.0",
"1,2,3,4,5",
"Mean: 3.0, Standard Deviation: 1.581",
"",
import_name="scipy.special",
skip_python_version=[(3, 8)],
),
## Skip due to scipy added to the denylist
# # scipy dropped Python 3.8 support in scipy > 1.10.1
# PackageForTesting(
# "scipy",
# "1.13.0",
# "1,2,3,4,5",
# "Mean: 3.0, Standard Deviation: 1.581",
# "",
# import_name="scipy.special",
# skip_python_version=[(3, 8)],
# ),
PackageForTesting(
"iniconfig",
"2.0.0",
Expand Down

0 comments on commit 5760821

Please sign in to comment.