Merge pull request #12575 from thalesmg/fix-more-http-redact-r55-20240223
fix(connectors): redact authorization headers when creating/updating connectors
This commit is contained in:
commit
f1410c5d16
|
@ -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]).
|
||||
|
||||
|
|
|
@ -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, [
|
||||
|
|
|
@ -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).
|
||||
|
|
Loading…
Reference in New Issue