feat: unify v20 and v25 DConfig support - #159
Conversation
…rite 添加管控类型 Log: 添加管控类型 Influence: 管控进程 Task: https://pms.uniontech.com/task-view-260335.html Change-Id: I2b8725aecd36ca5e0dac0a80fa43b86796e26141 (cherry picked from commit 80b59ee4cb35ea083ec7f5158c0e31e30f4ff740) (cherry picked from commit 7f00fdc3b408b89ff2993ac151c5c1bd6997d13a)
OEM对话框表头改为可调整大小,增加最小最大化按钮,结果改变窗口横向滚动条设为一直显示 Log: OEM对话框表头改为可调整大小,增加最小最大化按钮,结果改变窗口横向滚动条设为一直显示 Task: https://pms.uniontech.com/task-view-303031.html Influence: dde-dconfig-editor的OEM对话框 Change-Id: I542861e38845f2ebc45ce175f011fb5a1946f577 (cherry picked from commit 721cb5a3aedc7ac57a13d79fe443ccd3afd420ef)
导出数据做一步数组判断和转换 Log: oem导出的数组类型不对导致overrides失效 Influence: 导出配置 Change-Id: I101777e7e917acb44a358b3095ad11663f2c5e60 (cherry picked from commit a699f1c209b17369f0d492847850cd79f227bd81)
1. 修改 check_caller_sid2 函数,增加 uid 参数,并在函数入口处增加权限拦 截,仅允许 root 用户(uid为0)继续执行后续的安全上下文检查,非 root 用户 直接返回 EPERM 错误 2. 更新 checkDBusSender 函数中的 D-Bus 调用者信息获取逻辑,从仅获取 pid 改为同步获取调用者的 uid 和 pid 3. 增加 D-Bus 获取 uid 和 pid 返回值的有效性校验,防止因获取失败导致的潜 在异常或越权 4. 此改动修复了原先仅依赖进程 sid2 属性校验而忽略用户身份导致的权限控制 不严格问题,提升了 dconfig 守护进程的安全防护能力 Influence: 1. 测试非 root 用户通过 D-Bus 触发权限校验逻辑,验证是否被正确拦截并返回 权限错误 2. 测试 root 用户通过 D-Bus 调用相关接口,验证原有功能是否正常执行 3. 模拟 D-Bus 底层获取 uid 或 pid 失败的异常情况,验证接口是否安全降级返 回失败 4. 检查 dconfig-daemon 运行日志,确认非 root 用户调用时打印了预期的 uid != 0 告警信息 5. 验证普通应用正常的 dconfig 配置读取流程是否受到异常影响 Bug: https://pms.uniontech.com/bug-view-367861.html Change-Id: I7d56594e1a255af87590697986af02f85962dc54 (cherry picked from commit 29198c6f15e6194842c737cdf3d41ec07a6be6ad)
1. 将所有 std::as_const 实例替换为 Qt 的 qAsConst 以提高与 Qt 容器的兼 容性 2. 通过移除 QTimeZone::UTC 参数将文件元数据时间戳处理从 UTC 改为本地时间 3. 在头文件中添加缺失的 QDateTime 包含以支持时间戳操作 4. 在实现文件中添加 DConfigFile 包含以确保功能完整性 这些更改提高了与 Qt 容器的兼容性,简化了时间戳处理,同时确保包含了所有必 需的头文件。qAsConst 更适合 Qt 容器,而本地时间戳足以满足文件变更检测的 需求。 Change-Id: I8d503fdc06876a9eb891eaa7384e6f0827968ac0 (cherry picked from commit e809ff37a2ec1b924905a722fa09e2ffe9d84cb1)
1. Bump C++ standard from C++14 to C++17 to resolve std::optional compilation failures 2. Replace qAsConst with std::as_const to eliminate Qt6 deprecation warnings 3. Add Qt5-specific systemd service, D-Bus config/activation, and PolicyKit policy files 4. Update CMake installation logic to select runtime resources based on QT_VERSION_MAJOR 5. Rename installed resource files to canonical names for consistent packaging regardless of Qt version 6. Use timezone-agnostic QFileInfo::metadataChangeTime() for Qt5/Qt6 compatibility 7. Include documentation for v20/v25 code integration strategy Log: Added Qt5-compatible runtime resources and unified build configuration for dual Qt version support Influence: 1. Verify Qt5 build compiles successfully without warnings 2. Verify Qt6 build compiles successfully without regressions 3. Verify Qt5 installation places service/config/policy files in correct destinations 4. Verify Qt6 installation places service/config files in correct destinations without PolicyKit policy 5. Verify installed D-Bus service activation and config allow correct daemon access 6. Verify installed systemd service file has proper sandboxing options and starts daemon successfully 7. Run unit tests on both Qt5 and Qt6 builds to confirm all pass feat: 支持 Qt5/Qt6 双版本构建并分离运行时资源 1. 将 C++ 标准从 C++14 提升至 C++17,解决 std::optional 编译失败问题 2. 用 std::as_const 替换 qAsConst,消除 Qt6 弃用警告 3. 新增 Qt5 专用的 systemd 服务、D-Bus 配置/激活和 PolicyKit 策略文件 4. 更新 CMake 安装逻辑,根据 QT_VERSION_MAJOR 选择运行时资源 5. 将安装的资源文件重命名为规范名称,使不同 Qt 版本的打包保持一致 6. 使用不带时区参数的 QFileInfo::metadataChangeTime(),兼容 Qt5/Qt6 7. 添加 v20/v25 代码整合策略的文档说明 Log: 新增 Qt5 兼容运行时资源并统一双 Qt 版本构建配置 Influence: 1. 验证 Qt5 构建无警告地编译通过 2. 验证 Qt6 构建无回归地编译通过 3. 验证 Qt5 安装时将服务/配置/策略文件放在正确目录 4. 验证 Qt6 安装时将服务/配置文件放在正确目录且不安装 PolicyKit 策略 5. 验证安装后的 D-Bus 服务激活和配置允许守护进程被正确访问 6. 验证安装后的 systemd 服务文件具有正确的沙箱选项并能成功启动守护进程 7. 在 Qt5 和 Qt6 构建上运行单元测试,确认全部通过
1. Update the v2.0-v2.5 integration plan document 2. Change the 'no push/no PR' rule to push to personal GitHub fork and create PRs upstream 3. Add request for code review by BLumia and mhduiy Influence: 1. Verify the README/documentation accurately reflects the new contribution workflow 2. Confirm the updated instructions are clear for developers reading the plan docs: 更新 v2.5 集成计划中的 PR 工作流 1. 更新 v2.0-v2.5 集成计划文档 2. 将"默认不推送、不创建 PR"的规则改为推送到个人 GitHub fork,并向上游创 建 PR 3. 新增请求 BLumia 和 mhduiy 进行代码审查的说明 Influence: 1. 验证文档准确反映了新的贡献工作流 2. 确认开发者在阅读计划时能清楚理解更新后的操作指引
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: 18202781743 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 |
|
Warning
详情 {
"export": {
"dconfig-center/dde-dconfig-editor/oemdialog.cpp": {
"b": [
" m_exportView->header()->setSectionResizeMode(QHeaderView::Interactive);",
" m_exportView->header()->resizeSection(0, 250);"
]
}
}
} |
Reviewer's GuideThis PR integrates selected v20/eagle functionality into the mainline while preserving Qt6/v25 behavior: it adds authorized SID2-validated configuration access, builds under C++17 for both Qt generations, chooses matching runtime resources at install time, improves OEM JSON export/UI behavior, and documents the cache/integration design and validation. Sequence diagram for authorized D-Bus configuration accesssequenceDiagram
participant Caller
participant DBus as D-Bus
participant Conn as DSGConfigConn
participant Proc as Linux procfs
Caller->>DBus: setValue(key, value)
D-Bus->>Conn: dispatch setValue(key, value)
Conn->>Conn: checkValid(key)
Conn->>Conn: getPermissions(key)
alt authorizedreadonly or authorizedreadwrite
Conn->>DBus: serviceUid(service)
Conn->>DBus: servicePid(service)
Conn->>Proc: read /proc/pid/attr/sid2
Proc-->>Conn: SID2 security label
alt valid root and deepin SID2 label
Conn->>Conn: hasPermissionByUid(key)
Conn-->>DBus: apply configuration change
else unauthorized caller
Conn-->>DBus: sendErrorReply(QDBusError::Failed, errorMsg)
end
else readonly or readwrite
Conn->>Conn: hasPermissionByUid(key)
end
Flow diagram for Qt-version runtime resource installationflowchart TD
A[Configure project] --> B{QT_VERSION_MAJOR}
B -->|5| C[Select services/qt5 resources]
C --> D[Install D-Bus config and activation]
C --> E[Install systemd service]
C --> F[Install PolicyKit policy]
B -->|6| G[Select v25 resources]
G --> H[Install D-Bus config and activation]
G --> I[Install systemd service]
G --> J[Skip v20 PolicyKit policy]
Flow diagram for compatible DConfig cache loadingflowchart LR
A[DConfigCache::load] --> B{cachePathPrefix set?}
B -->|No| C[Load default cache]
B -->|Yes| D[Load old default cache]
D --> E[Load new prefixed cache]
E --> F[Merge contents]
F --> G[New cache values overwrite same keys]
G --> H[DConfigCache::save writes prefixed cache]
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've found 1 issue
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="dconfig-center/dde-dconfig-daemon/dconfigconn.cpp" line_range="135" />
<code_context>
void DSGConfigConn::setValue(const QString &key, const QDBusVariant &value)
{
- if (!contains(key))
+ if (!checkValid(key))
return;
</code_context>
<issue_to_address>
**issue (bug_risk):** `reset()` validates an `AuthorizedReadOnly` item through `checkValid()`, but `checkValid()` only verifies the SID2/root authorization and `reset()` never calls `hasPermissionByUid()` or otherwise rejects read-only permissions. An authorized root caller can therefore reset a read-only configuration item.
**Triggers:** When a configuration item has the newly supported `AuthorizedReadOnly` permission and a root caller invokes `reset`.
**Suggested fix:** Reject `ReadOnly` and `AuthorizedReadOnly` permissions in `reset()`, or share the same write-permission check used by `setValue()`.
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
| void DSGConfigConn::reset(const QString &key) | ||
| { | ||
| if (!contains(key)) | ||
| if (!checkValid(key)) |
There was a problem hiding this comment.
issue (bug_risk): reset() validates an AuthorizedReadOnly item through checkValid(), but checkValid() only verifies the SID2/root authorization and reset() never calls hasPermissionByUid() or otherwise rejects read-only permissions. An authorized root caller can therefore reset a read-only configuration item.
Triggers: When a configuration item has the newly supported AuthorizedReadOnly permission and a root caller invokes reset.
Suggested fix: Reject ReadOnly and AuthorizedReadOnly permissions in reset(), or share the same write-permission check used by setValue().
Summary
Dependency
Validation
-j6)-j6)The five remaining
removeUserData*tests require UID 1001-1004, which are absent in the current container. v20 runtime service and Debian package validation are intentionally out of scope.Summary by Sourcery
Unify DConfig support across v20 and v25 by adding authorized access controls, Qt5/Qt6 runtime selection, and cross-version build compatibility.
New Features:
Bug Fixes:
Enhancements:
Deployment:
Documentation:
Tests: