From 85978d296cea62d42bd00fc7cb109bdfd3d616ab Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Tue, 16 Jan 2024 12:06:17 +0100 Subject: [PATCH] varlink: restore debug output on incoming messages Now that we can selectively suppress only sensitive fields in JSON objects we can reenable debug logging for incoming messages, which was removed in 2e3414660cb0c6a024661638d0b237d88b5a7cbc. This makes Varlink fully debuggable again: we'll see both incoming and outgoing messages, only the sensitive fields are suppressed. See: #30578 --- src/shared/varlink.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/shared/varlink.c b/src/shared/varlink.c index 7c37211cdda..84497c1a06e 100644 --- a/src/shared/varlink.c +++ b/src/shared/varlink.c @@ -1065,6 +1065,17 @@ static int varlink_parse_message(Varlink *v) { json_variant_sensitive(parameters); } + if (DEBUG_LOGGING) { + _cleanup_(erase_and_freep) char *censored_text = NULL; + + /* Suppress sensitive fields in the debug output */ + r = json_variant_format(v->current, /* flags= */ JSON_FORMAT_CENSOR_SENSITIVE, &censored_text); + if (r < 0) + return r; + + varlink_log(v, "Received message: %s", censored_text); + } + v->input_buffer_size -= sz; if (v->input_buffer_size == 0) -- 2.39.2