Skip to content

Commit 1bbd70b

Browse files
committed
refactor(accounts): disable UnionID password setting due to security check race condition
The newCaller() function uses /proc/<pid>/exe to verify the caller is running a trusted binary, but this check has a race condition and can be faked by the caller. Since there is no quick fix and this feature is not currently needed, temporarily disable the UnionID password setting functionality. Pms: BUG-349987 Signed-off-by: ComixHe <heyuming@deepin.org>
1 parent 6225167 commit 1bbd70b

2 files changed

Lines changed: 21 additions & 25 deletions

File tree

accounts1/user_chpwd_union_id.go

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -119,25 +119,26 @@ func newCaller(service *dbusutil.Service, sender dbus.Sender) (ret *caller, err
119119
return
120120
}
121121

122-
exe, err := proc.Exe()
123-
if err != nil {
124-
err = fmt.Errorf("get sender exe error: %v", err)
125-
return
126-
}
122+
// exe, err := proc.Exe()
123+
// if err != nil {
124+
// err = fmt.Errorf("get sender exe error: %v", err)
125+
// return
126+
// }
127127

128128
// 只允许来自控制中心, 锁屏和 greetter 的调用
129-
var app string
130-
switch exe {
131-
case "/usr/bin/dde-control-center":
132-
app = "control-center"
133-
case "/usr/bin/dde-lock":
134-
app = "lock"
135-
case "/usr/bin/lightdm-deepin-greeter":
136-
app = "greeter"
137-
default:
138-
err = fmt.Errorf("set password with Union ID called by %s, which is not allow", exe)
139-
return
140-
}
129+
//FIXME: we shouldn't use the executable path to identify caller
130+
// var app string
131+
// switch exe {
132+
// case "/usr/bin/dde-control-center":
133+
// app = "control-center"
134+
// case "/usr/bin/dde-lock":
135+
// app = "lock"
136+
// case "/usr/bin/lightdm-deepin-greeter":
137+
// app = "greeter"
138+
// default:
139+
// err = fmt.Errorf("set password with Union ID called by %s, which is not allow", exe)
140+
// return
141+
// }
141142

142143
status, err := proc.Status()
143144
if err != nil {
@@ -189,7 +190,7 @@ func newCaller(service *dbusutil.Service, sender dbus.Sender) (ret *caller, err
189190
xauth: xauth,
190191
proc: proc,
191192
user: user,
192-
app: app,
193+
app: "unknown",
193194
wayland: waylandSocket,
194195
}
195196
return

accounts1/user_ifc.go

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// SPDX-FileCopyrightText: 2018 - 2022 UnionTech Software Technology Co., Ltd.
1+
// SPDX-FileCopyrightText: 2018 - 2026 UnionTech Software Technology Co., Ltd.
22
//
33
// SPDX-License-Identifier: GPL-3.0-or-later
44

@@ -149,12 +149,7 @@ func (u *User) SetPassword(sender dbus.Sender, password string) *dbus.Error {
149149

150150
// set password from UnionID
151151
if password == "" {
152-
err := u.setPwdWithUnionID(sender)
153-
if err != nil {
154-
return dbusutil.ToError(err)
155-
} else {
156-
return nil
157-
}
152+
return nil
158153
}
159154

160155
err := u.checkAuth(sender, false, "")

0 commit comments

Comments
 (0)