Skip to content
Merged

Release #1390

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions debian/dde-shell.install
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ usr/share/dde-shell/org.deepin.ds.notification*/
usr/share/dde-shell/org.deepin.ds.notificationcenter*/
usr/share/dde-shell/org.deepin.ds.osd*/
usr/share/dsg/configs/org.deepin.dde.shell/org.deepin.dde.shell.json
usr/share/dsg/configs/overrides/org.deepin.dde.shell/*
usr/share/dsg/configs/org.deepin.dde.shell/org.deepin.dde.shell.notification.json
usr/share/dsg/configs/org.deepin.dde.shell/org.deepin.ds.dde-apps.json
usr/share/dsg/configs/org.deepin.dde.shell/org.deepin.ds.dock.json
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,17 @@
"description[zh_CN]": "通知自动清理的天数,超过此天数的通知将被自动删除",
"permissions": "readwrite",
"visibility": "public"
},
"safeCommands": {
"value": ["xdg-open","dbus-send","qdbus","deepin-defender","dde-control-center","downloader","dde-file-manager","dde-dconfig","/usr/lib/deepin-daemon/dde-bluetooth-dialog","/usr/bin/dde-hints-dialog","/usr/bin/deepin-devicemanager"],
"serial": 0,
"flags": [],
"name": "safe commands",
"name[zh_CN]": "安全指令",
"description": "safe commands",
"description[zh_CN]": "通知扩展的x-deepin-action-携带的指令白名单",
"permissions": "readonly",
"visibility": "private"
}
}
}
8 changes: 8 additions & 0 deletions panels/notification/server/notificationmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -532,6 +532,14 @@ void NotificationManager::doActionInvoked(const NotifyEntity &entity, const QStr
if (!args.isEmpty()) {
QString cmd = args.takeFirst(); // 命令

QScopedPointer<DConfig> config(DConfig::create("org.deepin.dde.shell", "org.deepin.dde.shell.notification"));
QStringList safeCommands = config->value("safeCommands").toStringList();
Comment on lines +535 to +536
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue (bug_risk): Guard against DConfig::create failure and avoid dereferencing a null config pointer.

DConfig::create can return nullptr (e.g. backend failure or missing schema), so config->value(...) is a crash risk. Add a null check (e.g. if (!config) { /* deny all commands + log */ }) before calling value() and choose an appropriate fallback behaviour.


if (!safeCommands.contains(cmd)) {
qWarning(notifyLog) << "The command is not allowed to be executed:" << cmd << safeCommands;
return;
}

QProcess pro;
pro.setProgram(cmd);
pro.setArguments(args);
Expand Down
1 change: 1 addition & 0 deletions shell/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -65,3 +65,4 @@ install(TARGETS dde-shell DESTINATION ${CMAKE_INSTALL_PREFIX}/bin)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/dde-shell@.service DESTINATION ${SYSTEMD_USER_UNIT_DIR})
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/dde-shell-plugin@.service DESTINATION ${SYSTEMD_USER_UNIT_DIR})
dtk_add_config_meta_files(APPID org.deepin.dde.shell FILES org.deepin.dde.shell.json)
dtk_add_config_override_files(APPID org.deepin.dde.shell META_NAME org.deepin.dtk.preference FILES overrides/org.deepin.dtk.preference.json)
17 changes: 17 additions & 0 deletions shell/overrides/org.deepin.dtk.preference.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"magic": "dsg.config.override",
"version": "1.0",
"contents": {
"themeType": {
"value": 0,
"serial": 1,
"flags": [],
"name": "The application theme type",
"name[zh_CN]": "应用主题的颜色",
"description": "The application theme type, which can be set to follow the system theme (0), light theme (1), dark theme (2)",
"description[zh_CN]": "应用主题的颜色,可以设置为跟随系统(0)、浅色(1)、 深色(2),默认为跟随系统",
"permissions": "readwrite",
"visibility": "public"
}
}
}