Skip to content

Commit

Permalink
chore: apply feedbacks
Browse files Browse the repository at this point in the history
Signed-off-by: Alexandre Rulleau <[email protected]>
  • Loading branch information
Leiyks committed Feb 20, 2025
1 parent 3bbe4aa commit 0086536
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
12 changes: 7 additions & 5 deletions appsec/src/extension/commands_helpers.c
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,8 @@ static void _command_process_stack_trace_parameters(mpack_node_t root)
static dd_result _command_process_actions(
mpack_node_t root, struct req_info *ctx);

static void dd_command_process_settings(mpack_node_t root);

/*
* array(
* 0: [<"ok" / "record" / "block" / "redirect">,
Expand Down Expand Up @@ -559,7 +561,7 @@ static void _set_appsec_span_data(mpack_node_t node)
}
}

void dd_command_process_settings(mpack_node_t root)
static void dd_command_process_settings(mpack_node_t root)
{
if (mpack_node_type(root) != mpack_type_map) {
return;
Expand All @@ -572,13 +574,13 @@ void dd_command_process_settings(mpack_node_t root)
mpack_node_t value = mpack_node_map_value_at(root, i);

if (mpack_node_type(key) != mpack_type_str) {
mlog(dd_log_warning,
"Failed to process setting: invalid type for key");
mlog(dd_log_warning, "Failed to process user collection setting: "
"invalid type for key");
return;
}
if (mpack_node_type(value) != mpack_type_str) {
mlog(dd_log_warning,
"Failed to process setting: invalid type for value");
mlog(dd_log_warning, "Failed to process user collection setting: "
"invalid type for value");
return;
}

Expand Down
1 change: 0 additions & 1 deletion appsec/src/extension/commands_helpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ dd_result dd_command_proc_resp_verd_span_data(mpack_node_t root,
void *unspecnull ctx /* actually struct req_info* nonnull */);

/* Common helpers */
void dd_command_process_settings(mpack_node_t root);
void dd_command_process_meta(mpack_node_t root, zend_object *nonnull span);
bool dd_command_process_metrics(mpack_node_t root, zend_object *nonnull span);
bool dd_command_process_telemetry_metrics(mpack_node_t root);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ void asm_features_aggregator::add(const config &config)
}
}

// All keys should be available so no need for extra checks
// All keys should be correct so no need to check for their type again.
for (const auto &key : available_keys) {
// Make sure we override the value with the latest config.
ruleset_.RemoveMember(StringRef(key));
Expand Down

0 comments on commit 0086536

Please sign in to comment.