actions: Log method arguments in privileged daemon

- This change means that when invalid module or action name is provided, the log
message is not printed. However, this is acceptable as those cases are rare in
production and are logged properly on the client side.

Tests:

- Run diagnostics for an app and notice that arguments are printed in privileged
daemon's journald logs.

- Remove a password from bepasty app and notice that the password argument is
not logged.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Veiko Aasa <veiko17@disroot.org>
This commit is contained in:
Sunil Mohan Adapa authored and Veiko Aasa committed 2025-09-29 16:58:46 +03:00
1 parent 1ad48ecad8
commit daca4d1d9c
1 file changed
+2 -2
+2 -2
View File
@@ -431,8 +431,6 @@ def privileged_handle_json_request(
try:
request = _parse_request()
logger.info('Received request for %s..%s(..)', request['module'],
request['action'])
arguments = {'args': request['args'], 'kwargs': request['kwargs']}
_setup_thread_storage()
return_value = _privileged_call(request['module'], request['action'],
@@ -495,6 +493,8 @@ def _privileged_call(module_name, action_name, arguments):
_privileged_assert_valid_arguments(func, arguments)
_log_action(func, module_name, action_name, arguments['args'],
arguments['kwargs'], run_in_background=False)
try:
return_values = func(*arguments['args'], **arguments['kwargs'])
if isinstance(return_values, io.BufferedReader):