fix(audit_log): pretty print shell args
This commit is contained in:
parent
bb49914fd6
commit
34367fc4ec
|
|
@ -104,7 +104,7 @@ max_heap_size_warning(MF, Args) ->
|
||||||
msg => "shell_process_exceed_max_heap_size",
|
msg => "shell_process_exceed_max_heap_size",
|
||||||
current_heap_size => HeapSize,
|
current_heap_size => HeapSize,
|
||||||
function => MF,
|
function => MF,
|
||||||
args => Args,
|
args => pp_args(Args),
|
||||||
max_heap_size => ?MAX_HEAP_SIZE
|
max_heap_size => ?MAX_HEAP_SIZE
|
||||||
})
|
})
|
||||||
end.
|
end.
|
||||||
|
|
@ -115,21 +115,30 @@ log(IsAllow, MF, Args) ->
|
||||||
?AUDIT(warning, "from_remote_console", #{
|
?AUDIT(warning, "from_remote_console", #{
|
||||||
time => logger:timestamp(),
|
time => logger:timestamp(),
|
||||||
function => MF,
|
function => MF,
|
||||||
args => Args,
|
args => pp_args(Args),
|
||||||
permission => IsAllow
|
permission => IsAllow
|
||||||
}),
|
}),
|
||||||
to_console(IsAllow, MF, Args).
|
to_console(IsAllow, MF, Args).
|
||||||
|
|
||||||
to_console(prohibited, MF, Args) ->
|
to_console(prohibited, MF, Args) ->
|
||||||
warning("DANGEROUS FUNCTION: FORBIDDEN IN SHELL!!!!!", []),
|
warning("DANGEROUS FUNCTION: FORBIDDEN IN SHELL!!!!!", []),
|
||||||
?SLOG(error, #{msg => "execute_function_in_shell_prohibited", function => MF, args => Args});
|
?SLOG(error, #{
|
||||||
|
msg => "execute_function_in_shell_prohibited",
|
||||||
|
function => MF,
|
||||||
|
args => pp_args(Args)
|
||||||
|
});
|
||||||
to_console(exempted, MF, Args) ->
|
to_console(exempted, MF, Args) ->
|
||||||
limit_warning(MF, Args),
|
limit_warning(MF, Args),
|
||||||
?SLOG(error, #{
|
?SLOG(error, #{
|
||||||
msg => "execute_dangerous_function_in_shell_exempted", function => MF, args => Args
|
msg => "execute_dangerous_function_in_shell_exempted",
|
||||||
|
function => MF,
|
||||||
|
args => pp_args(Args)
|
||||||
});
|
});
|
||||||
to_console(ok, MF, Args) ->
|
to_console(ok, MF, Args) ->
|
||||||
limit_warning(MF, Args).
|
limit_warning(MF, Args).
|
||||||
|
|
||||||
warning(Format, Args) ->
|
warning(Format, Args) ->
|
||||||
io:format(?RED_BG ++ Format ++ ?RESET ++ "~n", Args).
|
io:format(?RED_BG ++ Format ++ ?RESET ++ "~n", Args).
|
||||||
|
|
||||||
|
pp_args(Args) ->
|
||||||
|
iolist_to_binary(io_lib:format("~0p", [Args])).
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue