Skip to content

feat: resolve nuget owner handles via github contributor verification [CM-1341] - #4364

Merged
mbani01 merged 3 commits into
mainfrom
feat/resolve_nuget_owners_github_handles
Jul 20, 2026
Merged

feat: resolve nuget owner handles via github contributor verification [CM-1341]#4364
mbani01 merged 3 commits into
mainfrom
feat/resolve_nuget_owners_github_handles

Conversation

@mbani01

@mbani01 mbani01 commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

This pull request refactors and enhances the extraction of candidate GitHub handles from package registries (NuGet and RubyGems) to improve maintainability and consistency. It introduces a shared utility for generating handle candidates, updates the NuGet extractor to emit owner handles, and simplifies the RubyGems extractor logic.

Handle extraction improvements:

  • Added a new utility function toHandleCandidates in handles.ts to generate deduplicated, provenance-rich candidate GitHub handles for maintainers. This function is now used by both NuGet and RubyGems extractors to standardize candidate handle generation.

NuGet extractor enhancements:

  • Updated nuget.ts to fetch and emit candidate owner handles from the NuGet search API, using the new toHandleCandidates utility. The extractor now returns these candidates in the handleCandidates field, improving downstream corroboration of maintainers. [1] [2] [3]

RubyGems extractor simplification:

  • Refactored mapRubygemsOwnerHandles in rubygems.ts to use the shared toHandleCandidates function, reducing code duplication and improving clarity. [1] [2]

Signed-off-by: Mouad BANI <mouad-mb@outlook.com>
@mbani01 mbani01 self-assigned this Jul 20, 2026
Copilot AI review requested due to automatic review settings July 20, 2026 11:30
@cursor

cursor Bot commented Jul 20, 2026

Copy link
Copy Markdown

PR Summary

Low Risk
Additive registry metadata and refactor only; candidates remain unverified until existing verifyHandleCandidates runs, with search failures swallowed as empty lists.

Overview
NuGet security-contact extraction now pulls package owner usernames from the NuGet search API (resolved via the V3 service index, same pattern as fetchSearch) and returns them as handleCandidates for downstream GitHub contributor verification. Version lookup and owner fetch run in parallel; candidates are still returned when nuspec fetch fails.

A shared toHandleCandidates helper deduplicates registry strings into tier-B github-handle maintainer candidates with provenance. RubyGems mapRubygemsOwnerHandles is refactored to use it instead of inline logic.

resolveEndpoints in the NuGet client is exported so the security-contacts extractor can resolve the search base URL without duplicating service-index logic.

Reviewed by Cursor Bugbot for commit bf5172c. Bugbot is set up for automated code reviews on this repo. Configure here.

@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@mbani01 mbani01 changed the title feat: resolve nuget owner handles via github contributor verification feat: resolve nuget owner handles via github contributor verification [CM-1341] Jul 20, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Introduces shared registry-handle candidate generation and adds NuGet owner candidates for downstream GitHub contributor verification.

Changes:

  • Adds deduplicated, provenance-rich handle candidate generation.
  • Extracts NuGet owner handles from search results.
  • Reuses the utility for RubyGems owners.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
handles.ts Adds shared candidate generation.
nuget.ts Fetches and maps NuGet owners.
rubygems.ts Reuses shared handle mapping.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread services/apps/packages_worker/src/security-contacts/extractors/registry/nuget.ts Outdated
Comment thread services/apps/packages_worker/src/security-contacts/extractors/registry/nuget.ts Outdated
mbani01 added 2 commits July 20, 2026 12:43
Signed-off-by: Mouad BANI <mouad-mb@outlook.com>
Signed-off-by: Mouad BANI <mouad-mb@outlook.com>
Copilot AI review requested due to automatic review settings July 20, 2026 11:48

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ 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 bf5172c. Configure here.

if (!text) return { contacts: [], policies: {} }
return { contacts: mapNuspec(text, url, new Date().toISOString()), policies: {} }
if (!text) return { contacts: [], policies: {}, handleCandidates }
return { contacts: mapNuspec(text, url, fetchedAt), policies: {}, handleCandidates }

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Candidates lost on fetch errors

Medium Severity

fetchNuget loads owner handleCandidates in parallel with the version index, but a thrown error from latestStableVersion (via Promise.all) or from the later nuspec fetchText rejects the whole extractor. extractManifest then skips the package, discarding handle candidates that were already fetched successfully.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit bf5172c. Configure here.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

fetchedAt: string,
): Promise<RawContact[]> {
try {
const { searchBaseUrl } = await resolveEndpoints()
sourceUrl: string,
fetchedAt: string,
): RawContact[] {
const data = (doc as any)?.data
@mbani01
mbani01 merged commit f8db58f into main Jul 20, 2026
14 checks passed
@mbani01
mbani01 deleted the feat/resolve_nuget_owners_github_handles branch July 20, 2026 11:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants