JimMoen 1 год назад
Родитель
Сommit
d7cac74bed
2 измененных файлов с 7 добавлено и 1 удалено
  1. 6 1
      apps/emqx_auth/src/emqx_authz/emqx_authz.erl
  2. 1 0
      changes/ce/feat-13534.en.md

+ 6 - 1
apps/emqx_auth/src/emqx_authz/emqx_authz.erl

@@ -477,9 +477,14 @@ authorize_deny(
     sources()
 ) ->
     authz_result().
-authorize(Client, PubSub, Topic, _DefaultResult, Sources) ->
+authorize(#{username := Username} = Client, PubSub, Topic, _DefaultResult, Sources) ->
     case maps:get(is_superuser, Client, false) of
         true ->
+            ?TRACE("AUTHZ", "authorization_skipped_as_superuser", #{
+                username => Username,
+                topic => Topic,
+                action => emqx_access_control:format_action(PubSub)
+            }),
             emqx_metrics:inc(?METRIC_SUPERUSER),
             {stop, #{result => allow, from => superuser}};
         false ->

+ 1 - 0
changes/ce/feat-13534.en.md

@@ -0,0 +1 @@
+Add trace logging when superuser skipped authz check.