1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
From: Benjamin Berg <bberg@redhat.com>
Date: Mon, 19 Oct 2020 16:34:33 +0200
Subject: util: Log variables excluded from environment upload
See: #71
Origin: upstream, 40, commit:a24600d75e2da1e379411d1c5fdf8759b00b6320
---
gnome-session/gsm-util.c | 22 ++++++++++------------
1 file changed, 10 insertions(+), 12 deletions(-)
diff --git a/gnome-session/gsm-util.c b/gnome-session/gsm-util.c
index 9d05fd7..bcad0eb 100644
--- a/gnome-session/gsm-util.c
+++ b/gnome-session/gsm-util.c
@@ -568,17 +568,14 @@ gsm_util_export_activation_environment (GError **error)
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_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)) {
- if (!g_regex_match (value_regex, entry_value, 0, NULL))
+ g_message ("Environment variable is unsafe to export to dbus: %s", entry_name);
continue;
+ }
child_environment = g_environ_setenv (child_environment,
entry_name, entry_value,
@@ -655,11 +652,12 @@ gsm_util_export_user_environment (GError **error)
for (i = 0; entries[i] != NULL; i++) {
const char *entry = entries[i];
- if (!g_utf8_validate (entry, -1, NULL))
- continue;
+ if (!g_utf8_validate (entry, -1, NULL) ||
+ !g_regex_match (regex, entry, 0, NULL)) {
- if (!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);
}
|