Skip to content

Sync-in · Sovereign platform for file storage, sharing, synchronization, and collaboration.

fix(backend:auth): disable LDAP local password fallback by default

johavend57c42d01943
diff --git a/backend/src/authentication/providers/ldap/auth-ldap.config.ts b/backend/src/authentication/providers/ldap/auth-ldap.config.ts
index aa79f76d..aa540853 100644
--- a/backend/src/authentication/providers/ldap/auth-ldap.config.ts
+++ b/backend/src/authentication/providers/ldap/auth-ldap.config.ts
@@ -49,7 +49,7 @@ export class AuthProviderLDAPOptionsConfig {
@IsOptional()
@IsBoolean()
- enablePasswordAuthFallback? = true
+ enablePasswordAuthFallback? = false
}
export class AuthProviderLDAPConfig {
diff --git a/backend/src/authentication/providers/ldap/auth-provider-ldap.service.spec.ts b/backend/src/authentication/providers/ldap/auth-provider-ldap.service.spec.ts
index 0c73ac89..076b607d 100644
--- a/backend/src/authentication/providers/ldap/auth-provider-ldap.service.spec.ts
+++ b/backend/src/authentication/providers/ldap/auth-provider-ldap.service.spec.ts
@@ -73,7 +73,7 @@ describe(AuthProviderLDAP.name, () => {
options: {
autoCreateUser: true,
autoCreatePermissions: [],
- enablePasswordAuthFallback: true
+ enablePasswordAuthFallback: false
}
}
const next: AuthProviderLDAPConfig = {
@@ -216,6 +216,7 @@ describe(AuthProviderLDAP.name, () => {
})
it('should fallback to local auth when LDAP is unavailable and fallback is enabled', async () => {
+ setLdapConfig({ options: { enablePasswordAuthFallback: true } })
const existingUser: any = buildUser({ id: 2 })
usersManager.findUser.mockResolvedValue(existingUser)
usersManager.logUser.mockResolvedValue(existingUser)
diff --git a/environment/environment.dist.yaml b/environment/environment.dist.yaml
index 718503ce..10f73a6e 100755
--- a/environment/environment.dist.yaml
+++ b/environment/environment.dist.yaml
@@ -197,11 +197,11 @@ auth:
# If not set, existing administrator users keep their role and it cannot be removed via LDAP.
# optional
adminGroup:
- # enablePasswordAuthFallback: Allow local password authentication when LDAP authentication fails.
- # When enabled, users can authenticate with their local password if the LDAP service is unavailable.
+ # enablePasswordAuthFallback: Allow local password authentication for regular users when the LDAP service is unavailable.
+ # Applies only to LDAP connection/DNS/timeout errors after all configured LDAP servers fail.
# Always allowed for administrator users (break-glass access).
- # default: true
- enablePasswordAuthFallback: true
+ # default: false
+ enablePasswordAuthFallback: false
oidc:
# issuerUrl: The URL of the OIDC provider's discovery endpoint
# e.g.: