Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions manifests/cpp_httpd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
manifest:
tests/ai_guard/test_ai_guard_sdk.py::Test_AIGuardEvent_Tag: missing_feature
tests/ai_guard/test_ai_guard_sdk.py::Test_AIGuardStandalone: missing_feature
tests/ai_guard/test_ai_guard_sdk.py::Test_AIGuardStandalone_APMDisabledMarker: missing_feature
tests/ai_guard/test_ai_guard_sdk.py::Test_AIGuardTelemetryRequests: missing_feature
tests/ai_guard/test_ai_guard_sdk.py::Test_AIGuardTelemetryTruncated: missing_feature
tests/ai_guard/test_ai_guard_sdk.py::Test_AnomalyDetectionTags: missing_feature
Expand Down
1 change: 1 addition & 0 deletions manifests/cpp_nginx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
manifest:
tests/ai_guard/test_ai_guard_sdk.py::Test_AIGuardEvent_Tag: missing_feature
tests/ai_guard/test_ai_guard_sdk.py::Test_AIGuardStandalone: missing_feature
tests/ai_guard/test_ai_guard_sdk.py::Test_AIGuardStandalone_APMDisabledMarker: missing_feature
tests/ai_guard/test_ai_guard_sdk.py::Test_AIGuardTelemetryRequests: missing_feature
tests/ai_guard/test_ai_guard_sdk.py::Test_AIGuardTelemetryTruncated: missing_feature
tests/ai_guard/test_ai_guard_sdk.py::Test_AnomalyDetectionTags: missing_feature
Expand Down
1 change: 1 addition & 0 deletions manifests/dotnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
manifest:
tests/ai_guard/test_ai_guard_sdk.py::Test_AIGuardEvent_Tag: missing_feature
tests/ai_guard/test_ai_guard_sdk.py::Test_AIGuardStandalone: missing_feature
tests/ai_guard/test_ai_guard_sdk.py::Test_AIGuardStandalone_APMDisabledMarker: missing_feature
tests/ai_guard/test_ai_guard_sdk.py::Test_AIGuardTelemetryRequests: missing_feature
tests/ai_guard/test_ai_guard_sdk.py::Test_AIGuardTelemetryTruncated: missing_feature
tests/ai_guard/test_ai_guard_sdk.py::Test_AnomalyDetectionTags: missing_feature
Expand Down
1 change: 1 addition & 0 deletions manifests/golang.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
manifest:
tests/ai_guard/test_ai_guard_sdk.py::Test_AIGuardEvent_Tag: missing_feature (APPSEC-62216)
tests/ai_guard/test_ai_guard_sdk.py::Test_AIGuardStandalone: missing_feature
tests/ai_guard/test_ai_guard_sdk.py::Test_AIGuardStandalone_APMDisabledMarker: missing_feature
tests/ai_guard/test_ai_guard_sdk.py::Test_AIGuardTelemetryRequests: missing_feature
tests/ai_guard/test_ai_guard_sdk.py::Test_AIGuardTelemetryTruncated: missing_feature
tests/ai_guard/test_ai_guard_sdk.py::Test_AnomalyDetectionTags: missing_feature
Expand Down
1 change: 1 addition & 0 deletions manifests/java.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ manifest:
- weblog_declaration:
"*": irrelevant (just one weblog is enough to test the SDK)
"spring-boot": v1.65.0-SNAPSHOT
tests/ai_guard/test_ai_guard_sdk.py::Test_AIGuardStandalone_APMDisabledMarker: missing_feature
tests/ai_guard/test_ai_guard_sdk.py::Test_AIGuardTelemetryRequests: missing_feature
tests/ai_guard/test_ai_guard_sdk.py::Test_AIGuardTelemetryTruncated: missing_feature
tests/ai_guard/test_ai_guard_sdk.py::Test_AnomalyDetectionTags:
Expand Down
4 changes: 4 additions & 0 deletions manifests/nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,10 @@ manifest:
- weblog_declaration:
"*": irrelevant (just one weblog is enough to test the SDK)
express4: *ref_5_110_0
tests/ai_guard/test_ai_guard_sdk.py::Test_AIGuardStandalone_APMDisabledMarker:
- weblog_declaration:
"*": irrelevant (just one weblog is enough to test the SDK)
express4: *ref_6_5_0
tests/ai_guard/test_ai_guard_sdk.py::Test_AIGuardTelemetryRequests:
- weblog_declaration:
"*": irrelevant (just one weblog is enough to test the SDK)
Expand Down
1 change: 1 addition & 0 deletions manifests/php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
manifest:
tests/ai_guard/test_ai_guard_sdk.py::Test_AIGuardEvent_Tag: missing_feature
tests/ai_guard/test_ai_guard_sdk.py::Test_AIGuardStandalone: missing_feature
tests/ai_guard/test_ai_guard_sdk.py::Test_AIGuardStandalone_APMDisabledMarker: missing_feature
tests/ai_guard/test_ai_guard_sdk.py::Test_AIGuardTelemetryRequests: missing_feature
tests/ai_guard/test_ai_guard_sdk.py::Test_AIGuardTelemetryTruncated: missing_feature
tests/ai_guard/test_ai_guard_sdk.py::Test_AnomalyDetectionTags: missing_feature
Expand Down
1 change: 1 addition & 0 deletions manifests/python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ manifest:
- weblog_declaration:
"*": irrelevant (just one weblog is enough to test the SDK)
"flask-poc": v4.13.0-dev
tests/ai_guard/test_ai_guard_sdk.py::Test_AIGuardStandalone_APMDisabledMarker: missing_feature
tests/ai_guard/test_ai_guard_sdk.py::Test_AIGuardTelemetryRequests: missing_feature
tests/ai_guard/test_ai_guard_sdk.py::Test_AIGuardTelemetryTruncated: missing_feature
tests/ai_guard/test_ai_guard_sdk.py::Test_AnomalyDetectionTags:
Expand Down
1 change: 1 addition & 0 deletions manifests/ruby.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ manifest:
sinatra32: irrelevant
sinatra41: irrelevant
uds-sinatra: irrelevant
tests/ai_guard/test_ai_guard_sdk.py::Test_AIGuardStandalone_APMDisabledMarker: missing_feature
tests/ai_guard/test_ai_guard_sdk.py::Test_AIGuardTelemetryRequests: missing_feature
tests/ai_guard/test_ai_guard_sdk.py::Test_AIGuardTelemetryTruncated: missing_feature
tests/ai_guard/test_ai_guard_sdk.py::Test_AnomalyDetectionTags:
Expand Down
17 changes: 17 additions & 0 deletions tests/ai_guard/test_ai_guard_sdk.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import json
import math

from tests.appsec.utils import assert_all_spans_have_apm_disabled_marker
from utils import context, interfaces, scenarios, weblog, features, rfc
from utils.dd_constants import TRACE_SOURCE_PROPAGATION_KEY, SamplingMechanism, SamplingPriority, TraceSource
from utils.dd_types import DataDogLibrarySpan, DataDogLibraryTrace, is_same_boolean
Expand Down Expand Up @@ -658,6 +659,22 @@ def test_standalone_keeps_ai_guard_trace(self):
)


@features.ai_guard_standalone
@scenarios.ai_guard_standalone
class Test_AIGuardStandalone_APMDisabledMarker:
"""Every span sent in AI Guard standalone mode carries the APM-disabled billing marker."""

def setup_all_spans_have_apm_disabled_marker(self) -> None:
self.r = weblog.post("/ai_guard/evaluate", headers={BLOCKING_HEADER: "false"}, json=MESSAGES["DENY"])

def test_all_spans_have_apm_disabled_marker(self) -> None:
assert self.r.status_code == 200

spans = [span for _, _, span in interfaces.library.get_spans(request=self.r, full_trace=True)]
assert any(span.get("resource") == "ai_guard" for span in spans), "No ai_guard span found in the trace"
assert_all_spans_have_apm_disabled_marker(spans)


@rfc("https://datadoghq.atlassian.net/wiki/x/54JqiQE")
@features.ai_guard
@scenarios.ai_guard_telemetry
Expand Down
Loading