Skip to content

Commit 9e6fe03

Browse files
authored
Merge branch 'master' into smola/kafka-streams-test-fix
2 parents c36be03 + 8e29e20 commit 9e6fe03

File tree

50 files changed

+1740
-327
lines changed

Some content is hidden

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

50 files changed

+1740
-327
lines changed

.circleci/config.continue.yml.j2

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ instrumentation_modules: &instrumentation_modules "dd-java-agent/instrumentation
3636
debugger_modules: &debugger_modules "dd-java-agent/agent-debugger|dd-java-agent/agent-bootstrap|dd-java-agent/agent-builder|internal-api|communication|dd-trace-core"
3737
profiling_modules: &profiling_modules "dd-java-agent/agent-profiling"
3838

39-
default_system_tests_commit: &default_system_tests_commit 1ef00a34ad1f83ae999887e510ef1ea1c27b151b
39+
default_system_tests_commit: &default_system_tests_commit 1de04c42cbd9783432258004e46eb5982bbc9fe5
4040

4141
parameters:
4242
nightly:
@@ -1333,6 +1333,7 @@ build_test_jobs: &build_test_jobs
13331333
matrix:
13341334
<<: *test_matrix
13351335
1336+
{% if ssi_smoke %}
13361337
- tests:
13371338
requires:
13381339
- ok_to_test
@@ -1346,6 +1347,7 @@ build_test_jobs: &build_test_jobs
13461347
maxWorkers: 3
13471348
matrix:
13481349
<<: *test_matrix
1350+
{% endif %}
13491351
13501352
- tests:
13511353
requires:
@@ -1389,6 +1391,7 @@ build_test_jobs: &build_test_jobs
13891391
maxWorkers: 3
13901392
testJvm: "8"
13911393
1394+
{% if ssi_smoke %}
13921395
- tests:
13931396
requires:
13941397
- ok_to_test
@@ -1401,13 +1404,16 @@ build_test_jobs: &build_test_jobs
14011404
parallelism: 4
14021405
maxWorkers: 3
14031406
testJvm: "8"
1407+
{% endif %}
14041408
14051409
- fan_in:
14061410
requires:
14071411
- z_test_<< matrix.testJvm >>_base
14081412
- z_test_<< matrix.testJvm >>_inst
14091413
- z_test_<< matrix.testJvm >>_smoke
1414+
{% if ssi_smoke %}
14101415
- z_test_<< matrix.testJvm >>_ssi_smoke
1416+
{% endif %}
14111417
name: test_<< matrix.testJvm >>
14121418
stage: tracing
14131419
matrix:
@@ -1418,7 +1424,9 @@ build_test_jobs: &build_test_jobs
14181424
- z_test_8_base
14191425
- z_test_8_inst
14201426
- z_test_8_smoke
1427+
{% if ssi_smoke %}
14211428
- z_test_8_ssi_smoke
1429+
{% endif %}
14221430
name: test_8
14231431
stage: tracing
14241432
testJvm: "8"
@@ -1512,6 +1520,14 @@ build_test_jobs: &build_test_jobs
15121520
stage: required
15131521
15141522
workflows:
1523+
{% if skip_circleci %}
1524+
build_test:
1525+
jobs:
1526+
# Just a "required" job to make GitHub PR checks happy, and run nothing else.
1527+
- fan_in:
1528+
name: required
1529+
stage: required
1530+
{% else %}
15151531
{% if is_regular %}
15161532
build_test:
15171533
jobs:
@@ -1552,3 +1568,4 @@ workflows:
15521568
gradleTarget: :profilingTest
15531569
cacheType: profiling
15541570
{% endif %}
1571+
{% endif %}

.circleci/no_circleci_changes.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/usr/bin/env bash
2+
set -eu
3+
git diff --name-only "$1" | grep --invert-match --quiet -E '^(.gitlab-ci.yml|.gitlab)'

.circleci/render_config.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import os
44
import os.path
5+
import subprocess
56
import time
67

78
import jinja2
@@ -14,9 +15,10 @@
1415
GENERATED_CONFIG_PATH = os.path.join(SCRIPT_DIR, OUT_FILENAME)
1516

1617
# JDKs that will run on every pipeline.
17-
ALWAYS_ON_JDKS = {"8", "11", "17", "21"}
18+
ALWAYS_ON_JDKS = {"8", "17", "21"}
1819
# And these will run only in master and release/ branches.
1920
MASTER_ONLY_JDKS = {
21+
"11",
2022
"ibm8",
2123
"oracle8",
2224
"semeru8",
@@ -74,6 +76,13 @@
7476
run_all = "all" in labels
7577
is_master_or_release = branch == "master" or branch.startswith("release/v")
7678

79+
skip_circleci = False
80+
if pr_base_ref:
81+
ret = subprocess.call([".circleci/no_circleci_changes.sh", f"{pr_base_ref}..HEAD"], shell=False)
82+
if ret == 1:
83+
# Only GitLab-related files have changed, just skip Circle CI jobs.
84+
skip_circleci = True
85+
7786
if is_master_or_release or run_all:
7887
all_jdks = ALWAYS_ON_JDKS | MASTER_ONLY_JDKS
7988
else:
@@ -99,10 +108,12 @@
99108
"all_jdks": all_jdks,
100109
"all_debugger_jdks": all_debugger_jdks,
101110
"nocov_jdks": nocov_jdks,
102-
"flaky": branch == "master" or "flaky" in labels or "all" in labels,
111+
"flaky": "flaky" in labels or "all" in labels,
103112
"docker_image_prefix": "" if is_nightly else f"{DOCKER_IMAGE_VERSION}-",
104113
"use_git_changes": use_git_changes,
105114
"pr_base_ref": pr_base_ref,
115+
"skip_circleci": skip_circleci,
116+
"ssi_smoke": is_regular and is_master_or_release
106117
}
107118

108119
print(f"Variables for this build: {vars}")

dd-java-agent/appsec/src/main/java/com/datadog/appsec/gateway/GatewayBridge.java

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,13 @@ public class GatewayBridge {
6868

6969
/** User tracking tags that will force the collection of request headers */
7070
private static final String[] USER_TRACKING_TAGS = {
71-
"appsec.events.users.login.success.track", "appsec.events.users.login.failure.track"
71+
"appsec.events.users.login.success.track",
72+
"appsec.events.users.login.failure.track",
73+
"appsec.events.users.signup.track"
7274
};
7375

76+
private static final String USER_COLLECTION_MODE_TAG = "_dd.appsec.user.collection_mode";
77+
7478
private static final Map<LoginEvent, Address<?>> EVENT_MAPPINGS = new EnumMap<>(LoginEvent.class);
7579

7680
static {
@@ -708,7 +712,7 @@ private NoopFlow onRequestEnded(RequestContext ctx_, IGSpanInfo spanInfo) {
708712
StackUtils.addStacktraceEventsToMetaStruct(ctx_, METASTRUCT_EXPLOIT, stackTraces);
709713
}
710714

711-
} else if (hasUserTrackingEvent(traceSeg)) {
715+
} else if (hasUserInfo(traceSeg)) {
712716
// Report all collected request headers on user tracking event
713717
writeRequestHeaders(traceSeg, REQUEST_HEADERS_ALLOW_LIST, ctx.getRequestHeaders());
714718
} else {
@@ -803,6 +807,10 @@ public void stop() {
803807
subscriptionService.reset();
804808
}
805809

810+
private static boolean hasUserInfo(final TraceSegment traceSegment) {
811+
return hasUserTrackingEvent(traceSegment) || hasUserCollectionEvent(traceSegment);
812+
}
813+
806814
private static boolean hasUserTrackingEvent(final TraceSegment traceSeg) {
807815
for (String tagName : USER_TRACKING_TAGS) {
808816
final Object value = traceSeg.getTagTop(tagName);
@@ -813,6 +821,10 @@ private static boolean hasUserTrackingEvent(final TraceSegment traceSeg) {
813821
return false;
814822
}
815823

824+
private static boolean hasUserCollectionEvent(final TraceSegment traceSeg) {
825+
return traceSeg.getTagTop(USER_COLLECTION_MODE_TAG) != null;
826+
}
827+
816828
private static void writeRequestHeaders(
817829
final TraceSegment traceSeg,
818830
final Set<String> allowed,

0 commit comments

Comments
 (0)