fix(auth): prove the AD domain of a u:DOMAIN\name user bind
Auth-007's sAMAccountName match assumed the search base covers one AD domain; across a forest (Global Catalog) it could accept another domain's same-named account and return its groups. For a u:DOMAIN\name Who-am-I answer the entry must now also be that domain's account: AD's msDS-PrincipalName (objectSid-derived DOMAIN\name, read by a base search through the new ILdapConnection.Read) must equal the answer where offered; otherwise the name must have exactly one holder under SearchBase and it must be the entry found. Three forest cases fail pre-fix; single-domain and sAMAccountName-search compat cases pass both ways. README notes this and Auth-009. (scadaproj#50) Claude-Session: https://claude.ai/code/session_01GT67AEHd2Acv1YPwGfXEoV
This commit is contained in:
@@ -46,6 +46,14 @@ internal interface ILdapConnection : IDisposable
|
||||
/// <summary>Executes a subtree search and returns all matching entries.</summary>
|
||||
IReadOnlyList<LdapSearchEntry> Search(string searchBase, string filter, IReadOnlyList<string> attributes);
|
||||
|
||||
/// <summary>
|
||||
/// Reads one entry by DN (a base-scope search) and returns the requested attributes the server
|
||||
/// sent, or <see langword="null"/> when the entry does not exist. Throws <c>LdapException</c> on
|
||||
/// any other failure. Used for constructed attributes such as AD's <c>msDS-PrincipalName</c>,
|
||||
/// which a server may compute for a base read but not for a subtree search.
|
||||
/// </summary>
|
||||
LdapSearchEntry? Read(string dn, IReadOnlyList<string> attributes);
|
||||
|
||||
/// <summary>
|
||||
/// RFC 4532 "Who am I?": the authorization identity the directory associates with the current
|
||||
/// bind, as the server sends it (<c>dn:<dn></c>, <c>u:DOMAIN\name</c>, or empty for an
|
||||
|
||||
Reference in New Issue
Block a user