# Ported from gnome-session git commit a24600d75e2da1e379411d1c5fdf8759b00b6320 # (3.12.2020) - "util: Log variables excluded from environment upload" # (https://github.com/GNOME/gnome-session/commit/a24600d): # ============================================================================= # See: #71 (https://gitlab.gnome.org/GNOME/gnome-session/-/issues/71) - # "gsm_util_export_user_environment should log an error if the # UnsetAndSetEnvironment D-Bus call failed" # diff -up mate-session-manager-f56f8cd63d330e576aeabd09a0600a8da2e02392/mate-session/gsm-util.c~ mate-session-manager-f56f8cd63d330e576aeabd09a0600a8da2e02392/mate-session/gsm-util.c --- mate-session-manager-f56f8cd63d330e576aeabd09a0600a8da2e02392/mate-session/gsm-util.c~ 2021-05-16 23:44:59.144628501 +0200 +++ mate-session-manager-f56f8cd63d330e576aeabd09a0600a8da2e02392/mate-session/gsm-util.c 2021-05-16 23:44:59.160628607 +0200 @@ -570,17 +570,13 @@ gsm_util_export_activation_environment ( if (g_strv_contains (variable_blacklist, entry_name)) continue; - if (!g_utf8_validate (entry_name, -1, NULL)) - continue; - - if (!g_regex_match (name_regex, entry_name, 0, NULL)) - continue; - - if (!g_utf8_validate (entry_value, -1, NULL)) - continue; - - if (!g_regex_match (value_regex, entry_value, 0, NULL)) + if (!g_utf8_validate (entry_name, -1, NULL) || + !g_regex_match (name_regex, entry_name, 0, NULL) || + !g_utf8_validate (entry_value, -1, NULL) || + !g_regex_match (value_regex, entry_value, 0, NULL)) { + g_message ("Environment variable is unsafe to export to dbus: %s", entry_name); continue; + } g_variant_builder_add (&builder, "{ss}", entry_name, entry_value); } @@ -656,11 +652,11 @@ gsm_util_export_user_environment (GError for (i = 0; entries[i] != NULL; i++) { const char *entry = entries[i]; - if (!g_utf8_validate (entry, -1, NULL)) - continue; - - if (!g_regex_match (regex, entry, 0, NULL)) + if (!g_utf8_validate (entry, -1, NULL) || + !g_regex_match (regex, entry, 0, NULL)) { + g_message ("Environment entry is unsafe to upload into user environment: %s", entry); continue; + } g_variant_builder_add (&builder, "s", entry); }