LDAP/AD sync aborts entirely when two directory users share the same e-mail address
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 72/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- postgresql, rust
調査の方向性
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.
索引モデルが issue の本文から書いたものです。
説明
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.
- 主要言語
- Rust
- スター
- 2.9k
- フォーク
- 121
- 平均マージ
- 21時間 35分
- マージ済み PR(30日)
- 68
環境構築
- Dockerfile または Docker Compose ファイルあり
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
DefGuard/defguard のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
DefGuard/defguard#3851 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
Invalid hover on the OS delete in posture check edit form対応中かも @jakub-tldr が 3 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
DefGuard/defguard#3842 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
-
Prevent setting "Defguard URL" and "Defguard public URL" to the same address対応中かも @jakub-tldr が今日担当しました。 オープンbug
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
DefGuard/defguard#3751 · コメント 1 件 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
-
Button overlaps with steps during animation in MFA Flow Editor対応中かも @t-aleksander が 1 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
メンテナーはふだん 1 日以内に返信
DefGuard/defguard の issue をすべて見る
似ている issue
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
メンテナーはふだん 1 日以内に返信
-
area:cli bug good first issue priority:medium
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 85/100
メンテナーはふだん 1 日以内に返信
-
dependencies effort:low flow:chore rust
難易度 2/5 1〜3時間 初心者へのやさしさ 64/100
jaroslawherod/micold-ai-ide#875 ·
メンテナーはふだん 1 日以内に返信
-
priority: low
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
storytold/photocraft#6286 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信