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

in ldapquery, validation out of bounds query should be case insensitive as ldap is. #1755

Open
germanparente opened this issue Jul 7, 2024 · 1 comment
Assignees

Comments

@germanparente
Copy link

When validating if a particular dn is equal to basedn or if this dn is included in the base dn we use:

if !baseDN.AncestorOf(dn) && !baseDN.Equal(dn) {
return nil, NewQueryOutOfBoundsError(attributeValue, o.BaseDN)
}

But since this is ldap protocol and ldap is case insensitve, we should rather do this control as case-insentiive.

This issue is corresponding to:
https://issues.redhat.com/browse/OCPBUGS-36591
group sync is showing error "entry would search outside of the base dn specified" but it's not

/assign

@germanparente
Copy link
Author

germanparente commented Jul 7, 2024

Potential fix is:

index 19f276f3e..8868f287a 100644
--- a/pkg/security/ldapquery/query.go
+++ b/pkg/security/ldapquery/query.go
@@ -112,9 +112,9 @@ func (o *LDAPQueryOnAttribute) NewSearchRequest(attributeValue string, attribute
                if err != nil {
                        return nil, fmt.Errorf("could not search by dn, invalid dn value: %v", err)
                }
-               if !baseDN.AncestorOf(dn) && !baseDN.Equal(dn) {
-                       return nil, NewQueryOutOfBoundsError(attributeValue, o.BaseDN)
-               }
+                if !baseDN.AncestorOfFold(dn) && !baseDN.EqualFold(dn) {
+                        return nil, NewQueryOutOfBoundsError(attributeValue, o.BaseDN)
+                }
                return o.buildDNQuery(attributeValue, attributes), nil
 
        } else {

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant