Skip to content

Commit 6e0311e

Browse files
fix(aap): disabling threats grpc monitoring [backport 3.14] (#14579)
Backport 5fe1c16 from #14563 to 3.14. grpc threats monitoring is currently under tested, and could lead to false positive (internal incident 42958). This PR disable grpc auto instrumentation for threats. It also skip one test (this test in an iast test suite is in fact a grpc threat test) Related PR: #9705 APPSEC-58876 ## 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: Christophe Papazian <[email protected]>
1 parent 8e61161 commit 6e0311e

File tree

4 files changed

+9
-3
lines changed

4 files changed

+9
-3
lines changed

ddtrace/appsec/_handlers.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -427,8 +427,9 @@ def listen():
427427
core.on("aws_lambda.start_response", _on_lambda_start_response)
428428
core.on("aws_lambda.parse_body", _on_lambda_parse_body)
429429

430-
core.on("grpc.server.response.message", _on_grpc_server_response)
431-
core.on("grpc.server.data", _on_grpc_server_data)
430+
# disabling threats grpc listeners.
431+
# core.on("grpc.server.response.message", _on_grpc_server_response)
432+
# core.on("grpc.server.data", _on_grpc_server_data)
432433

433434
core.on("wsgi.block.started", _wsgi_make_block_content, "status_headers_content")
434435
core.on("asgi.block.started", _asgi_make_block_content, "status_headers_content")

ddtrace/settings/asm.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ class ASMConfig(DDConfig):
7171
# prevent empty string
7272
if _asm_static_rule_file == "":
7373
_asm_static_rule_file = None
74-
_asm_processed_span_types = {SpanTypes.WEB, SpanTypes.GRPC}
74+
_asm_processed_span_types = {SpanTypes.WEB}
7575
_asm_http_span_types = {SpanTypes.WEB}
7676
_iast_enabled = tracer_config._from_endpoint.get("iast_enabled", DDConfig.var(bool, IAST.ENV, default=False))
7777
_iast_propagation_enabled = DDConfig.var(bool, IAST.ENV_PROPAGATION_ENABLED, default=True, private=True)
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
fixes:
3+
- |
4+
AAP: This fix disables grpc threat monitoring, as it could generate false positives.

tests/appsec/iast/test_grpc_iast.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ class MyUserDict(UserDict):
145145

146146
_custom_protobuf_getattribute(mutable_mapping, "data")
147147

148+
@pytest.mark.skip
148149
def test_address_server_data(self):
149150
with override_config("grpc", dict(service_name="myclientsvc")), override_config(
150151
"grpc_server", dict(service_name="myserversvc")

0 commit comments

Comments
 (0)