-
Notifications
You must be signed in to change notification settings - Fork 458
illegal unescaped char #621
Comments
Would you like to submit a PR? |
this is because of updates to ldap-filter in #521 I believe you will have to escape characters in the set |
looks like this might help https://github.com/pfmooney/node-ldap-filter/blob/master/lib/helpers.js#L21 |
I too am having this issue; in my case, it's in a check of an LDAP group name that has an open-parentheses in it. |
@delfuego you should be able to escape the name. something like: filter = `(samaccountname=${name.replace(/[()\\*]/g, "\\$&")})` |
@UziTech For me, the issue turns out to be that this is being triggered by code I don't control in any way. I use the node-activedirectory library to provide AD authentication and authorization services in a custom Passport provider, and it's in that library's check whether a user is in a specific AD group that the issue arises — that code iterates through all the AD groups that the user is in to see if they have any nested groups, and it's in this recursive iteration that the escape doesn't happen. If this specific situation hits anyone else, I forked the node-activedirectory library, added the proper escaping, and submitted a pull request... I don't know how likely it is that it'll get pulled into the main library, though, the author of that library hasn't really been active in nearly a half-decade. But my fork won't go anywhere, if people want to use it as a dependency in their projects! |
@delfuego You can see if your issue is resolved by https://www.npmjs.com/package/activedirectory2 ( Regardless of the path you choose, the spec is quite clear that these characters should be escaped within values. |
@jsumners Well HOLY CRAP, how did I not know that activedirectory2 exists?!? This certainly looks promising: I'll give it a try. |
@jsumners Works like a charm — and I see that you merged the @next branch into master, which is what I tested! |
I ran into this error too using activedirectory package. This package has a direct dependency for ldapjs with versioning like My company is using activedirectory right now. This is not an ideal fix, but a quick one if you are trying to get things deployed. Ideal fix would be switching to a more reliable library with correct dependencies. If you are still using activedirectory package as a dependency for your project and encountered this error, a quick fix is to force a specific version for ldapjs on activedirectory. We are using yarn. You can specifically tell yarn what version of a transient dependency to use for a specific package. Below is how I fixed this issue for activedirectory package for the time being by adding this to your package.json.
|
@jongrubb thank you! My company is also using this package and this fixed it! |
@delfuego Finding this years later. But AD actually has a filter built-in for traversing nested groups. It's not glaringly obvious, though, since it's only available via the filter ID: '1.2.840.113556.1.4.1941'. More info can be found here: LDAP Wiki only reachable via the way-back-machine, unfortunately. |
Please include a minimal reproducible example |
Hi,
I think that we have a problem with the password, that contains characters like:
&%$!() etc.
I just downgraded to version 1.0.2 to fix it, but it could be great if the next release has as well som parser to deal with this typical characters used in strong passwords.
Thanks in advance
Antonio
The text was updated successfully, but these errors were encountered: