Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bugfix: Don't return disabled users on GetUser call #4426

Merged
merged 1 commit into from
Dec 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions changelog/unreleased/fix-hide-disabled-users.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Bugfix: Don't return disabled users in GetUser call

We fixed a bug where it was still possible to lookup a disabled User if
the user's ID was known.

https://github.com/cs3org/reva/pull/4426
https://github.com/owncloud/ocis/issues/7962
4 changes: 4 additions & 0 deletions pkg/user/manager/ldap/ldap.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,10 @@ func (m *manager) GetUser(ctx context.Context, uid *userpb.UserId, skipFetchingG
return nil, err
}

if m.c.LDAPIdentity.IsLDAPUserInDisabledGroup(log, m.ldapClient, userEntry) {
return nil, errtypes.NotFound("user is locally disabled")
}

if skipFetchingGroups {
return u, nil
}
Expand Down
3 changes: 2 additions & 1 deletion pkg/utils/ldap/identity.go
Original file line number Diff line number Diff line change
Expand Up @@ -503,11 +503,12 @@ func (i *Identity) getUserFilter(uid string) (string, error) {
escapedUUID = ldap.EscapeFilter(uid)
}

return fmt.Sprintf("(&%s(objectclass=%s)(%s=%s))",
return fmt.Sprintf("(&%s(objectclass=%s)(%s=%s)%s)",
i.User.Filter,
i.User.Objectclass,
i.User.Schema.ID,
escapedUUID,
i.disabledFilter(),
), nil
}

Expand Down
Loading