Merge pull request #10988 from lafirest/fix/konservi_sentema

fix(resource): improve log security when resource creation fails
This commit is contained in:
lafirest 2023-06-09 13:46:12 +08:00 committed by GitHub
commit 601db2b1d3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 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()) ->

View File

@ -0,0 +1 @@
Improve log security when data bridge creation fails to ensure sensitive data is always obfuscated.