Skip to content

Commit 4818e03

Browse files
committed
Merge remote-tracking branch 'origin/master' into typo/evaluator-type-mismatch
2 parents 4ceae78 + 9f89a0b commit 4818e03

File tree

124 files changed

+2106
-621
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

124 files changed

+2106
-621
lines changed

.github/dependabot.yml

Lines changed: 36 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,38 @@
1+
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
12
version: 2
23
updates:
3-
- package-ecosystem: github-actions
4-
directory: /
5-
schedule:
6-
interval: weekly
7-
labels:
8-
- 'comp: tooling'
9-
- 'tag: dependencies'
10-
- 'tag: no release notes'
11-
commit-message:
12-
prefix: 'chore(ci): '
13-
groups:
14-
gh-actions-packages:
15-
patterns:
16-
- '*'
17-
cooldown:
18-
default-days: 14
19-
- package-ecosystem: gradle
20-
directory: /
21-
schedule:
22-
interval: weekly
23-
allow:
24-
- dependency-name: gradle
25-
ignore:
26-
- dependency-name: gradle
27-
update-types:
28-
- version-update:semver-major
29-
labels:
30-
- 'comp: tooling'
31-
- 'tag: dependencies'
32-
- 'tag: no release notes'
33-
commit-message:
34-
prefix: 'chore(build): '
35-
cooldown:
36-
default-days: 14
4+
- package-ecosystem: github-actions
5+
directory: /
6+
schedule:
7+
interval: weekly
8+
labels:
9+
- 'comp: tooling'
10+
- 'tag: dependencies'
11+
- 'tag: no release notes'
12+
commit-message:
13+
prefix: 'chore(ci): '
14+
groups:
15+
gh-actions-packages:
16+
patterns:
17+
- '*'
18+
cooldown:
19+
default-days: 2
20+
21+
- package-ecosystem: gradle
22+
directory: /
23+
schedule:
24+
interval: weekly
25+
allow:
26+
- dependency-name: gradle
27+
ignore:
28+
- dependency-name: gradle
29+
update-types:
30+
- version-update:semver-major
31+
labels:
32+
- 'comp: tooling'
33+
- 'tag: dependencies'
34+
- 'tag: no release notes'
35+
commit-message:
36+
prefix: 'chore(build): '
37+
cooldown:
38+
default-days: 2

.github/workflows/analyze-changes.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
with:
2121
submodules: 'recursive'
2222
- name: Cache Gradle dependencies
23-
uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3
23+
uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4
2424
with:
2525
path: |
2626
~/.gradle/caches
@@ -30,7 +30,7 @@ jobs:
3030
${{ runner.os }}-gradle-
3131
3232
- name: Initialize CodeQL
33-
uses: github/codeql-action/init@b1bff81932f5cdfc8695c7752dcee935dcd061c8 # v4.33.0
33+
uses: github/codeql-action/init@c10b8064de6f491fea524254123dbe5e09572f13 # v4.35.1
3434
with:
3535
languages: 'java'
3636
build-mode: 'manual'
@@ -43,7 +43,7 @@ jobs:
4343
./gradlew clean :dd-java-agent:shadowJar --build-cache --parallel --stacktrace --no-daemon --max-workers=4
4444
4545
- name: Perform CodeQL Analysis and upload results to GitHub Security tab
46-
uses: github/codeql-action/analyze@b1bff81932f5cdfc8695c7752dcee935dcd061c8 # v4.33.0
46+
uses: github/codeql-action/analyze@c10b8064de6f491fea524254123dbe5e09572f13 # v4.35.1
4747

4848
trivy:
4949
name: Analyze changes with Trivy
@@ -60,7 +60,7 @@ jobs:
6060
submodules: 'recursive'
6161

6262
- name: Cache Gradle dependencies
63-
uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3
63+
uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4
6464
with:
6565
path: |
6666
~/.gradle/caches
@@ -102,7 +102,7 @@ jobs:
102102
TRIVY_JAVA_DB_REPOSITORY: ghcr.io/aquasecurity/trivy-java-db,public.ecr.aws/aquasecurity/trivy-java-db
103103

104104
- name: Upload Trivy scan results to GitHub Security tab
105-
uses: github/codeql-action/upload-sarif@b1bff81932f5cdfc8695c7752dcee935dcd061c8 # v4.33.0
105+
uses: github/codeql-action/upload-sarif@c10b8064de6f491fea524254123dbe5e09572f13 # v4.35.1
106106
if: always()
107107
with:
108108
sarif_file: 'trivy-results.sarif'

.github/workflows/run-system-tests.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
fetch-depth: 0
3131

3232
- name: Cache Gradle dependencies
33-
uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3
33+
uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4
3434
with:
3535
path: |
3636
~/.gradle/caches

communication/gradle.lockfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ com.thoughtworks.qdox:qdox:1.12.1=codenarc
3636
commons-fileupload:commons-fileupload:1.5=testCompileClasspath,testRuntimeClasspath
3737
commons-io:commons-io:2.11.0=testCompileClasspath,testRuntimeClasspath
3838
commons-io:commons-io:2.20.0=spotbugs
39-
de.thetaphi:forbiddenapis:3.10=compileClasspath
39+
de.thetaphi:forbiddenapis:3.10=compileClasspath,testCompileClasspath,testRuntimeClasspath
4040
io.leangen.geantyref:geantyref:1.3.16=testRuntimeClasspath
4141
jaxen:jaxen:2.0.0=spotbugs
4242
junit:junit:4.12=testCompileClasspath,testRuntimeClasspath

dd-java-agent/agent-aiguard/gradle.lockfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ com.vaadin.external.google:android-json:0.0.20131108.vaadin1=testCompileClasspat
3636
commons-fileupload:commons-fileupload:1.5=testCompileClasspath,testRuntimeClasspath
3737
commons-io:commons-io:2.11.0=testCompileClasspath,testRuntimeClasspath
3838
commons-io:commons-io:2.20.0=spotbugs
39-
de.thetaphi:forbiddenapis:3.10=compileClasspath
39+
de.thetaphi:forbiddenapis:3.10=compileClasspath,testCompileClasspath,testRuntimeClasspath
4040
io.leangen.geantyref:geantyref:1.3.16=testRuntimeClasspath
4141
jaxen:jaxen:2.0.0=spotbugs
4242
net.bytebuddy:byte-buddy-agent:1.18.3=testCompileClasspath,testRuntimeClasspath

dd-java-agent/agent-aiguard/src/main/java/com/datadog/aiguard/AIGuardInternal.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ public BadConfigurationException(final String message) {
7373
static final String META_STRUCT_MESSAGES = "messages";
7474
static final String META_STRUCT_CATEGORIES = "attack_categories";
7575
static final String META_STRUCT_SDS = "sds";
76+
static final String META_STRUCT_TAG_PROBS = "tag_probs";
7677

7778
public static void install() {
7879
final Config config = Config.get();
@@ -258,13 +259,18 @@ public Evaluation evaluate(final List<Message> messages, final Options options)
258259
final List<String> tags = (List<String>) result.get("tags");
259260
@SuppressWarnings("unchecked")
260261
final List<?> sdsFindings = (List<?>) result.get("sds_findings");
262+
@SuppressWarnings("unchecked")
263+
final Map<String, Number> tagProbs = (Map<String, Number>) result.get("tag_probs");
261264
span.setTag(ACTION_TAG, action);
262265
if (reason != null) {
263266
span.setTag(REASON_TAG, reason);
264267
}
265268
if (tags != null && !tags.isEmpty()) {
266269
metaStruct.put(META_STRUCT_CATEGORIES, tags);
267270
}
271+
if (tagProbs != null && !tagProbs.isEmpty()) {
272+
metaStruct.put(META_STRUCT_TAG_PROBS, tagProbs);
273+
}
268274
if (sdsFindings != null && !sdsFindings.isEmpty()) {
269275
metaStruct.put(META_STRUCT_SDS, sdsFindings);
270276
}
@@ -273,9 +279,9 @@ public Evaluation evaluate(final List<Message> messages, final Options options)
273279
WafMetricCollector.get().aiGuardRequest(action, shouldBlock);
274280
if (shouldBlock) {
275281
span.setTag(BLOCKED_TAG, true);
276-
throw new AIGuardAbortError(action, reason, tags, sdsFindings);
282+
throw new AIGuardAbortError(action, reason, tags, tagProbs, sdsFindings);
277283
}
278-
return new Evaluation(action, reason, tags, sdsFindings);
284+
return new Evaluation(action, reason, tags, tagProbs, sdsFindings);
279285
}
280286
} catch (AIGuardAbortError e) {
281287
span.addThrowable(e);

dd-java-agent/agent-aiguard/src/test/groovy/com/datadog/aiguard/AIGuardInternalTests.groovy

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ class AIGuardInternalTests extends DDSpecification {
168168
return mockResponse(
169169
request,
170170
200,
171-
[data: [attributes: [action: suite.action, reason: suite.reason, tags: suite.tags ?: [], is_blocking_enabled: suite.blocking]]]
171+
[data: [attributes: [action: suite.action, reason: suite.reason, tags: suite.tags ?: [], tag_probs: suite.tagProbabilities ?: [:], is_blocking_enabled: suite.blocking]]]
172172
)
173173
}
174174
}
@@ -210,12 +210,14 @@ class AIGuardInternalTests extends DDSpecification {
210210
error.action == suite.action
211211
error.reason == suite.reason
212212
error.tags == suite.tags
213+
error.tagProbabilities == suite.tagProbabilities
213214
error.sds == []
214215
} else {
215216
error == null
216217
eval.action == suite.action
217218
eval.reason == suite.reason
218219
eval.tags == suite.tags
220+
eval.tagProbabilities == suite.tagProbabilities
219221
eval.sds == []
220222
}
221223
assertTelemetry('ai_guard.requests', "action:$suite.action", "block:$throwAbortError", 'error:false')
@@ -555,6 +557,9 @@ class AIGuardInternalTests extends DDSpecification {
555557
if (suite.tags) {
556558
assert meta.attack_categories == suite.tags
557559
}
560+
if (suite.tagProbabilities) {
561+
assert meta.tag_probs == suite.tagProbabilities
562+
}
558563
final receivedMessages = snakeCaseJson(meta.messages)
559564
final expectedMessages = snakeCaseJson(suite.messages)
560565
JSONAssert.assertEquals(expectedMessages, receivedMessages, JSONCompareMode.NON_EXTENSIBLE)
@@ -774,15 +779,17 @@ class AIGuardInternalTests extends DDSpecification {
774779
private final AIGuard.Action action
775780
private final String reason
776781
private final List<String> tags
782+
private final Map<String, Double> tagProbabilities
777783
private final boolean blocking
778784
private final String description
779785
private final String target
780786
private final List<AIGuard.Message> messages
781787

782-
TestSuite(AIGuard.Action action, String reason, List<String> tags, boolean blocking, String description, String target, List<AIGuard.Message> messages) {
788+
TestSuite(AIGuard.Action action, String reason, Map<String, Double> tagProbabilities, boolean blocking, String description, String target, List<AIGuard.Message> messages) {
783789
this.action = action
784790
this.reason = reason
785-
this.tags = tags
791+
this.tags = new ArrayList<>(tagProbabilities.keySet())
792+
this.tagProbabilities = tagProbabilities
786793
this.blocking = blocking
787794
this.description = description
788795
this.target = target
@@ -791,9 +798,9 @@ class AIGuardInternalTests extends DDSpecification {
791798

792799
static List<TestSuite> build() {
793800
def actionValues = [
794-
[ALLOW, 'Go ahead', []],
795-
[DENY, 'Nope', ['deny_everything', 'test_deny']],
796-
[ABORT, 'Kill it with fire', ['alarm_tag', 'abort_everything']]
801+
[ALLOW, 'Go ahead', [:]],
802+
[DENY, 'Nope', ['deny_everything': 0.2D, 'test_deny': 0.8D]],
803+
[ABORT, 'Kill it with fire', ['alarm_tag': 0.1D, 'abort_everything': 0.9D]]
797804
]
798805
def blockingValues = [true, false]
799806
def suiteValues = [

dd-java-agent/agent-bootstrap/gradle.lockfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ com.thoughtworks.qdox:qdox:1.12.1=codenarc
3939
commons-fileupload:commons-fileupload:1.5=jmhRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
4040
commons-io:commons-io:2.11.0=jmhRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
4141
commons-io:commons-io:2.20.0=spotbugs
42-
de.thetaphi:forbiddenapis:3.10=compileClasspath,jmhCompileClasspath
42+
de.thetaphi:forbiddenapis:3.10=compileClasspath,jmhCompileClasspath,jmhRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
4343
io.leangen.geantyref:geantyref:1.3.16=jmhRuntimeClasspath,testRuntimeClasspath
4444
io.sqreen:libsqreen:17.3.0=jmhRuntimeClasspath,testRuntimeClasspath
4545
javax.servlet:javax.servlet-api:3.1.0=jmhRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
@@ -109,8 +109,8 @@ org.ow2.asm:asm-tree:9.9=jacocoAnt,spotbugs
109109
org.ow2.asm:asm-util:9.7.1=jmhRuntimeClasspath,testRuntimeClasspath
110110
org.ow2.asm:asm-util:9.9=spotbugs
111111
org.ow2.asm:asm:9.0=jmh,jmhCompileClasspath
112-
org.ow2.asm:asm:9.7.1=jmhRuntimeClasspath,testRuntimeClasspath
113112
org.ow2.asm:asm:9.9=jacocoAnt,spotbugs
113+
org.ow2.asm:asm:9.9.1=jmhRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
114114
org.slf4j:jcl-over-slf4j:1.7.30=jmhRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
115115
org.slf4j:jul-to-slf4j:1.7.30=jmhRuntimeClasspath,testCompileClasspath,testRuntimeClasspath
116116
org.slf4j:log4j-over-slf4j:1.7.30=jmhRuntimeClasspath,testCompileClasspath,testRuntimeClasspath

dd-java-agent/agent-bootstrap/src/test/groovy/datadog/trace/bootstrap/instrumentation/decorator/BaseDecoratorTest.groovy

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,16 @@ import datadog.trace.bootstrap.instrumentation.api.AgentSpan
55
import datadog.trace.bootstrap.instrumentation.api.AgentSpanContext
66
import datadog.trace.bootstrap.instrumentation.api.ErrorPriorities
77
import datadog.trace.bootstrap.instrumentation.api.Tags
8+
import datadog.trace.config.inversion.ConfigHelper
89
import datadog.trace.test.util.DDSpecification
910
import spock.lang.Shared
1011

1112
class BaseDecoratorTest extends DDSpecification {
1213

14+
def setupSpec() {
15+
ConfigHelper.get().setConfigInversionStrict(ConfigHelper.StrictnessPolicy.TEST)
16+
}
17+
1318
@Shared
1419
def decorator = newDecorator()
1520

dd-java-agent/agent-ci-visibility/civisibility-instrumentation-test-fixtures/gradle.lockfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ com.vaadin.external.google:android-json:0.0.20131108.vaadin1=compileClasspath,ru
4343
commons-fileupload:commons-fileupload:1.5=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
4444
commons-io:commons-io:2.11.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
4545
commons-io:commons-io:2.20.0=spotbugs
46-
de.thetaphi:forbiddenapis:3.10=compileClasspath
46+
de.thetaphi:forbiddenapis:3.10=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
4747
io.leangen.geantyref:geantyref:1.3.16=testRuntimeClasspath
4848
io.sqreen:libsqreen:17.3.0=runtimeClasspath,testRuntimeClasspath
4949
javax.servlet:javax.servlet-api:3.1.0=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
@@ -111,7 +111,7 @@ org.ow2.asm:asm-tree:9.9.1=runtimeClasspath,testRuntimeClasspath
111111
org.ow2.asm:asm-util:9.7.1=runtimeClasspath,testRuntimeClasspath
112112
org.ow2.asm:asm-util:9.9=spotbugs
113113
org.ow2.asm:asm:9.9=jacocoAnt,spotbugs
114-
org.ow2.asm:asm:9.9.1=runtimeClasspath,testRuntimeClasspath
114+
org.ow2.asm:asm:9.9.1=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
115115
org.skyscreamer:jsonassert:1.5.1=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
116116
org.slf4j:jcl-over-slf4j:1.7.30=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath
117117
org.slf4j:jul-to-slf4j:1.7.30=compileClasspath,runtimeClasspath,testCompileClasspath,testRuntimeClasspath

0 commit comments

Comments
 (0)