فهرست منبع

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

firest 2 سال پیش
والد
کامیت
86a7b2d69a
2فایلهای تغییر یافته به همراه6 افزوده شده و 2 حذف شده
  1. 1 1
      apps/emqx_bridge/src/emqx_bridge_api.erl
  2. 5 1
      apps/emqx_resource/src/emqx_resource.erl

+ 1 - 1
apps/emqx_bridge/src/emqx_bridge_api.erl

@@ -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) ->

+ 5 - 1
apps/emqx_resource/src/emqx_resource.erl

@@ -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()) ->