Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add asm standalone tests for PHP #3435

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
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
2 changes: 1 addition & 1 deletion utils/build/docker/php/apache-mod/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ fi
chmod a+rx /root

rm -f /tmp/ddappsec.lock
LOGS_PHP=(/tmp/appsec.log /tmp/helper.log /tmp/php_error.log /tmp/sidecar.log)
LOGS_PHP=(/tmp/appsec.log /tmp/helper.log /tmp/php_error.log /tmp/sidecar.log /tmp/tracer.log)
touch "${LOGS_PHP[@]}"
chown www-data:www-data "${LOGS_PHP[@]}"

Expand Down
2 changes: 2 additions & 0 deletions utils/build/docker/php/apache-mod/php.conf
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
RewriteRule "^/make_distant_call$" "/make_distant_call/"
RewriteRule "^/custom_event$" "/custom_event/"
RewriteRule "^/users$" "/users/"
RewriteRule "^/requestdownstream$" "/requestdownstream/"
RewriteRule "^/returnheaders$" "/returnheaders/"
RewriteRule "^/user_login_failure_event$" "/user_login_failure_event/"
RewriteRule "^/user_login_success_event$" "/user_login_success_event/"
RewriteRule "^/dbm$" "/dbm/"
Expand Down
4 changes: 3 additions & 1 deletion utils/build/docker/php/common/php.ini
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ display_errors=0

datadog.appsec.log_file=/tmp/appsec.log
datadog.appsec.log_level=debug
datadog.appsec.rules_path=/etc/dd-appsec/recommended.json
; will be overridden
datadog.appsec.helper_path=/usr/local/lib/libddappsec-helper.so
datadog.appsec.helper_socket_path=/tmp/ddappsec.sock
Expand All @@ -31,3 +30,6 @@ datadog.remote_config_poll_interval=500
datadog.remote_config_enabled=1
datadog.experimental_api_security_enabled=1
datadog.api_security_request_sample_rate=1

datadog.trace.log_file=/tmp/tracer.log
datadog.trace.log_level=debug
9 changes: 9 additions & 0 deletions utils/build/docker/php/common/requestdownstream.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php

$ch = curl_init("http://127.0.0.1:7777/returnheaders");

curl_exec($ch);
if(curl_error($ch)) {
fwrite($fp, curl_error($ch));
}
curl_close($ch);
17 changes: 17 additions & 0 deletions utils/build/docker/php/common/returnheaders.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php

function getHeadersFormatted()
{
$headers = [];
foreach ($_SERVER as $name => $value)
{
if (substr($name, 0, 5) == 'HTTP_')
{
$key = str_replace(' ', '-', ucwords(strtolower(str_replace('_', ' ', substr($name, 5)))));
$headers[$key] = $value;
}
}
return $headers;
}

echo json_encode(getHeadersFormatted());
2 changes: 1 addition & 1 deletion utils/build/docker/php/php-fpm/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ fi
chmod a+rx /root

rm -f /tmp/ddappsec.lock
LOGS_PHP=(/tmp/appsec.log /tmp/helper.log /tmp/php_error.log)
LOGS_PHP=(/tmp/appsec.log /tmp/helper.log /tmp/php_error.log /tmp/tracer.log)
touch "${LOGS_PHP[@]}"
chown www-data:www-data "${LOGS_PHP[@]}"

Expand Down
2 changes: 2 additions & 0 deletions utils/build/docker/php/php-fpm/php-fpm.conf
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
RewriteRule "^/make_distant_call$" "/make_distant_call/"
RewriteRule "^/custom_event$" "/custom_event/"
RewriteRule "^/users$" "/users/"
RewriteRule "^/requestdownstream$" "/requestdownstream/"
RewriteRule "^/returnheaders$" "/returnheaders/"
RewriteRule "^/user_login_failure_event$" "/user_login_failure_event/"
RewriteRule "^/user_login_success_event$" "/user_login_success_event/"
RewriteRule "^/dbm$" "/dbm/"
Expand Down
Loading