Capture sign-in submission before asynchronous provider selection, keep the form mounted, and complete only the chosen login path. Preserve password validation and show provider errors without redirecting. Thanks to Nissulya and xet7 ! Fixes #6692,
3.8 KiB
LDAP bind investigation — issue 6692
Reviewed 2026-09-14. The complete issue and all three current comments were read. Snap 11.76 on Ubuntu reports a service-account LDAPS bind failure; ldapsearch succeeds and reverting to 11.72 did not help.
Local commit 5f5822f7d fixes the confirmed empty diagnostic: Error name
and message were lost by Object.keys-based sanitization. Diagnostics now
retain name, message, code and reason through existing secret redaction.
Certificate and invalid-credential tests pass; encryption, connection-release
and REST login suites also pass. TLS verification remains enabled.
The reporter's new 11.77 diagnostic identifies a TypeError reading index 0.
Local commit 2c5cdd78a fixes the matching post-bind failure: an unset
optional LDAP_USER_SEARCH_FILTER was indexed in getUserFilter before the
user search. Undefined/null/empty now omit only the optional filter;
configured restrictions remain active and invalid types fail explicitly.
The reproduction and encryption, connection-release and error-logging suites
pass. No live external directory or browser login was available; deployment
confirmation remains necessary. TLS verification remains unchanged.
Latest comment still uses 11.77, before the local post-bind fix. Regression
commit dad65fb6c exercises actual bindIfNecessary/searchUsers methods,
verifying successful UPN service binding reaches the correct user query,
configured filters remain active, and invalid credentials stop before search.
A separate oplog observer duplicate-insert error is reported one second later;
its connection to login is unproven and no database repair was guessed.
Deploy a release containing 2c5cdd78a and confirm the LDAP login separately
from that observer error. No live directory or browser login was run.
September 23 recurrence (Snap 11.90)
Read the full issue and all six comments again. The reporter confirms the earlier bind/search fix worked, then reports a new failure after successful LDAP authentication, local-user lookup and fullname synchronization. This differs from the September 14 optional-filter exception.
The current browser form reproduced two requests for one click: password login
ran while the click handler awaited authentication-method lookup, then LDAP ran.
The LDAP callback discarded its error and redirected to / unconditionally.
The loading flag also destroyed and recreated the form. The result was a silent
return to sign-in. The logged user.email value is not evidence of missing
addresses: stored Meteor accounts use user.emails.
Capture the form's submit event before useraccounts handles it, synchronously cancel it while selecting the provider, and preserve the mounted form. Both Enter and button clicks now use one login path; duplicate pending submissions are ignored. Delegate password submissions back to the original form handler for validation and 2FA. Provider errors remain visible as text; successful completion uses the normal AccountsTemplates callback and session-aware redirect. Remove the capture listener when the layout is destroyed.
Seven focused tests cover ordering, pending duplicates, rejection/retry, lookup and provider exceptions, password replay, empty inputs, unrelated forms and CAS/SAML completion. Existing LDAP filter, email mapping, connection-release and password-guard suites pass. A fresh production Meteor build and four Chromium regressions passed with an isolated FerretDB SQLite backend. Browser checks cover click/Enter failures, retained fields and retry, actual DDP session completion using a fixture resume token, and the original password path. The directory callback is controlled in these UI tests; no live external LDAPS bind or Snap installation was tested. FerretDB's current resume-token query/projection code was reviewed; this reproduced defect requires no database changes.