fix: Harden DBus security configuration#188
fix: Harden DBus security configuration#188deepin-bot[bot] merged 1 commit intolinuxdeepin:release/1071from
Conversation
- Remove redundant allow own rule from default policy - Keep allow own only in root policy for security - Remove redundant interface-specific allow rules - Simplify configuration while maintaining functionality Log: Improve DBus security by ensuring only root can own the service
Reviewer's guide (collapsed on small PRs)Reviewer's GuideThis PR tightens the D-Bus security configuration for com.deepin.diskmanager by removing redundant and overly permissive rules from the default policy, ensuring that only the root policy can own the service while keeping method invocation behavior intact. Sequence diagram for DBus ownership and method calls after policy hardeningsequenceDiagram
actor RootUser
actor UnprivilegedClient
participant DBusDaemon
participant DiskManagerService
RootUser->>DBusDaemon: Request own com.deepin.diskmanager
DBusDaemon->>DBusDaemon: Check RootPolicy allow own
DBusDaemon-->>RootUser: Ownership granted
DBusDaemon->>DiskManagerService: Activate service
UnprivilegedClient->>DBusDaemon: Send method call to com.deepin.diskmanager
DBusDaemon->>DBusDaemon: Check DefaultPolicy allow send_destination
DBusDaemon-->>UnprivilegedClient: Policy allows message
DBusDaemon->>DiskManagerService: Forward method call
DiskManagerService-->>UnprivilegedClient: Return result
UnprivilegedClient->>DBusDaemon: Attempt to own com.deepin.diskmanager
DBusDaemon->>DBusDaemon: Check DefaultPolicy (no allow own)
DBusDaemon-->>UnprivilegedClient: Ownership denied
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
deepin pr auto review代码审查报告1. 语法逻辑该文件是一个标准的 D-Bus 系统总线配置文件(XML 格式),用于定义 修改内容分析:
潜在逻辑问题:
2. 代码质量
3. 代码性能
4. 代码安全 —— 重点关注这是本次修改中风险最大的部分。修改极大地放宽了安全限制,或者可能导致服务不可用。
改进意见与建议代码假设该服务需要被桌面环境调用,且需要一定的安全性,建议的改进方案如下: 方案 A:如果服务由 root 运行,且希望限制只有特定组能访问(推荐) <?xml version="1.0" encoding="UTF-8"?> <!-- 建议添加 XML 声明 -->
<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
"http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
<busconfig>
<!-- 仅允许 root 用户拥有该服务名称 -->
<policy user="root">
<allow own="com.deepin.diskmanager"/>
</policy>
<!-- 默认策略:拒绝所有连接(可选,取决于系统默认配置,显式拒绝更安全) -->
<policy context="default">
<deny send_destination="com.deepin.diskmanager"/>
</policy>
<!-- 允许特定组(例如 disk 组或 storage 组)访问 -->
<policy group="disk">
<allow send_destination="com.deepin.diskmanager"/>
<!-- 如果需要,可以显式限制允许调用的接口 -->
<allow send_destination="com.deepin.diskmanager"
send_interface="com.deepin.diskmanager"/>
<allow send_destination="com.deepin.diskmanager"
send_interface="org.freedesktop.DBus.Properties"/>
<allow send_destination="com.deepin.diskmanager"
send_interface="org.freedesktop.DBus.Introspectable"/>
</policy>
</busconfig>方案 B:如果必须保持原 diff 的开放策略(任何人可访问),但需修复服务启动问题 如果该服务确实需要被任何用户调用,且服务以特定用户(如 <busconfig>
<!-- 确保服务运行者可以拥有名称 -->
<policy user="deepin-diskmanager">
<allow own="com.deepin.diskmanager"/>
</policy>
<!-- 允许任何人发送消息 -->
<policy context="default">
<allow send_destination="com.deepin.diskmanager"/>
</policy>
</busconfig>总结: |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: itsXuSt, max-lvs 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 |
|
/forcemerge |
|
This pr force merged! (status: unstable) |
0a2c5e4
into
linuxdeepin:release/1071
Log: Improve DBus security by ensuring only root can own the service
Summary by Sourcery
Tighten DBus policy for com.deepin.diskmanager by removing redundant and insecure default policy rules.
Enhancements: