fix(resource): improve log security when resource creation fails

This commit is contained in:
firest 2023-06-09 11:43:42 +08:00
parent 4835c30f8c
commit 86a7b2d69a
2 changed files with 6 additions and 2 deletions

View File

@ -603,7 +603,7 @@ create_or_update_bridge(BridgeType, BridgeName, Conf, HttpStatusCode) ->
{ok, _} ->
lookup_from_all_nodes(BridgeType, BridgeName, HttpStatusCode);
{error, Reason} when is_map(Reason) ->
?BAD_REQUEST(map_to_json(Reason))
?BAD_REQUEST(map_to_json(emqx_utils:redact(Reason)))
end.
get_metrics_from_local_node(BridgeType, BridgeName) ->

View File

@ -388,7 +388,11 @@ call_start(ResId, Mod, Config) ->
throw:Error ->
{error, Error};
Kind:Error:Stacktrace ->
{error, #{exception => Kind, reason => Error, stacktrace => Stacktrace}}
{error, #{
exception => Kind,
reason => Error,
stacktrace => emqx_utils:redact(Stacktrace)
}}
end.
-spec call_health_check(resource_id(), module(), resource_state()) ->