fix(auth): unify caller authentication to isTrustedSender and remove binary path identification#428
fix(auth): unify caller authentication to isTrustedSender and remove binary path identification#428Fire-dtx wants to merge 1 commit into
Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: Fire-dtx 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 |
cb2d794 to
e4fe428
Compare
…binary path identification Replace binary path-based caller identification (getExecutablePathAndCmdline, mapMethodCaller, checkInvokePermission, checkSenderNsMntValid) with isTrustedSender + polkit authentication across all protected interfaces (InstallPackage, RemovePackage, DistUpgradePartly, PrepareDistUpgradePartly, PrepareFullScreenUpgrade, PowerOff, SetUpdateSources, UpdateMode, CheckUpdateModeWrite). Remove hardcoded executable path constants and whitelists (allowInstallPackageExecPaths, allowRemovePackageExecPaths). Consolidate duplicated isTrustedSender + polkit check blocks into the existing checkInvokePermission method, eliminating inline authentication logic in InstallPackage, RemovePackage, DistUpgradePartly, PrepareFullScreenUpgrade and PrepareDistUpgradePartly. Introduce manager_auth.go with allow-caller registration, lightdm trusted UID support, and persistent runtime state under /run/lastore. Export SetAllowCaller D-Bus method for deepin-security-loader integration. Add D-Bus access rules: deny SetAllowCaller/PowerOff for default policy, allow deepin-daemon and lightdm groups. Configure RuntimeDirectoryMode to 0700 with RuntimeDirectoryPreserve=yes. Add appstore_intranet.list to trusted source list. Remove deprecated deny-exec-whitelist and install-package-support-auth config items. Add isInstallLikeJobType helper. Refactor PrepareFullScreenUpgrade to use terminate() closure and remove dead lastore-upgrader.service fallback path. Add unit tests for manager_auth (isTrustedSender, SetAllowCaller persistence, runtime state load/remove, bus restart cleanup) and isInstallLikeJobType. Fix appinfo_test to use t.TempDir() instead of hardcoded /tmp path. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
deepin pr auto review这是一次非常出色且重构力度较大的代码审查。本次提交的核心是将 lastore-daemon 的鉴权模型从**“基于可执行文件路径的白名单”迁移到了“基于 DBus UniqueName 的动态白名单 + 可信 UID + Polkit”**的组合鉴权模型。这大大提升了架构的灵活性和安全性。 以下是我对本次 diff 的详细审查意见,分为语法逻辑、代码质量、代码性能和代码安全四个方面: 一、 语法与逻辑
二、 代码质量
三、 代码性能
四、 代码安全
总结本次重构方向正确,显著提升了鉴权模型的扩展性(适配 deepin-security-loader 场景),清理了大量历史技术债。最需要关注的是 |
Replace binary path-based caller identification (getExecutablePathAndCmdline, mapMethodCaller, checkInvokePermission) with isTrustedSender + polkit authentication for DistUpgradePartly and PrepareDistUpgradePartly interfaces. Remove caller authentication from RemovePackage interface. Add appstore_intranet.list to trusted source list. Remove deprecated deny-exec-whitelist and install-package-support-auth config items.
Introduce manager_auth.go with allow-caller registration, lightdm trusted UID support, and persistent runtime state under /run/lastore. Export SetAllowCaller D-Bus method for deepin-security-loader integration. Add D-Bus access rules for SetAllowCaller deny and deepin-daemon group policy. Configure RuntimeDirectory with 0700 mode and preserve semantics.