Skip to content

Commit

Permalink
Updating to not run redact code if value is empty
Browse files Browse the repository at this point in the history
  • Loading branch information
link04 committed Oct 21, 2024
1 parent b7a0f6f commit 9bf828c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions ext/serializer.c
Original file line number Diff line number Diff line change
Expand Up @@ -407,8 +407,9 @@ static void dd_add_post_fields_to_meta_recursive(zend_array *meta, const char *t
zend_string *postvalconcat = zend_strpprintf(0, "%s=%s", ZSTR_VAL(postkey), ZSTR_VAL(postvalstr));
zend_string_release(postvalstr);

// Match it with the regex to redact if needed
if (zai_match_regex(get_DD_TRACE_OBFUSCATION_QUERY_STRING_REGEXP(), postvalconcat)) {
// Match it with the regex to redact if needed and value is not an empty string
zend_string *regex_pattern = get_DD_TRACE_OBFUSCATION_QUERY_STRING_REGEXP();
if (strlen(regex_pattern) > 0 && zai_match_regex(regex_pattern, postvalconcat)) {
zend_string *replacement = zend_string_init(ZEND_STRL("<redacted>"), 0);
dd_add_post_fields_to_meta(meta, type, postkey, replacement);
zend_string_release(replacement);
Expand Down

0 comments on commit 9bf828c

Please sign in to comment.