-
Notifications
You must be signed in to change notification settings - Fork 159
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
22bc61b
commit 60b486e
Showing
6 changed files
with
76 additions
and
7 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
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,43 @@ | ||
--TEST-- | ||
Push address gets blocked even when within a hook | ||
--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' => 'html']]], ['{"found":"attack"}','{"another":"attack"}']])), | ||
]); | ||
rinit(); | ||
|
||
class SomeIntegration { | ||
public function init() | ||
{ | ||
DDTrace\install_hook("ltrim", self::hooked_function(), null); | ||
} | ||
|
||
private static function hooked_function() | ||
{ | ||
return static function (DDTrace\HookData $hook) { | ||
push_address("server.request.path_params", ["some" => "params", "more" => "parameters"]); | ||
var_dump("This should be executed"); | ||
}; | ||
} | ||
} | ||
|
||
$integration = new SomeIntegration(); | ||
$integration->init(); | ||
echo "Something here to force partially booking"; | ||
var_dump(ltrim(" Calling wrapped function")); | ||
var_dump("THIS SHOULD NOT GET IN THE OUTPUT"); | ||
?> | ||
--EXPECTHEADERS-- | ||
Content-type: text/html; charset=UTF-8 | ||
--EXPECTF-- | ||
Something here to force partially booking |
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