diff --git a/apps/emqx_auth/src/emqx_authz/emqx_authz.erl b/apps/emqx_auth/src/emqx_authz/emqx_authz.erl index 8bc60a600..7ca9748a2 100644 --- a/apps/emqx_auth/src/emqx_authz/emqx_authz.erl +++ b/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 -> diff --git a/changes/ce/feat-13534.en.md b/changes/ce/feat-13534.en.md new file mode 100644 index 000000000..5c5af0bf5 --- /dev/null +++ b/changes/ce/feat-13534.en.md @@ -0,0 +1 @@ +Add trace logging when superuser skipped authz check.