Skip to content
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -516,9 +516,11 @@ class AppSecContainer<SELF extends AppSecContainer<SELF>> extends GenericContain
cmd.hostConfig.withUlimits([new Ulimit('core', -1L, -1L)] as Ulimit[])
}

this.wwwDir ="src/test/www/${options.get('www', 'base')}"
String wwwValue = options.get('www', 'base') as String
this.wwwDir = wwwValue.contains('/') ? wwwValue : "src/test/www/${wwwValue}"
if (options['www_src']) {
this.wwwSrcDir = "src/test/www/${options['www_src']}"
String wwwSrcValue = options['www_src'] as String
this.wwwSrcDir = wwwSrcValue.contains('/') ? wwwSrcValue : "src/test/www/${wwwSrcValue}"
}

withFileSystemBind('../../..', '/project', BindMode.READ_ONLY)
Expand Down Expand Up @@ -644,7 +646,9 @@ class AppSecContainer<SELF extends AppSecContainer<SELF>> extends GenericContain

private void runInitialize() {
execInContainerWithOutput('/bin/bash', '-c', '''
if [[ -f /var/www/initialize.sh ]]; then
if [[ -f /var/www/docker-init.sh ]]; then
/var/www/docker-init.sh
elif [[ -f /var/www/initialize.sh ]]; then
/var/www/initialize.sh
fi
''')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import static java.net.http.HttpResponse.BodyHandlers.ofString
@EnabledIf('isExpectedVersion')
@TestMethodOrder(MethodOrderer.OrderAnnotation)
class Laravel8xTests {
static boolean expectedVersion = phpVersion.contains('7.4') && !variant.contains('zts')
static boolean expectedVersion = phpVersion.contains('8.1') && !variant.contains('zts')

AppSecContainer getContainer() {
getClass().CONTAINER
Expand All @@ -39,7 +39,7 @@ class Laravel8xTests {
baseTag: 'apache2-mod-php',
phpVersion: phpVersion,
phpVariant: variant,
www: 'laravel8x',
www: '../../../tests/Frameworks/Laravel/Version_8_x',
)

static void main(String[] args) {
Expand All @@ -49,7 +49,7 @@ class Laravel8xTests {
@Test
@Order(4)
void 'Login failure automated event'() {
Trace trace = container.traceFromRequest('/authenticate?email=nonExisiting@email.com') {
Trace trace = container.traceFromRequest('/login/auth?email=nonExisiting@email.com') {
HttpResponse<InputStream> resp ->
assert resp.statusCode() == 403
}
Expand All @@ -58,7 +58,6 @@ class Laravel8xTests {
assert span.meta."appsec.events.users.login.failure.track" == "true"
assert span.meta."_dd.appsec.events.users.login.failure.auto.mode" == "identification"
assert span.meta."appsec.events.users.login.failure.usr.exists" == "false"
// Failed event hook reads the credentials array; usr.login is the attempted email.
assert span.meta."appsec.events.users.login.failure.usr.login" == 'nonExisiting@email.com'
assert span.metrics._sampling_priority_v1 == 2.0d
}
Expand All @@ -68,7 +67,7 @@ class Laravel8xTests {
void 'Login failure automated event - wrong password for existing user'() {
// Existing user (id=1) with a wrong password: the Failed event carries the
// resolved user object, so usr.id and usr.exists must be populated.
Trace trace = container.traceFromRequest('/authenticate?email=ciuser@example.com&password=wrong') {
Trace trace = container.traceFromRequest('/login/auth?email=ciuser@example.com&password=wrong') {
HttpResponse<InputStream> resp ->
assert resp.statusCode() == 403
}
Expand All @@ -89,7 +88,7 @@ class Laravel8xTests {
// Laravel integration calls track_user_login_failure_event_automated('',
// null, false, [], 'laravel'). Per spec both missing_user_login and
// missing_user_id must fire, tagged framework:laravel.
container.traceFromRequest('/authenticate?email=') {
container.traceFromRequest('/login/auth?email=') {
HttpResponse<InputStream> resp ->
assert resp.statusCode() == 403
}
Expand Down Expand Up @@ -125,7 +124,7 @@ class Laravel8xTests {
@Order(7)
void 'Login success automated event'() {
//The user ciuser@example.com is already on the DB
def trace = container.traceFromRequest('/authenticate?email=ciuser@example.com') {
def trace = container.traceFromRequest('/login/auth?email=ciuser@example.com') {
HttpResponse<InputStream> resp ->
assert resp.statusCode() == 200
}
Expand All @@ -142,7 +141,7 @@ class Laravel8xTests {
@Order(8)
void 'Sign up automated event'() {
def trace = container.traceFromRequest(
'/register?email=test-user-new@email.coms&name=somename&password=somepassword'
'/login/signup?email=test-user-new@email.coms&name=somename&password=somepassword'
) { HttpResponse<InputStream> resp ->
assert resp.statusCode() == 200
}
Expand Down Expand Up @@ -209,12 +208,11 @@ class Laravel8xTests {
endpoints.size() > 0
})

assert endpoints.size() == 6
assert endpoints.size() == 27
Comment thread
Leiyks marked this conversation as resolved.
assert endpoints.find { it.path == '/' && it.method == 'GET' && it.operationName == 'http.request' && it.resourceName == 'GET /' } != null
assert endpoints.find { it.path == 'authenticate' && it.method == 'GET' && it.operationName == 'http.request' && it.resourceName == 'GET authenticate' } != null
assert endpoints.find { it.path == 'register' && it.method == 'GET' && it.operationName == 'http.request' && it.resourceName == 'GET register' } != null
assert endpoints.find { it.path == 'login/auth' && it.method == 'GET' && it.operationName == 'http.request' && it.resourceName == 'GET login/auth' } != null
assert endpoints.find { it.path == 'login/signup' && it.method == 'GET' && it.operationName == 'http.request' && it.resourceName == 'GET login/signup' } != null
assert endpoints.find { it.path == 'dynamic-path/{param01}' && it.method == 'GET' && it.operationName == 'http.request' && it.resourceName == 'GET dynamic-path/{param01}' } != null
assert endpoints.find { it.path == 'sanctum/csrf-cookie' && it.method == 'GET' && it.operationName == 'http.request' && it.resourceName == 'GET sanctum/csrf-cookie' } != null
assert endpoints.find { it.path == 'api/user' && it.method == 'GET' && it.operationName == 'http.request' && it.resourceName == 'GET api/user' } != null
}
}
18 changes: 0 additions & 18 deletions appsec/tests/integration/src/test/www/laravel8x/.editorconfig

This file was deleted.

This file was deleted.

10 changes: 0 additions & 10 deletions appsec/tests/integration/src/test/www/laravel8x/.gitattributes

This file was deleted.

15 changes: 0 additions & 15 deletions appsec/tests/integration/src/test/www/laravel8x/.gitignore

This file was deleted.

14 changes: 0 additions & 14 deletions appsec/tests/integration/src/test/www/laravel8x/.styleci.yml

This file was deleted.

64 changes: 0 additions & 64 deletions appsec/tests/integration/src/test/www/laravel8x/README.md

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading
Loading