LDAP/AD sync aborts entirely when two directory users share the same e-mail address
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 72/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- postgresql, rust
- Área
- authentication, backend, databases
Línea de trabajo
Start with crates/defguard_core/src/enterprise/ldap/sync.rs at the import path around lines 1133-1169 and apply_user_modifications around line 629; compare the conflict handling in directory_sync/mod.rs:867-897. Reproduce the duplicate-mail case, then verify that the conflicting user is skipped, both users are named in the error, and the remaining sync operations continue instead of rolling back.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Component: defguard core – enterprise/ldap/sync.rs
Version: 2.1.0 (also present on current main)
Description
user.email has a case-insensitive unique index (email_unique_idx, migration 20241204113104_case_insensitive_email). The LDAP sync only checks for username collisions before importing a user, never for e-mail collisions. If two AD accounts carry the same mail attribute (e.g. personal account + admin account, or a shared-mailbox account), User::save() hits the unique violation, the error propagates via ?, the whole transaction is rolled back and the entire sync run fails. All other pending adds/updates/deletes of that run are lost as well.
Affected code paths
- Import: crates/defguard_core/src/enterprise/ldap/sync.rs:1133-1169 – only find_by_username is checked; user.save() at line 1169 fails on duplicate e-mail.
- Update: apply_user_modifications, sync.rs:629 – changing a user's e-mail in AD to an address already used by another Defguard user fails the same way.
- User::save() is a plain INSERT without ON CONFLICT (crates/defguard_common/src/db/models/user.rs:1138).
Steps to reproduce
- Create two AD users alice and alice-admin, both with mail = [email protected].
- Enable LDAP sync (AD, LDAP as authority).
- Trigger sync.
Actual behaviour
Sync fails with a Postgres unique-constraint error on email_unique_idx. No users from that run are imported or updated.
Expected behaviour
Same as the OIDC directory sync (directory_sync/mod.rs:867-897): detect the conflict via User::find_by_email, log an error naming both users, skip that single user and continue the sync. Ideally also surface the conflict in the sync-preview/dry-run.
Workaround
Ensure unique mail attributes in AD or exclude the conflicting account via the LDAP user search filter / sync group.
- Lenguaje dominante
- Rust
- Estrellas
- 2.9k
- Forks
- 121
- Merge medio
- 20 h 7 min
- PR fusionados (30 d)
- 88
Preparar el entorno
- Incluye un Dockerfile o un archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de DefGuard/defguard
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
Los mantenedores suelen responder en 1 día
-
Set focus to PIN field after user clicks connect when MFA method is security key (UX improvement)Posiblemente ocupada @t-aleksander la tomó hace 6 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
DefGuard/defguard#3877 · 1 comentario · 1 asignado ·
Los mantenedores suelen responder en 1 día
-
Show test connection result in the UIPosiblemente ocupada @t-aleksander la tomó hace 6 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
DefGuard/defguard#3851 · 4 comentarios · 1 asignado ·
Los mantenedores suelen responder en 1 día
-
Invalid hover on the OS delete in posture check edit formPosiblemente ocupada @kchudy la tomó hace 3 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
DefGuard/defguard#3842 · 2 asignados ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Los mantenedores suelen responder en 1 día
Todos los issues de DefGuard/defguard
Issues similares
-
units: No `#` in rustdoc headingAbierto
Dificultad 1/5 Menos de una hora Aptitud para principiantes 67/100
rust-bitcoin/rust-bitcoin#7089 · 1 comentario · 1 reacción ·
Los mantenedores suelen responder en 2 días
-
area/tools bug session-analysis
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
[Bug]: Python OpenTelemetrySectionConfig has no file_sinksQuizá libre de nuevo Un pull request para esta issue se cerró sin fusionarse. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
NVIDIA/NeMo-Relay#1514 ·
Los mantenedores suelen responder en 1 día
-
prompting proposal tool triaged
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
can1357/oh-my-pi#17041 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
README crane example out of dateAbierto
Dificultad 1/5 Menos de una hora Aptitud para principiantes 84/100
nix-community/fenix#262 ·