Skip to content

Commit ca57d56

Browse files
authored
Merge branch 'master' into smola/revert-pr-6610
2 parents 3ccf85e + 4ff3736 commit ca57d56

File tree

27 files changed

+556
-72
lines changed

27 files changed

+556
-72
lines changed

dd-java-agent/agent-tooling/src/main/resources/datadog/trace/agent/tooling/bytebuddy/matcher/ignored_class_name.trie

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,7 @@
258258
0 org.springframework.beans.factory.support.AbstractBeanFactory
259259
0 org.springframework.beans.factory.support.DefaultListableBeanFactory
260260
0 org.springframework.beans.factory.support.DisposableBeanAdapter
261+
0 org.springframework.boot.SpringApplicationRunListeners
261262
1 org.springframework.boot.SpringApplicationShutdownHook$Handlers
262263
1 org.springframework.boot.autoconfigure.ssl.FileWatcher$WatcherThread
263264
2 org.springframework.boot.*
@@ -274,6 +275,8 @@
274275
0 org.springframework.boot.web.embedded.tomcat.TomcatWebServer$1
275276
0 org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext
276277
0 org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext
278+
0 org.springframework.boot.web.servlet.support.SpringBootServletInitializer
279+
0 org.springframework.boot.web.support.SpringBootServletInitializer
277280
2 org.springframework.cache.*
278281
2 org.springframework.cglib.*
279282
# LoadingCache.createEntry constructs FutureTasks which it executes synchronously,

dd-java-agent/instrumentation/akka-http-10.0/src/iastTest/groovy/datadog/trace/instrumentation/akkahttp/iast/IastAkkaTest.groovy

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import spock.lang.Shared
1313
import java.nio.charset.StandardCharsets
1414

1515
import static org.hamcrest.Matchers.greaterThan
16-
import static org.hamcrest.Matchers.nullValue
1716

1817
class IastAkkaTest extends IastRequestTestRunner {
1918
@Shared
@@ -340,7 +339,7 @@ class IastAkkaTest extends IastRequestTestRunner {
340339
then:
341340
toc.hasTaintedObject {
342341
value 'var1=foo&var1=bar&var2=a+b+c'
343-
range 0, 28, source(SourceTypes.REQUEST_QUERY, null, null)
342+
range 0, 28, source(SourceTypes.REQUEST_QUERY, null, 'var1=foo&var1=bar&var2=a+b+c')
344343
}
345344
toc.hasTaintedObject {
346345
value 'var1'
@@ -486,14 +485,16 @@ class IastAkkaTest extends IastRequestTestRunner {
486485
}
487486

488487
void 'json request — #variant variant'() {
488+
given:
489+
final json = '''{
490+
"var1": "foo",
491+
"var2": ["foo2", "foo2"]
492+
}'''
493+
489494
when:
490495
String url = buildUrl "iast/$variant"
491496
def request = new Builder().url(url).post(
492-
RequestBody.create(MediaType.get("application/json"), '''{
493-
"var1": "foo",
494-
"var2": ["foo2", "foo2"]
495-
}'''.getBytes(StandardCharsets.US_ASCII))
496-
).build()
497+
RequestBody.create(MediaType.get("application/json"), json.getBytes(StandardCharsets.US_ASCII))).build()
497498
def response = client.newCall(request).execute()
498499
def respBody = response.body().string()
499500

@@ -505,21 +506,22 @@ class IastAkkaTest extends IastRequestTestRunner {
505506
def toc = finReqTaintedObjects
506507

507508
then:
509+
// source values take the value of the full body as it's converted to string at TaintFutureHelper
508510
toc.hasTaintedObject {
509511
value 'var1'
510-
range 0, 4, source(SourceTypes.REQUEST_BODY, 'var1', nullValue())
512+
range 0, 4, source(SourceTypes.REQUEST_BODY, 'var1', json)
511513
}
512514
toc.hasTaintedObject {
513515
value 'var2'
514-
range 0, 4, source(SourceTypes.REQUEST_BODY, 'var2', nullValue())
516+
range 0, 4, source(SourceTypes.REQUEST_BODY, 'var2', json)
515517
}
516518
toc.hasTaintedObject {
517519
value 'foo'
518-
range 0, 3, source(SourceTypes.REQUEST_BODY, 'var1', nullValue())
520+
range 0, 3, source(SourceTypes.REQUEST_BODY, 'var1', json)
519521
}
520522
toc.hasTaintedObject {
521523
value 'foo2'
522-
range 0, 4, source(SourceTypes.REQUEST_BODY, 'var2', nullValue())
524+
range 0, 4, source(SourceTypes.REQUEST_BODY, 'var2', json)
523525
}
524526

525527
where:

dd-java-agent/instrumentation/pekko-http-1.0/src/iastTest/groovy/datadog/trace/instrumentation/pekkohttp/iast/IastPekkoTest.groovy

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import spock.lang.Shared
1313
import java.nio.charset.StandardCharsets
1414

1515
import static org.hamcrest.Matchers.greaterThan
16-
import static org.hamcrest.Matchers.nullValue
1716

1817
class IastPekkoTest extends IastRequestTestRunner {
1918
@Shared
@@ -340,7 +339,7 @@ class IastPekkoTest extends IastRequestTestRunner {
340339
then:
341340
toc.hasTaintedObject {
342341
value 'var1=foo&var1=bar&var2=a+b+c'
343-
range 0, 28, source(SourceTypes.REQUEST_QUERY, null, null)
342+
range 0, 28, source(SourceTypes.REQUEST_QUERY, null, 'var1=foo&var1=bar&var2=a+b+c')
344343
}
345344
toc.hasTaintedObject {
346345
value 'var1'
@@ -486,14 +485,16 @@ class IastPekkoTest extends IastRequestTestRunner {
486485
}
487486

488487
void 'json request — #variant variant'() {
488+
given:
489+
final json = '''{
490+
"var1": "foo",
491+
"var2": ["foo2", "foo2"]
492+
}'''
493+
489494
when:
490495
String url = buildUrl "iast/$variant"
491496
def request = new Builder().url(url).post(
492-
RequestBody.create(MediaType.get("application/json"), '''{
493-
"var1": "foo",
494-
"var2": ["foo2", "foo2"]
495-
}'''.getBytes(StandardCharsets.US_ASCII))
496-
).build()
497+
RequestBody.create(MediaType.get("application/json"), json.getBytes(StandardCharsets.US_ASCII))).build()
497498
def response = client.newCall(request).execute()
498499
def respBody = response.body().string()
499500

@@ -505,21 +506,22 @@ class IastPekkoTest extends IastRequestTestRunner {
505506
def toc = finReqTaintedObjects
506507

507508
then:
509+
// source values take the value of the full body as it's converted to string at TaintFutureHelper
508510
toc.hasTaintedObject {
509511
value 'var1'
510-
range 0, 4, source(SourceTypes.REQUEST_BODY, 'var1', nullValue())
512+
range 0, 4, source(SourceTypes.REQUEST_BODY, 'var1', json)
511513
}
512514
toc.hasTaintedObject {
513515
value 'var2'
514-
range 0, 4, source(SourceTypes.REQUEST_BODY, 'var2', nullValue())
516+
range 0, 4, source(SourceTypes.REQUEST_BODY, 'var2', json)
515517
}
516518
toc.hasTaintedObject {
517519
value 'foo'
518-
range 0, 3, source(SourceTypes.REQUEST_BODY, 'var1', nullValue())
520+
range 0, 3, source(SourceTypes.REQUEST_BODY, 'var1', json)
519521
}
520522
toc.hasTaintedObject {
521523
value 'foo2'
522-
range 0, 4, source(SourceTypes.REQUEST_BODY, 'var2', nullValue())
524+
range 0, 4, source(SourceTypes.REQUEST_BODY, 'var2', json)
523525
}
524526

525527
where:
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
ext {
2+
latestDepTestMinJavaVersionForTests = JavaVersion.VERSION_17
3+
latestDepForkedTestMinJavaVersionForTests = JavaVersion.VERSION_17
4+
boot3TestMinJavaVersionForTests = JavaVersion.VERSION_17
5+
boot3ForkedTestMinJavaVersionForTests = JavaVersion.VERSION_17
6+
}
7+
muzzle {
8+
pass {
9+
group = 'org.springframework.boot'
10+
module = 'spring-boot'
11+
versions = "[1.3.0.RELEASE,3)"
12+
}
13+
pass {
14+
group = 'org.springframework.boot'
15+
module = 'spring-boot'
16+
versions = "[3,)"
17+
javaVersion = "17"
18+
}
19+
}
20+
21+
apply from: "$rootDir/gradle/java.gradle"
22+
23+
addTestSuiteForDir("boot1LatestDepTest", "test")
24+
addTestSuiteForDir("boot2Test", "test")
25+
addTestSuiteForDir("boot2LatestDepTest", "test")
26+
addTestSuiteForDir("boot3Test", "test")
27+
addTestSuiteForDir("latestDepTest", "test")
28+
addTestSuiteExtendingForDir("boot1LatestDepForkedTest", "boot1LatestDepTest", "test")
29+
addTestSuiteExtendingForDir("boot2ForkedTest", "boot2Test", "test")
30+
addTestSuiteExtendingForDir("boot2LatestDepForkedTest", "boot2LatestDepTest", "test")
31+
addTestSuiteExtendingForDir("boot3ForkedTest", "boot3Test", "test")
32+
addTestSuiteExtendingForDir("latestDepForkedTest", "latestDepTest", "test")
33+
34+
[compileLatestDepTestGroovy, compileBoot3TestGroovy].each {
35+
it.javaLauncher = getJavaLauncherFor(17)
36+
}
37+
38+
dependencies {
39+
compileOnly group: 'org.springframework.boot', name: 'spring-boot', version: '1.3.0.RELEASE'
40+
testImplementation group: 'org.springframework.boot', name: 'spring-boot', version: '1.3.0.RELEASE'
41+
boot1LatestDepTestImplementation group: 'org.springframework.boot', name: 'spring-boot', version: '1.+'
42+
boot1LatestDepForkedTestImplementation group: 'org.springframework.boot', name: 'spring-boot', version: '1.+'
43+
boot2TestImplementation group: 'org.springframework.boot', name: 'spring-boot', version: '2.0.0.RELEASE'
44+
boot2ForkedTestImplementation group: 'org.springframework.boot', name: 'spring-boot', version: '2.0.0.RELEASE'
45+
boot2LatestDepTestImplementation group: 'org.springframework.boot', name: 'spring-boot', version: '1.+'
46+
boot2LatestDepForkedTestImplementation group: 'org.springframework.boot', name: 'spring-boot', version: '1.+'
47+
boot3TestImplementation group: 'org.springframework.boot', name: 'spring-boot', version: '3.0.0'
48+
boot3ForkedTestImplementation group: 'org.springframework.boot', name: 'spring-boot', version: '3.0.0'
49+
latestDepTestImplementation group: 'org.springframework.boot', name: 'spring-boot', version: '+'
50+
latestDepForkedTestImplementation group: 'org.springframework.boot', name: 'spring-boot', version: '+'
51+
latestDepTestImplementation group: 'ch.qos.logback', name: 'logback-classic', version: '1.4.8' // otherwise clashes with RootLogLevelConfigurator
52+
latestDepForkedTestImplementation group: 'ch.qos.logback', name: 'logback-classic', version: '1.4.8'
53+
}

0 commit comments

Comments
 (0)