Forráskód Böngészése

feat: add authz skipped trace

JimMoen 1 éve
szülő
commit
d7cac74bed

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

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

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

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