From b6e1b1ed259aa14d5e34d65418870c3035e8ef88 Mon Sep 17 00:00:00 2001 From: Liu Jinchang Date: Wed, 4 Mar 2026 11:14:27 +0800 Subject: [PATCH] fix(security): update authority check to use system bus name subject Replace UnixProcessSubject with SystemBusNameSubject for authorization checks in driver installation and main application startup to improve security and proper authentication handling. Log: fix(security): update authority check to use system bus name subject Task: https://pms.uniontech.com/task-view-386841.html --- deepin-devicemanager/src/Page/PageDriverControl.cpp | 2 +- deepin-devicemanager/src/main.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/deepin-devicemanager/src/Page/PageDriverControl.cpp b/deepin-devicemanager/src/Page/PageDriverControl.cpp index 1d118cee..d4e9321e 100644 --- a/deepin-devicemanager/src/Page/PageDriverControl.cpp +++ b/deepin-devicemanager/src/Page/PageDriverControl.cpp @@ -213,7 +213,7 @@ void PageDriverControl::installDriverLogical() } else if (1 == curIndex) { // 驱动安装之前需要先提权 Authority::Result result = Authority::instance()->checkAuthorizationSync("com.deepin.deepin-devicemanager.checkAuthentication", - UnixProcessSubject(getpid()), + SystemBusNameSubject(QDBusConnection::sessionBus().baseService()), Authority::AllowUserInteraction); if (result != Authority::Yes) { return; diff --git a/deepin-devicemanager/src/main.cpp b/deepin-devicemanager/src/main.cpp index 19b138a9..2283d789 100644 --- a/deepin-devicemanager/src/main.cpp +++ b/deepin-devicemanager/src/main.cpp @@ -94,7 +94,7 @@ int main(int argc, char *argv[]) } #ifndef DISABLE_POLKIT Authority::Result result = Authority::instance()->checkAuthorizationSync("com.deepin.deepin-devicemanager.checkAuthentication", - UnixProcessSubject(getpid()), + SystemBusNameSubject(QDBusConnection::sessionBus().baseService()), Authority::AllowUserInteraction); if (result != Authority::Yes) return 0;