fix(accounts1): authorize group info D-Bus methods to prevent info leak - #1196
fix(accounts1): authorize group info D-Bus methods to prevent info leak#1196mhduiy wants to merge 1 commit into
Conversation
1. Add PolicyKit authorization (org.deepin.dde.accounts.user-administration) to the GetGroups method before returning all system group names; 2. Add the same authorization to the GetGroupInfoByName method before returning a group's full info, which includes its member list; 3. Switch internal callers (NewManager init and the CreateGroup/DeleteGroup/ModifyGroup property refresh) to the data-layer users.GetAllGroups() so already-authenticated paths do not re-authorize; Log: Authorize the accounts group-info reading D-Bus methods to block unauthorized disclosure of system group names and group membership. Influence: Prevents unprivileged local users from enumerating system groups and reading privileged group (sudo/wheel/root) member lists. fix(accounts1): 为组信息 D-Bus 方法补充鉴权以防信息泄露 1. 为 GetGroups 方法在返回全部系统组名前补充 PolicyKit 鉴权 (org.deepin.dde.accounts.user-administration); 2. 为 GetGroupInfoByName 方法在返回组完整信息(含组成员名单)前补充 同一鉴权; 3. 将内部调用方(NewManager 初始化及 CreateGroup/DeleteGroup/ModifyGroup 刷新属性)改为直接调用数据层 users.GetAllGroups(),避免在已鉴权路径上 重复鉴权; Log: 为 accounts 组信息读取类 D-Bus 方法补充管理员鉴权,阻止未授权读取 系统组名与组成员名单。 PMS: BUG-370877 Influence: 防止本地非特权用户经 D-Bus 枚举系统组并读取特权组 (sudo/wheel/root)成员名单。 Change-Id: I09dee0d436f331df8cd3da55d2e783652b65321f
Reviewer's guide (collapsed on small PRs)Reviewer's GuideAdds PolicyKit authorization checks to group information D-Bus methods and updates internal call sites to use the lower-level users.GetAllGroups() helper instead of reusing the now-authorized D-Bus API. Sequence diagram for authorized group info D-Bus accesssequenceDiagram
actor DbusClient
participant Manager
participant PolicyKit as checkAuth
participant Users as users
participant DbusUtil as dbusutil
DbusClient->>Manager: GetGroups(sender)
Manager->>PolicyKit: checkAuth(sender)
alt authorized
PolicyKit-->>Manager: nil
Manager->>Users: GetAllGroups()
Users-->>Manager: groups, err
Manager->>DbusUtil: ToError(err)
Manager-->>DbusClient: groups, busErr
else access denied
PolicyKit-->>Manager: error
Manager->>DbusUtil: ToError(error)
Manager-->>DbusClient: nil, busErr
end
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: 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 |
deepin pr auto review★ 总体评分:100分■ 【总体评价】
■ 【详细分析】
■ 【改进建议代码示例】 // 当前代码实现已足够优秀,无需额外修改,此处展示当前最佳实践供参考
func (m *Manager) GetGroups(sender dbus.Sender) (groups []string, busErr *dbus.Error) {
if err := m.checkAuth(sender); err != nil {
logger.Debug("[GetGroups] access denied:", err)
return nil, dbusutil.ToError(err)
}
groups, err := users.GetAllGroups()
return groups, dbusutil.ToError(err)
} |
fix(accounts1): authorize group info D-Bus methods to prevent info leak
to the GetGroups method before returning all system group names;
returning a group's full info, which includes its member list;
CreateGroup/DeleteGroup/ModifyGroup property refresh) to the
data-layer users.GetAllGroups() so already-authenticated paths do
not re-authorize;
Log: Authorize the accounts group-info reading D-Bus methods to block
unauthorized disclosure of system group names and group membership.
Influence: Prevents unprivileged local users from enumerating system
groups and reading privileged group (sudo/wheel/root) member lists.
fix(accounts1): 为组信息 D-Bus 方法补充鉴权以防信息泄露
(org.deepin.dde.accounts.user-administration);
同一鉴权;
刷新属性)改为直接调用数据层 users.GetAllGroups(),避免在已鉴权路径上
重复鉴权;
Log: 为 accounts 组信息读取类 D-Bus 方法补充管理员鉴权,阻止未授权读取
系统组名与组成员名单。
PMS: BUG-370877
Influence: 防止本地非特权用户经 D-Bus 枚举系统组并读取特权组
(sudo/wheel/root)成员名单。
Change-Id: I09dee0d436f331df8cd3da55d2e783652b65321f
Summary by Sourcery
Authorize group information D-Bus methods and avoid redundant authorization for internal group list refreshes.
Bug Fixes:
Enhancements: