-
Notifications
You must be signed in to change notification settings - Fork 160
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Alexandre Rulleau <[email protected]>
- Loading branch information
Showing
7 changed files
with
153 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
appsec/tests/extension/track_user_login_failure_event_automated_anon_mode_no_login.phpt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
--TEST-- | ||
Track automated user login failure with anonymization mode and verify the tags in the root span | ||
--INI-- | ||
extension=ddtrace.so | ||
--ENV-- | ||
DD_APPSEC_ENABLED=1 | ||
DD_APPSEC_AUTO_USER_INSTRUMENTATION_MODE=anon | ||
--FILE-- | ||
<?php | ||
use function datadog\appsec\testing\root_span_get_meta; | ||
use function datadog\appsec\track_user_login_failure_event_automated; | ||
include __DIR__ . '/inc/ddtrace_version.php'; | ||
|
||
ddtrace_version_at_least('0.79.0'); | ||
|
||
track_user_login_failure_event_automated("", "automatedID", | ||
true, | ||
[ | ||
"value" => "something", | ||
"metadata" => "some other metadata", | ||
"email" => "[email protected]" | ||
] | ||
); | ||
|
||
echo "root_span_get_meta():\n"; | ||
print_r(root_span_get_meta()); | ||
?> | ||
--EXPECTF-- | ||
root_span_get_meta(): | ||
Array | ||
( | ||
[runtime-id] => %s | ||
[appsec.events.users.login.failure.usr.id] => anon_b3ddafd7029d645b44fb990eea55b003 | ||
[_dd.appsec.usr.id] => anon_b3ddafd7029d645b44fb990eea55b003 | ||
[_dd.appsec.events.users.login.failure.auto.mode] => anonymization | ||
[appsec.events.users.login.failure.track] => true | ||
[appsec.events.users.login.failure.usr.exists] => true | ||
[server.business_logic.users.login.failure] => null | ||
) |
39 changes: 39 additions & 0 deletions
39
appsec/tests/extension/track_user_login_failure_event_automated_anon_mode_no_user.phpt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
--TEST-- | ||
Track automated user login failure with anonymization mode and verify the tags in the root span | ||
--INI-- | ||
extension=ddtrace.so | ||
--ENV-- | ||
DD_APPSEC_ENABLED=1 | ||
DD_APPSEC_AUTO_USER_INSTRUMENTATION_MODE=anon | ||
--FILE-- | ||
<?php | ||
use function datadog\appsec\testing\root_span_get_meta; | ||
use function datadog\appsec\track_user_login_failure_event_automated; | ||
include __DIR__ . '/inc/ddtrace_version.php'; | ||
|
||
ddtrace_version_at_least('0.79.0'); | ||
|
||
track_user_login_failure_event_automated("login", "", | ||
true, | ||
[ | ||
"value" => "something", | ||
"metadata" => "some other metadata", | ||
"email" => "[email protected]" | ||
] | ||
); | ||
|
||
echo "root_span_get_meta():\n"; | ||
print_r(root_span_get_meta()); | ||
?> | ||
--EXPECTF-- | ||
root_span_get_meta(): | ||
Array | ||
( | ||
[runtime-id] => %s | ||
[_dd.appsec.events.users.login.failure.auto.mode] => anonymization | ||
[appsec.events.users.login.failure.usr.login] => anon_428821350e9691491f616b754cd8315f | ||
[_dd.appsec.usr.login] => anon_428821350e9691491f616b754cd8315f | ||
[appsec.events.users.login.failure.track] => true | ||
[appsec.events.users.login.failure.usr.exists] => true | ||
[server.business_logic.users.login.failure] => null | ||
) |
31 changes: 31 additions & 0 deletions
31
appsec/tests/extension/track_user_login_success_event_automated_anon_mode_no_user.phpt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
--TEST-- | ||
Track automated user login success event with anonymization mode and verify the tags in the root span | ||
--INI-- | ||
extension=ddtrace.so | ||
--ENV-- | ||
DD_APPSEC_ENABLED=1 | ||
DD_APPSEC_AUTO_USER_INSTRUMENTATION_MODE=anon | ||
--FILE-- | ||
<?php | ||
use function datadog\appsec\testing\root_span_get_meta; | ||
use function datadog\appsec\track_user_login_success_event_automated; | ||
include __DIR__ . '/inc/ddtrace_version.php'; | ||
|
||
ddtrace_version_at_least('0.79.0'); | ||
|
||
track_user_login_success_event_automated("login", "", ['something' => 'discarded']); | ||
|
||
echo "root_span_get_meta():\n"; | ||
print_r(root_span_get_meta()); | ||
?> | ||
--EXPECTF-- | ||
root_span_get_meta(): | ||
Array | ||
( | ||
[runtime-id] => %s | ||
[_dd.appsec.events.users.login.success.auto.mode] => anonymization | ||
[appsec.events.users.login.success.usr.login] => anon_428821350e9691491f616b754cd8315f | ||
[_dd.appsec.usr.login] => anon_428821350e9691491f616b754cd8315f | ||
[appsec.events.users.login.success.track] => true | ||
[server.business_logic.users.login.success] => null | ||
) |
File renamed without changes.
36 changes: 36 additions & 0 deletions
36
appsec/tests/extension/track_user_signup_event_automated_anon_mode_no_user.phpt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
--TEST-- | ||
Track automated user sign up event with anonymization mode and verify the tags in the root span | ||
--INI-- | ||
extension=ddtrace.so | ||
--ENV-- | ||
DD_APPSEC_ENABLED=1 | ||
DD_APPSEC_AUTO_USER_INSTRUMENTATION_MODE=anon | ||
--FILE-- | ||
<?php | ||
use function datadog\appsec\testing\root_span_get_meta; | ||
use function datadog\appsec\track_user_signup_event_automated; | ||
include __DIR__ . '/inc/ddtrace_version.php'; | ||
|
||
ddtrace_version_at_least('0.79.0'); | ||
|
||
track_user_signup_event_automated("login", "", | ||
[ | ||
"value" => "something", | ||
"metadata" => "some other metadata", | ||
"email" => "[email protected]" | ||
]); | ||
|
||
echo "root_span_get_meta():\n"; | ||
print_r(root_span_get_meta()); | ||
?> | ||
--EXPECTF-- | ||
root_span_get_meta(): | ||
Array | ||
( | ||
[runtime-id] => %s | ||
[_dd.appsec.events.users.signup.auto.mode] => anonymization | ||
[appsec.events.users.signup.usr.login] => anon_428821350e9691491f616b754cd8315f | ||
[_dd.appsec.usr.login] => anon_428821350e9691491f616b754cd8315f | ||
[appsec.events.users.signup.track] => true | ||
[server.business_logic.users.signup] => null | ||
) |
File renamed without changes.