2022-08-09 16:12:23 +02:00
|
|
|
From 52f948fe211fedc54c13c0baf067cd6d8e4cb0c3 Mon Sep 17 00:00:00 2001
|
|
|
|
From: Luca Beltrame <lbeltrame@kde.org>
|
|
|
|
Date: Sun, 3 Apr 2022 09:26:48 +0200
|
2017-05-18 21:18:32 +02:00
|
|
|
Subject: [PATCH] Defuse root block
|
|
|
|
|
|
|
|
While the main point is correct as any application running in the same
|
|
|
|
X session (not sandboxed) can use kate's capability to open a console,
|
|
|
|
we allow (even encourage) running YaST on X11 as root.
|
|
|
|
That way it's only an impact on usability.
|
|
|
|
---
|
2022-08-09 16:12:23 +02:00
|
|
|
apps/kate/main.cpp | 15 ++-------------
|
|
|
|
apps/kwrite/main.cpp | 17 +++--------------
|
|
|
|
2 files changed, 5 insertions(+), 27 deletions(-)
|
2017-05-18 21:18:32 +02:00
|
|
|
|
2022-08-09 16:12:23 +02:00
|
|
|
Index: kate-19.11.70git.20220404T014944~1f6e53f72/apps/kate/main.cpp
|
2021-11-30 08:58:20 +01:00
|
|
|
===================================================================
|
2022-08-09 16:12:23 +02:00
|
|
|
--- kate-19.11.70git.20220404T014944~1f6e53f72.orig/apps/kate/main.cpp 2022-04-04 03:49:44.000000000 +0200
|
|
|
|
+++ kate-19.11.70git.20220404T014944~1f6e53f72/apps/kate/main.cpp 2022-04-04 05:55:46.476883480 +0200
|
|
|
|
@@ -49,19 +49,8 @@
|
2021-08-07 13:17:14 +02:00
|
|
|
#if !defined(Q_OS_WIN) && !defined(Q_OS_HAIKU)
|
2018-07-28 15:26:29 +02:00
|
|
|
// Prohibit using sudo or kdesu (but allow using the root user directly)
|
2017-05-18 21:18:32 +02:00
|
|
|
if (getuid() == 0) {
|
2018-07-28 15:26:29 +02:00
|
|
|
- if (!qEnvironmentVariableIsEmpty("SUDO_USER")) {
|
2022-03-29 08:44:24 +02:00
|
|
|
- std::cout << "Running Kate with sudo can cause bugs and expose you to security vulnerabilities. "
|
|
|
|
- "Instead use Kate normally and you will be prompted for elevated privileges when "
|
|
|
|
- "saving documents if needed."
|
2021-03-28 09:27:01 +02:00
|
|
|
- << std::endl;
|
2018-07-28 15:26:29 +02:00
|
|
|
- return EXIT_FAILURE;
|
|
|
|
- } else if (!qEnvironmentVariableIsEmpty("KDESU_USER")) {
|
2022-03-29 08:44:24 +02:00
|
|
|
- std::cout << "Running Kate with kdesu can cause bugs and expose you to security vulnerabilities. "
|
|
|
|
- "Instead use Kate normally and you will be prompted for elevated privileges when "
|
|
|
|
- "saving documents if needed."
|
2021-03-28 09:27:01 +02:00
|
|
|
- << std::endl;
|
2018-07-28 15:26:29 +02:00
|
|
|
- return EXIT_FAILURE;
|
|
|
|
- }
|
2017-05-18 21:18:32 +02:00
|
|
|
+ std::cout << "THIS IS POTENTIALLY INSECURE!\nTo edit files as root please use:" << std::endl;
|
2022-08-09 16:12:23 +02:00
|
|
|
+ std::cout << "SUDO_EDITOR=kate sudoedit <file>" << std::endl;
|
2017-05-18 21:18:32 +02:00
|
|
|
}
|
|
|
|
#endif
|
2021-11-30 08:58:20 +01:00
|
|
|
/**
|
2022-08-09 16:12:23 +02:00
|
|
|
Index: kate-19.11.70git.20220404T014944~1f6e53f72/apps/kwrite/main.cpp
|
|
|
|
===================================================================
|
|
|
|
--- kate-19.11.70git.20220404T014944~1f6e53f72.orig/apps/kwrite/main.cpp 2022-04-04 03:49:44.000000000 +0200
|
|
|
|
+++ kate-19.11.70git.20220404T014944~1f6e53f72/apps/kwrite/main.cpp 2022-04-04 05:57:17.276197192 +0200
|
|
|
|
@@ -27,19 +27,8 @@
|
|
|
|
#if !defined(Q_OS_WIN) && !defined(Q_OS_HAIKU)
|
|
|
|
// Prohibit using sudo or kdesu (but allow using the root user directly)
|
|
|
|
if (getuid() == 0) {
|
|
|
|
- if (!qEnvironmentVariableIsEmpty("SUDO_USER")) {
|
|
|
|
- std::cout << "Running KWrite with sudo can cause bugs and expose you to security vulnerabilities. "
|
|
|
|
- "Instead use KWrite normally and you will be prompted for elevated privileges when "
|
|
|
|
- "saving documents if needed."
|
|
|
|
- << std::endl;
|
|
|
|
- return EXIT_FAILURE;
|
|
|
|
- } else if (!qEnvironmentVariableIsEmpty("KDESU_USER")) {
|
|
|
|
- std::cout << "Running KWrite with kdesu can cause bugs and expose you to security vulnerabilities. "
|
|
|
|
- "Instead use KWrite normally and you will be prompted for elevated privileges when "
|
|
|
|
- "saving documents if needed."
|
|
|
|
- << std::endl;
|
|
|
|
- return EXIT_FAILURE;
|
|
|
|
- }
|
|
|
|
+ std::cout << "THIS IS POTENTIALLY INSECURE!\nTo edit files as root please use:" << std::endl;
|
|
|
|
+ std::cout << "SUDO_EDITOR=kwrite sudoedit <file>" << std::endl;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|