Skip to content

Commit 0188bcc

Browse files
zeripathSysoev, Vladimir
authored and
Sysoev, Vladimir
committed
EscapeFilter the group dn membership (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 5e90eac commit 0188bcc

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 (source *Source) listLdapGroupMemberships(l *ldap.Conn, uid string) []string {
201201
var ldapGroups []string
202-
groupFilter := fmt.Sprintf("(%s=%s)", source.GroupMemberUID, uid)
202+
groupFilter := fmt.Sprintf("(%s=%s)", source.GroupMemberUID, ldap.EscapeFilter(uid))
203203
result, err := l.Search(ldap.NewSearchRequest(
204204
source.GroupDN,
205205
ldap.ScopeWholeSubtree,

0 commit comments

Comments
 (0)