Skip to content

Commit 450f64c

Browse files
committed
EscapeFilter the group dn membership (go-gitea#20200)
Backport go-gitea#20200 The uid provided to the group filter must be properly escaped using the provided ldap.EscapeFilter function. Fix go-gitea#20181 Signed-off-by: Andrew Thornton <[email protected]>
1 parent 76ba23a commit 450f64c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

services/auth/source/ldap/source_search.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ func checkRestricted(l *ldap.Conn, ls *Source, userDN string) bool {
199199
// List all group memberships of a user
200200
func (ls *Source) listLdapGroupMemberships(l *ldap.Conn, uid string) []string {
201201
var ldapGroups []string
202-
groupFilter := fmt.Sprintf("(%s=%s)", ls.GroupMemberUID, uid)
202+
groupFilter := fmt.Sprintf("(%s=%s)", ls.GroupMemberUID, ldap.EscapeFilter(uid))
203203
result, err := l.Search(ldap.NewSearchRequest(
204204
ls.GroupDN,
205205
ldap.ScopeWholeSubtree,

0 commit comments

Comments
 (0)