Skip to content
This repository has been archived by the owner on May 14, 2024. It is now read-only.

AD-Group Range RegEx #895

Closed
Domenik-E opened this issue Jun 1, 2023 · 13 comments
Closed

AD-Group Range RegEx #895

Domenik-E opened this issue Jun 1, 2023 · 13 comments

Comments

@Domenik-E
Copy link

I am using ldapjs to retrieve all members in different AD-groups. Some of these groups contain more then 1500 members. In order to retrieve all member it is necessary to work with range retrievals.

If i try to add a range like member;range=1500-2000 to the attributes list i receive the following error: "message": "attribute must be a valid string". It looks like the evaluation regex does not support the '=' symbol.

Thanks.

@jsumners
Copy link
Member

jsumners commented Jun 2, 2023

Attribute options are defined by https://www.rfc-editor.org/rfc/rfc4512#section-2.5:

An attribute description is represented by the ABNF:

 attributedescription = attributetype options
 attributetype = oid
 options = *( SEMI option )
 option = 1*keychar

And keychar is defined by https://www.rfc-editor.org/rfc/rfc4512#section-1.4:

keychar = ALPHA / DIGIT / HYPHEN
...
ALPHA = %x41-5A / %x61-7A ; "A"-"Z" / "a"-"z"
DIGIT = %x30 / LDIGIT ; "0"-"9"
HYPHEN = %x2D ; hyphen ("-")

https://github.com/ldapjs/messages/blob/e0b8f8f5617f8e1880717e6ef8e5da1a5f7adb0e/lib/messages/search-request.js#L28-L42 adheres said spec. Where is the spec that defines range=<x>-<y> as being valid?

@jsumners
Copy link
Member

Closing due to lack of response.

@jsumners jsumners closed this as not planned Won't fix, can't repro, duplicate, stale Aug 28, 2023
@RajyashreeChat
Copy link

I am facing the same issue. On trying to retrieve members of an AD Group with more than 1500 members, I was earlier using the below options with ldap version '2.3.3' and was getting the correct output but after upgrading to version '3.0.2' the range functionality inside the attribute stopped working and it started throwing "Error: attribute must be a valid string".

Is there some change in version 3.x which is stopping us from using this functionality, if yes what should be the new correct way to retrieve members of a group with more than 1500 members? Or is there some alternate way to retrieve this member list?

let opts = {
filter: cn=${cnValue},
scope: 'sub',
attributes: [ 'member;range=0-1499'],
timeLimit: 30
}

@jsumners
Copy link
Member

jsumners commented Nov 2, 2023

Is there some change in version 3.x which is stopping us from using this functionality

I think this is addressed in this thread and the v3 release notes. Have you reviewed them?

@Uiblar
Copy link

Uiblar commented Nov 3, 2023

I am facing the same issue.
if yes what should be the new correct way to retrieve members of a group with more than 1500 members? Or is there some alternate way to retrieve this member list?

I'm quite new to ldapjs and i'm wondering the same. I was trying to read this thread and the v3 release notes, but maybe I'm just not advanced enough to understand a thing :-D

@jsumners
Copy link
Member

jsumners commented Nov 3, 2023

range=<x>-<y> is not a valid attribute per the specification. I have asked for some documentation that defines the extension adding it as a valid attribute.

@Domenik-E
Copy link
Author

Domenik-E commented Nov 3, 2023

I think it is important to say that there is a difference between LDAP and ActiveDirectory. LDAP is a standard application protocol, while ActiveDirectory is a proprietary product.

The current implementation seems to be totally right from a protocol perspective. I think the common problem is that the majority users of this library (me included) want to interact with an ActiveDirectory. This is were the problem comes up....

@jsumners
Copy link
Member

jsumners commented Nov 3, 2023

Yes, that is correct, ActiveDirectory is not a standard LDAP server. The current approach taken by this project is to follow the published RFCs around LDAP as it gives us a source of truth to follow. However, we can update the attribute validator to allow the desired attribute. But we need some documentation to point to in order to make it acceptable.

Otherwise, I suggest investigating the paged search results as defined in RFC 2696. Or work to re-add VLV support as discussed in the v3 release notes.

@Domenik-E
Copy link
Author

Domenik-E commented Nov 3, 2023

the technical specification from Microsoft can be found here (Protocol Revision 57.0):
3.1.1.3.1.3.3 Range Retrieval of Attribute Values

@jsumners
Copy link
Member

jsumners commented Nov 3, 2023

Is there a web viewable version of that?

@Domenik-E
Copy link
Author

Unfortunately no. There ist just a download page

@jsumners jsumners reopened this Nov 7, 2023
@jsumners
Copy link
Member

jsumners commented Nov 7, 2023

This is being worked on in ldapjs/messages#9

@jsumners
Copy link
Member

jsumners commented Nov 9, 2023

This has been resolved via the linked issue. Please re-install your dependencies to get the latest @ldapjs/messages.

@jsumners jsumners closed this as completed Nov 9, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants