Sfoglia il codice sorgente

fix(http connector): remove sensitive info from headers lazily

In production code we don't need to redact the headers for a trace that
will never appear anywhere so we can improve performance by doing
removal of sensitive information lazily.
Kjell Winblad 1 anno fa
parent
commit
ff09f14191

+ 2 - 2
apps/emqx_bridge_http/src/emqx_bridge_http_connector.erl

@@ -512,7 +512,7 @@ trace_rendered_action_template(ActionId, Host, Method, NRequest, Timeout) ->
                     host => Host,
                     path => Path,
                     method => Method,
-                    headers => emqx_utils_redact:redact_headers(Headers),
+                    headers => {fun emqx_utils_redact:redact_headers/1, Headers},
                     timeout => Timeout
                 }
             );
@@ -523,7 +523,7 @@ trace_rendered_action_template(ActionId, Host, Method, NRequest, Timeout) ->
                     host => Host,
                     path => Path,
                     method => Method,
-                    headers => emqx_utils_redact:redact_headers(Headers),
+                    headers => {fun emqx_utils_redact:redact_headers/1, Headers},
                     timeout => Timeout,
                     body => {fun log_format_body/1, Body}
                 }