Repository navigation
Conversation
将 shutdownplugin.cpp 中 break 快捷键触发的锁屏逻辑从 bash -c 整串执行 重构为独立的 argv 参数化 QProcess 调用 + QDBusMessage,消除 CWE-78 安全编码规范违规,功能逻辑不变。 Closes: DDE-516
|
Skipping CI for Draft Pull Request. |
Reviewer's Guide本 PR 将 break 快捷键触发的锁屏逻辑封装为独立方法,移除 bash -c 拼接命令,改用参数化 QProcess 和原生 D-Bus 调用;同时保留原有执行顺序,并确保无论中间步骤是否成功都会恢复键盘映射选项,从而消除 CWE-78 命令注入风险。 Sequence diagram for parameterized break-action lockingsequenceDiagram
participant ShutdownPlugin
participant QProcess
participant XKB as setxkbmap
participant Xdotool as xdotool
participant LockFront1
ShutdownPlugin->>ShutdownPlugin: lockWithBreakActions()
ShutdownPlugin->>QProcess: start("setxkbmap", ["-query"])
QProcess->>XKB: execute -query
XKB-->>QProcess: stdout
QProcess-->>ShutdownPlugin: readAllStandardOutput()
ShutdownPlugin->>QProcess: execute("setxkbmap", ["-option", "grab:break_actions"])
QProcess->>XKB: set grab:break_actions
XKB-->>QProcess: exit code 0
ShutdownPlugin->>QProcess: execute("xdotool", ["key", "XF86Ungrab"])
QProcess->>Xdotool: send XF86Ungrab
Xdotool-->>QProcess: exit code 0
ShutdownPlugin->>LockFront1: Show()
LockFront1-->>ShutdownPlugin: reply
ShutdownPlugin->>QProcess: execute("setxkbmap", ["-option", originmap])
QProcess->>XKB: restore original option
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
18202781743
approved these changes
Oct 30, 2026
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: 18202781743, mhduiy The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
修复说明
将
shutdownplugin.cpp中 break 快捷键触发的锁屏逻辑从bash -c整串执行重构为独立的 argv 参数化 QProcess 调用,消除 CWE-78 安全编码规范违规,功能逻辑不变。变更内容
plugins/dde-dock/shutdown/shutdownplugin.h:新增私有方法声明void lockWithBreakActions();plugins/dde-dock/shutdown/shutdownplugin.cpp:QProcess::execute("bash -c ...")整串执行替换为lockWithBreakActions()方法调用lockWithBreakActions()方法实现,逻辑拆分为独立的 argv 参数化调用:QProcess::start("setxkbmap", {"-query"})捕获 stdout,在代码内解析options:行获取 originmap 值QProcess::execute("setxkbmap", {"-option", "grab:break_actions"})QProcess::execute("xdotool", {"key", "XF86Ungrab"})QDBusMessage::createMethodCall(...)+QDBusConnection::sessionBus().call(msg)替代dbus-send步骤 2-4 使用嵌套
if (execute(...) == 0)维持原&&串行时序;步骤 5 放在嵌套 if 之外无条件执行。安全性
CWE-78 OS 命令注入(编码规范)已有效消除,不再使用
bash -c整串执行。关联 Issue
DDE-516
Summary by Sourcery
Replace shell-string execution in the break-action lock flow with safe parameterized commands while preserving behavior and keyboard state restoration.
Bug Fixes:
Enhancements: