Skip to content

Commit

Permalink
fix: some security issues
Browse files Browse the repository at this point in the history
Fix some security issues.

Log: fix some security issues
Task: https://pms.uniontech.com/task-view-362563.html
  • Loading branch information
wangrong1069 authored and deepin-bot[bot] committed Sep 13, 2024
1 parent f331b28 commit afb8df2
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 5 deletions.
6 changes: 6 additions & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
deepin-system-monitor (6.5.1) unstable; urgency=medium

* fix: some security issues.

-- wangrong <[email protected]> Thu, 12 Sep 2024 15:20:25 +0800

deepin-system-monitor (6.5.0) unstable; urgency=medium

* New version 6.5.0.
Expand Down
10 changes: 8 additions & 2 deletions deepin-system-monitor-main/system/cpu_set.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -660,11 +660,17 @@ void CPUSet::read_dmi_cache_info()
if (!spnInfo.contains("KLVV", Qt::CaseInsensitive) && !spnInfo.contains("L540", Qt::CaseInsensitive) && !spnInfo.contains("KLVU", Qt::CaseInsensitive)
&& !spnInfo.contains("PGUV", Qt::CaseInsensitive) && !spnInfo.contains("PGUW", Qt::CaseInsensitive) && !spnInfo.contains("W585", Qt::CaseInsensitive)) {

process.start("bash", QStringList() << "-c"
<< "dmidecode | grep -i \"String 4\"");
process.start("dmidecode");
process.waitForStarted();
process.waitForFinished();
QString result = process.readAll();
QStringList lines = result.split('\n');
for (const QString &line : lines) {
if (line.contains("String 4", Qt::CaseInsensitive)) {
result = line;
break;
}
}
if (!result.contains("PWC30", Qt::CaseInsensitive) //w525
&& !result.contains("PGUX", Qt::CaseInsensitive)) {
process.close();
Expand Down
6 changes: 3 additions & 3 deletions deepin-system-monitor-system-server/src/systemdbusserver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ const QString s_PolkitActionSet = "org.deepin.systemmonitor.systemserver.set";
/**
@brief polkit 鉴权,通过配置文件处理
*/
bool checkAuthorization(qint64 pid, const QString &action)
bool checkAuthorization(const QString &appBusName, const QString &action)
{
PolkitQt1::Authority::Result ret = PolkitQt1::Authority::instance()->checkAuthorizationSync(
action, PolkitQt1::UnixProcessSubject(pid), PolkitQt1::Authority::AllowUserInteraction);
action, PolkitQt1::SystemBusNameSubject(appBusName), PolkitQt1::Authority::AllowUserInteraction);
if (PolkitQt1::Authority::Yes == ret) {
return true;
} else {
Expand Down Expand Up @@ -116,7 +116,7 @@ QString SystemDBusServer::setServiceEnableImpl(const QString &serviceName, bool
}

// 鉴权处理
if (!checkAuthorization(dbusCallerPid(), s_PolkitActionSet)) {
if (!checkAuthorization(message().service(), s_PolkitActionSet)) {
qWarning() << qPrintable("Polkit authorization failed");
return QString(strerror(EPERM));
}
Expand Down

0 comments on commit afb8df2

Please sign in to comment.