diff --git a/apps/emqx_bridge_http/src/emqx_bridge_http_connector.erl b/apps/emqx_bridge_http/src/emqx_bridge_http_connector.erl index ac9b18ace..f62fc9d3f 100644 --- a/apps/emqx_bridge_http/src/emqx_bridge_http_connector.erl +++ b/apps/emqx_bridge_http/src/emqx_bridge_http_connector.erl @@ -48,7 +48,7 @@ ]). %% for other http-like connectors. --export([redact_request/1]). +-export([redact_request/1, is_sensitive_key/1]). -export([validate_method/1, join_paths/2]). diff --git a/apps/emqx_connector/src/emqx_connector.app.src b/apps/emqx_connector/src/emqx_connector.app.src index 09adf9977..4622e41bb 100644 --- a/apps/emqx_connector/src/emqx_connector.app.src +++ b/apps/emqx_connector/src/emqx_connector.app.src @@ -1,7 +1,7 @@ %% -*- mode: erlang -*- {application, emqx_connector, [ {description, "EMQX Data Integration Connectors"}, - {vsn, "0.1.38"}, + {vsn, "0.1.39"}, {registered, []}, {mod, {emqx_connector_app, []}}, {applications, [ diff --git a/apps/emqx_connector/src/emqx_connector_resource.erl b/apps/emqx_connector/src/emqx_connector_resource.erl index 74c167b32..4d753d477 100644 --- a/apps/emqx_connector/src/emqx_connector_resource.erl +++ b/apps/emqx_connector/src/emqx_connector_resource.erl @@ -137,7 +137,7 @@ create(Type, Name, Conf0, Opts) -> msg => "create connector", type => Type, name => Name, - config => emqx_utils:redact(Conf0) + config => redact(Conf0, Type) }), TypeBin = bin(Type), ResourceId = resource_id(Type, Name), @@ -174,7 +174,7 @@ update(Type, Name, {OldConf, Conf}, Opts) -> msg => "update connector", type => Type, name => Name, - config => emqx_utils:redact(Conf) + config => redact(Conf, Type) }), case recreate(Type, Name, Conf, Opts) of {ok, _} -> @@ -184,7 +184,7 @@ update(Type, Name, {OldConf, Conf}, Opts) -> msg => "updating_a_non_existing_connector", type => Type, name => Name, - config => emqx_utils:redact(Conf) + config => redact(Conf, Type) }), create(Type, Name, Conf, Opts); {error, Reason} -> @@ -378,3 +378,13 @@ override_start_after_created(Config, Opts) -> set_no_buffer_workers(Opts) -> Opts#{spawn_buffer_workers => false}. + +%% TODO: introduce a formal callback? +redact(Conf, Type) when + Type =:= http; + Type =:= <<"http">> +-> + %% CE bridge + emqx_utils:redact(Conf, fun emqx_bridge_http_connector:is_sensitive_key/1); +redact(Conf, _Type) -> + emqx_utils:redact(Conf).