feat(security-contacts): resolve GitHub handles to emails using cdp identities [CM-1323]#4342
Conversation
Signed-off-by: Mouad BANI <mouad-mb@outlook.com>
Signed-off-by: Mouad BANI <mouad-mb@outlook.com>
Signed-off-by: Mouad BANI <mouad-mb@outlook.com>
Signed-off-by: Mouad BANI <mouad-mb@outlook.com>
Signed-off-by: Mouad BANI <mouad-mb@outlook.com>
PR SummaryMedium Risk Overview The packages worker gains Operations: the security-contacts Temporal schedule, Docker compose env, and npm scripts now use a dedicated Reviewed by Cursor Bugbot for commit 178f6c0. Bugbot is set up for automated code reviews on this repo. Configure here. |
|
|
There was a problem hiding this comment.
Pull request overview
This PR enhances the packages_worker security-contacts ingestion flow by adding a CDP (main Crowd DB) lookup step to resolve github-handle contacts into email contacts, and adjusting scoring so CDP-derived provenance affects confidence/quality appropriately.
Changes:
- Added a new DAL query (
findResolvableEmailsForMembers) to fetch member emails (and promote certain identities to “verified”). - Introduced a CDP DB config + connection helper in
packages_worker, and plumbed a secondQueryExecutorthrough security-contacts activities/batch/single ingest. - Added
resolveCdpEmailsplus scoring updates to (a) avoid countingcdp-*sources as corroboration and (b) penalize CDP-unverified emails.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| services/libs/data-access-layer/src/members/identities.ts | Adds a DAL helper to fetch resolvable (verified/unverified) emails for a set of member IDs. |
| services/apps/packages_worker/src/security-contacts/score.ts | Updates scoring to treat cdp-* provenance differently (no corroboration; penalties for unverified). |
| services/apps/packages_worker/src/security-contacts/resolveCdpEmails.ts | New resolver that maps GitHub handles → member IDs → emails and emits enriched email contacts with CDP provenance. |
| services/apps/packages_worker/src/security-contacts/processBatch.ts | Wires CDP resolution into per-repo processing and updates batch function signature to accept cdpQx. |
| services/apps/packages_worker/src/security-contacts/ingestSingle.ts | Updates on-demand ingest to accept/pass cdpQx. |
| services/apps/packages_worker/src/security-contacts/activities.ts | Initializes both packages DB and CDP DB connections and passes them into batch/single activities. |
| services/apps/packages_worker/src/db.ts | Adds getCdpDb() helper. |
| services/apps/packages_worker/src/config.ts | Adds getCdpDbConfig() using CROWD_DB_* env vars. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Signed-off-by: Mouad BANI <mouad-mb@outlook.com>
Signed-off-by: Mouad BANI <mouad-mb@outlook.com>
Signed-off-by: Mouad BANI <mouad-mb@outlook.com>
Signed-off-by: Mouad BANI <mouad-mb@outlook.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit eb629f3. Configure here.
| } catch (err) { | ||
| log.warn( | ||
| { repoId: target.repoId, errMsg: (err as Error).message }, | ||
| 'CDP email resolution failed — proceeding without resolved emails', | ||
| ) | ||
| } |
| AND type = $(usernameType) | ||
| AND verified = true |
| ) | ||
|
|
||
| return scored.slice(0, MAX_CONTACTS) | ||
| return scored |

This pull request enhances the security contacts ingestion pipeline by integrating a new process to resolve GitHub handles to member emails using the CDP database. The update introduces a new database connection, adds logic to enrich contacts with resolved emails, and adjusts the contact scoring to account for the provenance and verification status of these emails.
Security contacts enrichment and scoring improvements:
getCdpDbConfigfunction inconfig.tsand correspondinggetCdpDbhelper indb.tsto support connecting to the CDP database. [1] [2]resolveCdpEmailsfunction, which maps GitHub handles to member IDs and fetches associated emails (verified and unverified) from the CDP, enriching contacts with these resolved email addresses. [1] [2] [3]Database query improvements:
findResolvableEmailsForMembersin the data-access layer to efficiently fetch both verified and unverified emails for a set of member IDs, including logic to promote username-verified emails.