-
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: Bob Weinand <[email protected]>
- Loading branch information
Showing
466 changed files
with
77,621 additions
and
458 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
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
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,29 @@ | ||
--TEST-- | ||
Push address gets blocked | ||
--INI-- | ||
extension=ddtrace.so | ||
datadog.appsec.enabled=1 | ||
--FILE-- | ||
<?php | ||
use function datadog\appsec\testing\{rinit,rshutdown}; | ||
use function datadog\appsec\push_address; | ||
|
||
include __DIR__ . '/inc/mock_helper.php'; | ||
|
||
$helper = Helper::createInitedRun([ | ||
response_list(response_request_init(['ok', []])), | ||
response_list(response_request_exec(['block', ['status_code' => '404', 'type' => 'json'], ['{"found":"attack"}','{"another":"attack"}']])), | ||
]); | ||
|
||
rinit(); | ||
push_address("server.request.path_params", ["some" => "params", "more" => "parameters"]); | ||
|
||
var_dump("THIS SHOULD NOT GET IN THE OUTPUT"); | ||
|
||
?> | ||
--EXPECTHEADERS-- | ||
Status: 404 Not Found | ||
Content-type: application/json | ||
--EXPECTF-- | ||
{"errors": [{"title": "You've been blocked", "detail": "Sorry, you cannot access this page. Please contact the customer service team. Security provided by Datadog."}]} | ||
Warning: datadog\appsec\push_address(): Datadog blocked the request and presented a static error page in %s on line %d |
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,45 @@ | ||
--TEST-- | ||
Push address are sent on request_exec - array | ||
--INI-- | ||
extension=ddtrace.so | ||
datadog.appsec.enabled=1 | ||
--FILE-- | ||
<?php | ||
use function datadog\appsec\testing\{rinit,rshutdown}; | ||
use function datadog\appsec\push_address; | ||
|
||
include __DIR__ . '/inc/mock_helper.php'; | ||
|
||
$helper = Helper::createInitedRun([ | ||
response_list(response_request_init(['ok', []])), | ||
response_list(response_request_exec(['ok', [], [], [], [], false])), | ||
response_list(response_request_shutdown(['ok', [], new ArrayObject(), new ArrayObject()])) | ||
]); | ||
|
||
var_dump(rinit()); | ||
push_address("server.request.path_params", ["some" => "params", "more" => "parameters"]); | ||
var_dump(rshutdown()); | ||
|
||
var_dump($helper->get_command("request_exec")); | ||
|
||
?> | ||
--EXPECTF-- | ||
bool(true) | ||
bool(true) | ||
array(2) { | ||
[0]=> | ||
string(12) "request_exec" | ||
[1]=> | ||
array(1) { | ||
[0]=> | ||
array(1) { | ||
["server.request.path_params"]=> | ||
array(2) { | ||
["some"]=> | ||
string(6) "params" | ||
["more"]=> | ||
string(10) "parameters" | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.