Skip to content

Commit

Permalink
Wip
Browse files Browse the repository at this point in the history
  • Loading branch information
estringana committed Feb 21, 2025
1 parent 361f307 commit 6683b32
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
7 changes: 7 additions & 0 deletions appsec/src/extension/backtrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ static const char QUALIFIED_NAME_SEPARATOR[] = "::";

static zend_string *_frames_key;
static zend_string *_language_key;
static zend_string *_message_key;
static zend_string *_message_value;
static zend_string *_php_value;
static zend_string *_exploit_key;
static zend_string *_dd_stack_key;
Expand Down Expand Up @@ -188,8 +190,11 @@ void dd_generate_backtrace(zend_string *nullable id, zval *nonnull dd_backtrace)
ZVAL_STR_COPY(&language, _php_value);
zval id_zv;
ZVAL_STR_COPY(&id_zv, id);
zval message;
ZVAL_STR_COPY(&message, _message_value);
zend_hash_add(Z_ARRVAL_P(dd_backtrace), _language_key, &language);
zend_hash_add(Z_ARRVAL_P(dd_backtrace), _id_key, &id_zv);
zend_hash_add(Z_ARRVAL_P(dd_backtrace), _message_key, &message);

zval frames;
zval php_backtrace;
Expand Down Expand Up @@ -348,6 +353,8 @@ void dd_backtrace_startup()
{
_frames_key = zend_string_init_interned(LSTRARG("frames"), 1);
_language_key = zend_string_init_interned(LSTRARG("language"), 1);
_message_key = zend_string_init_interned(LSTRARG("message"), 1);
_message_value = zend_string_init_interned(LSTRARG("Default message"), 1);
_php_value = zend_string_init_interned(LSTRARG("php"), 1);
_exploit_key = zend_string_init_interned(LSTRARG("exploit"), 1);
_dd_stack_key = zend_string_init_interned(LSTRARG("_dd.stack"), 1);
Expand Down
3 changes: 3 additions & 0 deletions appsec/src/extension/commands_helpers.c
Original file line number Diff line number Diff line change
Expand Up @@ -520,6 +520,9 @@ static dd_result _command_process_actions(
} else if (dd_mpack_node_lstr_eq(verdict, "stack_trace")) {
_command_process_stack_trace_parameters(
mpack_node_array_at(action, 1));
if (res == dd_success) {
res = dd_should_record;
}
}
}

Expand Down

0 comments on commit 6683b32

Please sign in to comment.