Skip to content

Commit 07c4671

Browse files
fix(iast): add google.auth to the IAST denylist [backport 2.15] (#11243)
Backport e33e235 from #11240 to 2.15. This fix resolves an issue where importing the ``google.cloud.storage.batch`` module would fail raising an AttributeError ``` File "site-packages/google/auth/crypt/rsa.py", line 22, in <module> RSASigner = _cryptography_rsa.RSASigner ^^^^^^^^^^^^^^^^^^^^^^^^^^^ AttributeError: module 'google.auth.crypt._cryptography_rsa' has no attribute 'RSASigner' ``` tests_packages are working in this branch: https://app.circleci.com/pipelines/github/DataDog/dd-trace-py/76358/workflows/427a6bbc-f088-4779-b6fd-35e8e6f988d5/jobs/4346061 ## Checklist - [x] PR author has checked that all the criteria below are met - The PR description includes an overview of the change - The PR description articulates the motivation for the change - The change includes tests OR the PR description describes a testing strategy - The PR description notes risks associated with the change, if any - Newly-added code is easy to change - The change follows the [library release note guidelines](https://ddtrace.readthedocs.io/en/stable/releasenotes.html) - The change includes or references documentation updates if necessary - Backport labels are set (if [applicable](https://ddtrace.readthedocs.io/en/latest/contributing.html#backporting)) ## Reviewer Checklist - [x] Reviewer has checked that all the criteria below are met - Title is accurate - All changes are related to the pull request's stated goal - Avoids breaking [API](https://ddtrace.readthedocs.io/en/stable/versioning.html#interfaces) changes - Testing strategy adequately addresses listed risks - Newly-added code is easy to change - Release note makes sense to a user of the library - If necessary, author has acknowledged and discussed the performance implications of this PR as reported in the benchmarks PR comment - Backport labels are set in a manner that is consistent with the [release branch maintenance policy](https://ddtrace.readthedocs.io/en/latest/contributing.html#backporting) Co-authored-by: Alberto Vara <[email protected]>
1 parent 76ae70b commit 07c4671

File tree

4 files changed

+15
-2
lines changed

4 files changed

+15
-2
lines changed

ddtrace/appsec/_iast/_ast/ast_patching.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,7 @@
300300
"uvicorn.",
301301
"anyio.",
302302
"httpcore.",
303+
"google.auth.crypt.",
303304
)
304305

305306

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
fixes:
3+
- |
4+
Code Security: This fix resolves an issue where importing the ``google.cloud.storage.batch`` module would fail raising an ImportError

tests/appsec/iast_packages/packages/pkg_google_api_core.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@
99
from .utils import ResultResponse
1010

1111

12+
try:
13+
from google.cloud.storage.batch import Batch # noqa:F401
14+
except ModuleNotFoundError:
15+
pass
16+
17+
1218
pkg_google_api_core = Blueprint("package_google_api_core", __name__)
1319

1420

tests/appsec/iast_packages/test_packages.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ def uninstall(self, python_cmd):
255255
PackageForTesting("fsspec", "2024.5.0", "", "/", ""),
256256
PackageForTesting(
257257
"google-auth",
258-
"2.29.0",
258+
"2.35.0",
259259
"",
260260
"",
261261
"",
@@ -265,12 +265,14 @@ def uninstall(self, python_cmd):
265265
),
266266
PackageForTesting(
267267
"google-api-core",
268-
"2.19.0",
268+
"2.22.0",
269269
"",
270270
"",
271271
"",
272272
import_name="google",
273273
import_module_to_validate="google.auth.iam",
274+
extras=[("google-cloud-storage", "2.18.2")],
275+
test_e2e=True,
274276
),
275277
PackageForTesting(
276278
"google-api-python-client",

0 commit comments

Comments
 (0)