feat: validate LDAP config at startup#301
Open
allamiro wants to merge 1 commit into
Open
Conversation
Empty uri/base_dn/login_attribute and non-ldap(s/i) uri schemes were accepted silently and only failed at login time, where backend errors are masked as 'username or password incorrect'. The LDAP backend now implements validate_config like the other auth backends.
55a5c62 to
6bf53dc
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #287.
Problem
Unlike OIDC/htpasswd/Filesystem, the LDAP backend had no
validate_config(). Emptyuri/base_dn/login_attributeor a wrong uri scheme passed startup silently and only failed at login time — where backend errors are shown to users as 'username or password incorrect' (see #260 / #276 for how painful that is to debug).Changes
config::ldap::Ldap::validate(): requires non-emptyuri(parseable, schemeldap/ldaps/ldapi),base_dn,login_attributevalidate_config(), so a misconfigured server now refuses to start with a clear messageTesting
cargo test: 11/11 pass (2 new) in a rust:1.83 container.Summary by cubic
Fail-fast LDAP config validation at startup to prevent silent misconfigurations and confusing login errors. Startup now rejects empty or invalid
uri,base_dn, orlogin_attributewith clear messages.validate_config()in the LDAP backend.uriis parseable and usesldap/ldaps/ldapi; require non-emptybase_dnandlogin_attribute.Written for commit 55a5c62. Summary will update on new commits.