Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
126946c
Add new function to add endpoint
estringana Aug 18, 2025
d963581
Aproaching solution
estringana Aug 21, 2025
9101018
Use shared cache instead of local
estringana Aug 22, 2025
5ded43b
wip
estringana Aug 25, 2025
7f65659
Used last push endpoints
estringana Aug 26, 2025
9bcf105
Tests passing
estringana Aug 27, 2025
17bf6d7
Fix rebase errors
estringana Aug 27, 2025
58dba7f
wip
estringana Sep 25, 2025
85e515b
Update generated files
estringana Sep 25, 2025
396d1a6
Make string vectors work
estringana Sep 25, 2025
068b2a9
wip
estringana Sep 26, 2025
8f1ac34
Add i32 vector
estringana Sep 29, 2025
2ad2b85
Add authentication vector
estringana Sep 29, 2025
cf304ef
Add serde json
estringana Sep 29, 2025
934eddf
Remove debugging lines
estringana Sep 29, 2025
115ee0d
Replace char_c for slices
estringana Sep 29, 2025
c81be78
Amend PR comments
estringana Sep 29, 2025
6998cb1
Strip invalid utf8 chars
estringana Sep 30, 2025
1ffaffd
Send Laravel endpoints
estringana Oct 6, 2025
0943210
Point to latest
estringana Oct 6, 2025
f89220d
Fix add-routes-collection (#3446)
estringana Oct 15, 2025
e9e6ed0
Point to latest libdatadog
estringana Oct 16, 2025
b2f641e
Remove response_code
estringana Oct 17, 2025
f2e25be
Remove non used fields
estringana Oct 17, 2025
1293313
Point to latest
estringana Oct 17, 2025
2b745c7
Generate cbindgen
estringana Oct 17, 2025
b30a383
Test Laravel integration
estringana Oct 21, 2025
cb4fe22
Refactor telemetry collection on appsec integration tests
estringana Oct 21, 2025
2d37978
Remove non necessary file
estringana Oct 21, 2025
120f3a7
Update php stub
estringana Oct 21, 2025
0c98943
Generate common
estringana Oct 22, 2025
a58eb8c
Amend laravel compatibility
estringana Oct 22, 2025
d22f700
Revert non required changes
estringana Oct 22, 2025
3a39d8e
Play defensive on Laravel Integration
estringana Oct 22, 2025
cd4f74b
Get routes from Symfony
estringana Oct 22, 2025
44fb838
Amend issue with drupal
estringana Oct 22, 2025
22e8576
Add wordpress integration
estringana Oct 24, 2025
bc496cb
wip
estringana Oct 24, 2025
e843dd3
Test laravel
estringana Oct 28, 2025
7f7d0f9
Test symfony
estringana Oct 28, 2025
704d5cd
Fix latest symfony
estringana Oct 29, 2025
50a29e0
Fix old symfony versions tests
estringana Oct 29, 2025
cd3c0fe
Fix some symfony failing versions
estringana Oct 30, 2025
806ae4c
Fix build
estringana Dec 30, 2025
dc0b866
Point to latest libdatadog
estringana Dec 30, 2025
4dd7002
Remove debugging lines
estringana Jan 2, 2026
d0a5435
Avoid failing tests to report success
bwoebi Jan 2, 2026
cfe36d1
Reduce telemetry heartbeat lapse
estringana Jan 2, 2026
0f3d6c6
Refactor test to avoid duplication
estringana Jan 2, 2026
e84351f
Test wordpress
estringana Jan 2, 2026
e6692f6
Fix telemetry
estringana Jan 5, 2026
940648b
Exclude symfony 4 from getting endpoints at startup
estringana Jan 7, 2026
d9413c5
Fix wordpress tests
estringana Jan 7, 2026
7f84f03
Merge branch 'master' into estringana/collect-framework-endpoints-2
estringana Jan 8, 2026
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
76 changes: 48 additions & 28 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -1210,8 +1210,8 @@ define run_tests_debug
(set -o pipefail; { $(call run_tests,$(1)) 2>&1 >&3 | \
tee >(grep --line-buffered -vE '\[ddtrace\] \[debug\]|\[ddtrace\] \[info\]' >&2) | \
{ ! (grep --line-buffered -E '\[error\]|\[warning\]|\[deprecated\]' >/dev/null && \
echo $$'\033[41m'"ERROR: Found debug log errors in the output."$$'\033[0m'); }; } 3>&1); \
timeout 10 bash -c 'wait' 2>/dev/null || true
echo $$'\033[41m'"ERROR: Found debug log errors in the output."$$'\033[0m'); }; } 3>&1 \
) && ([ -n "${DD_TRACE_DOCKER_DEBUG}" ] || timeout 10 bash -c 'wait' 2>/dev/null || true) \
$(eval TEST_EXTRA_ENV=)
endef

Expand Down
7 changes: 4 additions & 3 deletions appsec/tests/integration/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,7 @@ def buildTracerTask = { String version, String variant ->
}

def buildAppSecTask = { String version, String variant ->
def buildType = variant.contains('debug') ? 'Debug' : 'RelWithDebInfo'
buildRunInDockerTask(
baseName: 'buildAppsec',
baseTag: 'php',
Expand All @@ -346,17 +347,17 @@ def buildAppSecTask = { String version, String variant ->
],
command: [
'-e', '-c',
'''
"""
git config --global --add safe.directory '*'
cd /appsec
test -f CMakeCache.txt || \\
cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo \\
cmake -DCMAKE_BUILD_TYPE=$buildType \\
-DCMAKE_INSTALL_PREFIX=/appsec \\
-DDD_APPSEC_ENABLE_PATCHELF_LIBC=ON \\
-DDD_APPSEC_TESTING=ON /project/appsec
make -j extension ddappsec-helper && \\
touch ddappsec.so libddappsec-helper.so
'''
"""
]
)
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
package com.datadog.appsec.php

import groovy.transform.Canonical
import java.net.http.HttpRequest
import java.net.http.HttpResponse
import com.datadog.appsec.php.docker.AppSecContainer
import static java.net.http.HttpResponse.BodyHandlers.ofString

/**
* @link https://github.com/DataDog/instrumentation-telemetry-api-docs/blob/main/GeneratedDocumentation/ApiDocs/v2/producing-telemetry.md
Expand All @@ -22,6 +26,29 @@ class TelemetryHelpers {
}
}

static class AppEndpoints {
static names = ['app-endpoints']
List<Endpoint> endpoints

AppEndpoints(Map m) {
endpoints = m.endpoints.collect { new Endpoint(it as Map) }
}
}

static class Endpoint {
String method
String operationName
String path
String resourceName

Endpoint(Map m) {
method = m.method
operationName = m.operation_name
path = m.path
resourceName = m.resource_name
}
}

static class Metric {
String namespace
String name
Expand Down Expand Up @@ -137,4 +164,43 @@ class TelemetryHelpers {
autoEnabled = m.autoEnabled
}
}

public static <T> List<T> waitForTelemetryData(AppSecContainer container, int timeoutSec, Closure<Boolean> cl, Class<T> cls, String path = '/hello.php') {
List<T> messages = []
def deadline = System.currentTimeSeconds() + timeoutSec
def lastHttpReq = System.currentTimeSeconds() - 6
while (System.currentTimeSeconds() < deadline) {
if (System.currentTimeSeconds() - lastHttpReq > 5) {
lastHttpReq = System.currentTimeSeconds()
// used to flush global (not request-bound) telemetry metrics
def request = container.buildReq(path).GET().build()
def trace = container.traceFromRequest(request, ofString()) { HttpResponse<String> resp ->
assert resp.body().size() > 0
}
}
def telData = container.drainTelemetry(500)
messages.addAll(
TelemetryHelpers.filterMessages(telData, cls))
if (cl.call(messages)) {
break
}
}
messages
}

public static List<AppEndpoints> waitForAppEndpoints(AppSecContainer container, int timeoutSec, Closure<Boolean> cl, String path = '/') {
waitForTelemetryData(container, timeoutSec, cl, AppEndpoints, path)
}

public static List<GenerateMetrics> waitForMetrics(AppSecContainer container, int timeoutSec, Closure<Boolean> cl) {
waitForTelemetryData(container, timeoutSec, cl, GenerateMetrics)
}

public static List<WithIntegrations> waitForIntegrations(AppSecContainer container, int timeoutSec, Closure<Boolean> cl) {
waitForTelemetryData(container, timeoutSec, cl, WithIntegrations)
}

public static List<Logs> waitForLogs(AppSecContainer container, int timeoutSec, Closure<Boolean> cl) {
waitForTelemetryData(container, timeoutSec, cl, Logs)
}
}
Loading
Loading