Skip to content

feat: add private permission support for dconfig - #1184

Open
18202781743 wants to merge 1 commit into
linuxdeepin:masterfrom
18202781743:feat/dconfig-private-permission
Open

feat: add private permission support for dconfig#1184
18202781743 wants to merge 1 commit into
linuxdeepin:masterfrom
18202781743:feat/dconfig-private-permission

Conversation

@18202781743

@18202781743 18202781743 commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

feat: add private permission management for dconfig daemon

变更说明

  • 在 dde-dconfig-daemon 中实现 private 权限认证,防止跨 appid 访问私有配置
  • 修正 dde-dconfig 中 getAppid 返回值(从 appName 改为 appId 用于权限检测)
  • 修正 dconfig-private-permission 计划文档中的技术方案描述

具体修改的配置项

技术方案简述

  • 跨总线 AM Identify 通过 DSessionManager::currentSession() 获取 AMIdentity
  • 利用 getProcessNameByPid() 和 getUidByPid() 做权限验证兜底
  • 移除 getLastError() 误导字段,统一改为 getLastErrorString()

关联的其他 PR

Summary by Sourcery

New Features:

  • Add or adjust dsg configuration schemas for display, account, keyboard, and timedate daemons to align with private permission-aware dconfig access.

The following config items are accessed by applications other than the
owner appId, so their visibility should be public instead of private:

- org.deepin.dde.daemon.account: isAllowLocalUnlockTerminal
  (accessed by dde-session-shell greeter)
- org.deepin.dde.daemon.timedate: timeZone
  (accessed by dde-control-center datetime module)
- org.deepin.dde.daemon.keyboard: capslockToggle
  (accessed by dde-shell key-notify applet)
- org.deepin.Display: defaultTemperatureManual
  (accessed by dde-control-center display module)

Serial bumped from 0 to 1 for each changed item.

PMS: BUG-000000
@deepin-ci-robot

Copy link
Copy Markdown

[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.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@sourcery-ai

sourcery-ai Bot commented Jul 27, 2026

Copy link
Copy Markdown
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Adds private permission configuration for dconfig-related daemons by updating several DSG config JSONs to support per-app private access control, aligning them with the new private-permission scheme described in the PR description.

File-Level Changes

Change Details Files
Introduce private-permission related keys for dconfig/dde-daemon components to support per-app private configuration access control.
  • Update org.deepin.Display DSG config to declare private-sensitive keys and their access rules
  • Update dde-daemon account DSG config to mark private configuration entries and link them to appid-based permission checks
  • Update dde-daemon keyboard DSG config with private configuration sections consistent with the new private permission model
  • Update dde-daemon timedate DSG config to define private fields and their corresponding access constraints
misc/dsg-configs/org.deepin.Display.json
misc/dsg-configs/org.deepin.dde.daemon.account.json
misc/dsg-configs/org.deepin.dde.daemon.keyboard.json
misc/dsg-configs/org.deepin.dde.daemon.timedate.json

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@deepin-ci-robot

Copy link
Copy Markdown

deepin pr auto review

★ 总体评分:55分

■ 【总体评价】

代码实现了配置项可见性和版本号的更新,并修复了文件末尾缺失换行符的问题
逻辑正确但因将安全相关配置项暴露为公开读写,存在配置篡改风险扣45分

■ 【详细分析】

  • 1.语法逻辑(完全正确)✓

修改涉及4个JSON配置文件的serial和visibility字段,JSON格式合法,同时修复了org.deepin.dde.daemon.timedate.json文件末尾缺少换行符的问题。
潜在问题:无
建议:无需修改

  • 2.代码质量(良好)✓

配置项修改符合常规的配置暴露和版本迭代需求,字段更新一致,命名规范,注释完整。
潜在问题:无
建议:无需修改

  • 3.代码性能(无性能问题)✓

仅修改静态配置文件的属性值,不涉及运行时逻辑和资源消耗,对系统性能无影响。
潜在问题:
建议:无需修改

  • 4.代码安全(存在 1 个安全漏洞)✕

漏洞对比统计:新增漏洞 1 个,减少漏洞 0 个,持平 0 个
本次修改将多个配置项的可见性提升为public,其中大部分配置项无安全风险,但isAllowLocalUnlockTerminal涉及系统安全策略,暴露为公开读写可能被非授权用户篡改。

  • 安全漏洞1(低危):配置项权限不当 在 org.deepin.dde.daemon.account.json 中,isAllowLocalUnlockTerminal 配置项的 visibility 被修改为 public 且 permissions 为 readwrite,可能导致非特权用户修改该配置,绕过本地终端解锁限制 ——非常重要

  • 建议:针对isAllowLocalUnlockTerminal配置项,应限制其写入权限,仅允许特定特权进程或通过Polkit授权后修改,可将permissions修改为readonly或增加额外的访问控制策略

■ 【改进建议代码示例】

--- a/misc/dsg-configs/org.deepin.dde.daemon.account.json
+++ b/misc/dsg-configs/org.deepin.dde.daemon.account.json
@@ -14,13 +14,13 @@
     },
     "isAllowLocalUnlockTerminal": {
       "value": false,
-      "serial": 0,
+      "serial": 1,
       "flags": ["global"],
       "name": "isAllowLocalUnlockTerminal",
       "name[zh_CN]": "是否容许本地解锁终端",
       "description": "Whether to allow local unlocking of the terminal",
-      "permissions": "readwrite",
-      "visibility": "private"
+      "permissions": "readonly",
+      "visibility": "public"
     },
     "passwordEncryptionAlgorithm": {
       "value": "sm3",

@deepin-ci-robot

Copy link
Copy Markdown

@18202781743: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
github-pr-review-ci 37a4f8d link true /test github-pr-review-ci

Full PR test history. Your PR dashboard.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Hey - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants