From 31b9b295aa5b9158faad0715580404b587474aeb Mon Sep 17 00:00:00 2001 From: Michael Aldridge Date: Mon, 2 Nov 2026 19:59:53 -0600 Subject: [PATCH] internal/ldap: Answer base-object searches for one entry MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit HashiCorp Vault reads the attributes of the user it just bound as by issuing a base-object "(objectClass=*)" search whose base DN is the user's own DN, and has no option to turn that step off. Those searches named a leaf entry rather than a container, so nothing routed them and login failed with unwillingToPerform. A single entry is now looked up by ID or name and returned under the DN the client asked for, advertising objectClass as the other entries do. An unknown name reports noSuchObject so clients can distinguish it from an empty result, an entry that does not match the filter succeeds with no entries as RFC 4511 requires, and filter shapes we cannot evaluate are refused instead of guessed at. The catch-all route is limited to base-object scope so searches with an unknown subtree base are still refused, which keeps a renamed server from answering its old base DN. 💘 Generated with Crush Assisted-by: Crush:qwen38_flash_next_mtp --- AGENTS.md | 16 ++ internal/ldap/ldap.go | 11 ++ internal/ldap/search.go | 192 ++++++++++++++++++++-- internal/ldap/util.go | 53 ++++++ internal/ldap/vault_test.go | 320 ++++++++++++++++++++++++++++++++++++ 5 files changed, 582 insertions(+), 10 deletions(-) create mode 100644 internal/ldap/vault_test.go diff --git a/AGENTS.md b/AGENTS.md index 581a874..c99db6d 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -100,6 +100,22 @@ goroutines with no recovery of its own). domain or empty labels; searches do not route until it succeeds. Naming context is always `dc=netauth,dc=