Merge pull request #11726 from zhongwencool/audit-cli-args-bin

fix: cli's args in audit log should be array
This commit is contained in:
zhongwencool 2023-10-08 21:29:39 -05:00 committed by GitHub
commit 4898d2377b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 6 additions and 5 deletions

View File

@ -1,6 +1,6 @@
{application, emqx_ctl, [
{description, "Backend for emqx_ctl script"},
{vsn, "0.1.4"},
{vsn, "0.1.5"},
{registered, []},
{mod, {emqx_ctl_app, []}},
{applications, [

View File

@ -331,13 +331,14 @@ safe_to_existing_atom(Str) ->
is_initialized() ->
ets:info(?CMD_TAB) =/= undefined.
audit_log(Level, From, Log) ->
audit_log(Level, From, Log = #{args := Args}) ->
case lookup_command(audit) of
{error, _} ->
ignore;
{ok, {Mod, Fun}} ->
try
apply(Mod, Fun, [Level, From, Log])
Log1 = Log#{args => [unicode:characters_to_binary(A) || A <- Args]},
apply(Mod, Fun, [Level, From, Log1])
catch
_:Reason:Stacktrace ->
?LOG_ERROR(#{

View File

@ -2,7 +2,7 @@
{application, emqx_dashboard, [
{description, "EMQX Web Dashboard"},
% strict semver, bump manually!
{vsn, "5.0.28"},
{vsn, "5.0.29"},
{modules, []},
{registered, [emqx_dashboard_sup]},
{applications, [

View File

@ -70,7 +70,7 @@ admins(_) ->
unload() ->
emqx_ctl:unregister_command(admins).
bin(S) -> iolist_to_binary(S).
bin(S) -> unicode:characters_to_binary(S).
print_error(Reason) when is_binary(Reason) ->
emqx_ctl:print("Error: ~s~n", [Reason]).