LDAP/AD sync aborts entirely when two directory users share the same e-mail address
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 72/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- postgresql, rust
- Ambito
- authentication, backend, databases
Direzione di ricerca
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.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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.
- Lingua principale
- Rust
- Stelle
- 2.9k
- Fork
- 121
- Merge medio
- 22h 6m
- PR unite (30g)
- 64
Preparare l'ambiente
- Include un Dockerfile o un file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di DefGuard/defguard
-
Set focus to PIN field after user clicks connect when MFA method is security key (UX improvement)Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
DefGuard/defguard#3851 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
Invalid hover on the OS delete in posture check edit formForse già presa @jakub-tldr l’ha presa 6 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
DefGuard/defguard#3842 · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
Prevent setting "Defguard URL" and "Defguard public URL" to the same addressForse già presa @jakub-tldr l’ha presa 3 giorni fa. Apertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
DefGuard/defguard#3751 · 1 commento · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di DefGuard/defguard
Issue simili
-
documentation
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
IntersectMBO/developer-experience#347 ·
I maintainer di solito rispondono entro 2 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
registrystack/registry-stack#2168 ·
I maintainer di solito rispondono entro 1 giorno
-
bug crate: 3d help wanted triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
kornia/kornia-rs#1203 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
I maintainer di solito rispondono entro 1 giorno
-
[Bug] ComponentType classifies 0x8A8A-0xEAEA as GREASE; mls-extensions §7.5 makes them private useAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
I maintainer di solito rispondono entro 1 giorno