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 2025-09-17 20:16:35 -07:00 committed by Veiko Aasa
parent 1ad48ecad8
commit daca4d1d9c
No known key found for this signature in database
GPG Key ID: 478539CAE680674E

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):