npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@simpleworkjs/ldap

v1.0.2

Published

Shared ldapts client + read queries + RFC 4515/4514 escaping for the theta42 apps.

Downloads

3,869

Readme

@simpleworkjs/ldap

Shared ldapts client + read queries + RFC 4515/4514 escaping for the theta42 apps (sso-manager-node, proxy, jump-host). The connection and read surface that all three copy-paste; write-side and posix logic stay app-local (sso owns those).

What it provides

  • escapeFilter(value) — RFC 4515. Escapes * \ ( ) NUL in a value interpolated into a search filter. This is the fix for the proxy's latent filter-injection bug (User.get interpolated data.username raw).
  • escapeDN(value) — RFC 4514. Escapes the reserved DN chars (sso had this as escapeLDAPDNValue; jump-host never built a DN by interpolation so didn't).
  • makeClient(conf, {Client?})new Client({ url, tlsOptions }). tlsOptions is forwarded as-is (no default): sso omits it and relies on ldapts' cert validation, so the shared client must not silently weaken it. Jump-host applies its own { rejectUnauthorized: false } default in its app-local wrapper.
  • withClient(conf, fn, {Client?}) — admin-bind, fn(client), always unbind() in finally.
  • createLdapClient(conf, {Client?, Change?, Attribute?}) — factory returning the jump-host API shape bound to a conf.ldap block:
{
  makeClient, withClient,
  getUser(uid),        // -> { dn, uid, sshPublicKeys: [] } | null
  getGroups(dn),       // -> [cn, ...]   (groupOfNames membership)
  checkPassword(dn, pw),   // -> bool   (simple bind as the user)
  addSshKey(dn, keyLine),  // -> void   (idempotent multi-value add)
  escapeFilter, escapeDN,
}

conf is injected, not read from @simpleworkjs/conf here — so the package is unit-testable with a plain object and a fake Client. Apps pass their conf.ldap block.

conf.ldap reconciliation

The three apps name things slightly differently; the factory normalizes:

| field | sso | jump-host | proxy | default | |---|---|---|---|---| | user base | userBase | userBase | searchBase | userBase \|\| searchBase | | user filter | userFilter (posixAccount) | (hardcoded) | userFilter (inetOrgPerson) | (objectClass=posixAccount) | | user attr | userNameAttribute | userNameAttribute | userNameAttribute | uid | | group base | groupBase | groupBase | (none — uses memberOf overlay) | — |

So jump-host's hardcoded (objectClass=posixAccount) becomes the default, and the proxy's inetOrgPerson is expressed via conf.userFilter rather than code.

Install

npm install @simpleworkjs/ldap

Usage (jump-host)

const { createLdapClient } = require('@simpleworkjs/ldap');
const conf = require('@simpleworkjs/conf');

const ldap = createLdapClient(conf.ldap);
const user = await ldap.getUser('alice');     // { dn, uid, sshPublicKeys }
const groups = await ldap.getGroups(user.dn); // ['host_web01_access', ...]

Why

Two things this exists to fix:

  1. Security — the proxy built (&${conf.userFilter}(${attr}=${data.username})) with the username interpolated raw. escapeFilter closes that.
  2. Duplication — sso's user_ldap.js and group_ldap.js already byte-duplicate makeClient/withClient/escapeLDAPDNValue; jump-host reimplements the same pattern. One package, one source of truth.

License

MIT © William Mantly