Files
wekan/docs/DeveloperDocs/LDAP-6692.md
T
Lauri Ojansivu e1b13e6881 Use server invitation methods from the board sidebar.
Fix the legitimate invitation flow and unnecessary anonymous metadata subscription reported in #6692 comment 5811473169. Keep protected profile writes forbidden. Existing account blocks require administrator review; the separate history checksum report still needs the affected stored rows.

Thanks to Nissulya and xet7 !
2026-09-24 14:02:30 +03:00

98 lines
5.9 KiB
Markdown

# 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.
## September 24: invitation rejection disabled the account
The reporter's [follow-up](https://github.com/wekan/wekan/issues/6692#issuecomment-5811473169)
confirms that LDAP authentication succeeded. Accepting an invitation in the board
sidebar with an existing session called `removeInvite`, a direct client write to
`profile.invitedBoards`. The security guard correctly refused that protected
write, but logged it as InviteProfileBleed and disabled the account.
The sidebar now calls the existing server `acceptInvite` method, which checks the
pending invitation before consuming it. Decline relies on `quitBoard` to remove
the invitation; it no longer sends a second client write. Both methods explicitly
require a logged-in caller. Forged invitation writes remain forbidden.
The signed-out sign-in form now uses the configured authentication provider
without subscribing to protected user metadata. That unnecessary subscription
caused the repeated anonymous MembershipBleed entries shown in the screenshot.
The publication's authentication guard remains active.
An administrator must re-enable an already affected account in Admin Panel /
People after reviewing its recorded block reason. Existing blocks are not cleared
automatically: the historical log cannot distinguish a legitimate sidebar action
from a forged write. No LDAP settings or TLS checks need changing for this case.
The other screenshot entries are separate: filename shortening and a clean
storage scan are informational events, not account blocks. The HistoryIntegrity
checksum mismatch cannot be diagnosed from a hash alone. It needs the affected
stored history row and its predecessor, with content preserved for local hash
comparison; do not clear or regenerate the hashes merely to suppress the report.
The background audit records a detection and does not disable accounts.
Focused handler and method tests pass. Browser acceptance/decline regressions are
registered in `72-invitation-profile.e2e.js` and syntax-checked; they still need a
running Meteor/database/browser stack. No external LDAP or deployed Snap was
available for this follow-up.