Skip to content

.NET: Update GitHub.Copilot.SDK to 1.0.0-beta.2 to address NU1903 - #5697

Closed
Roger Barreto (rogerbarreto) with Copilot wants to merge 3 commits into
mainfrom
copilot/fix-nerdbank-messagepack-vulnerability
Closed

.NET: Update GitHub.Copilot.SDK to 1.0.0-beta.2 to address NU1903#5697
Roger Barreto (rogerbarreto) with Copilot wants to merge 3 commits into
mainfrom
copilot/fix-nerdbank-messagepack-vulnerability

Conversation

CopilotAI commented May 7, 2026

Copy link
Copy Markdown
Contributor

Motivation and Context

GitHub.Copilot.SDK 0.1.29 transitively pulls Nerdbank.MessagePack 1.0.2 (via StreamJsonRpc), which has a known high severity vulnerability (GHSA-2cwq-pwfr-wcw3 — attacker-controlled stackalloc in DateTime decoding causes a process-terminating StackOverflowException, fixed in 1.1.62). This surfaces as NU1903 errors and breaks the build under TreatWarningsAsErrors.

Per review feedback, since we don't depend on Nerdbank.MessagePack directly, the cleaner fix is to upgrade GitHub.Copilot.SDK itself rather than pin the transitive dependency — the newer SDK releases (1.0.0-beta.1/1.0.0-beta.2) no longer reference StreamJsonRpc/Nerdbank.MessagePack at all.

Description

  • Bumped GitHub.Copilot.SDK from 0.1.29 to the latest 1.0.0-beta.2 in dotnet/Directory.Packages.props. Its only dependencies are now Microsoft.Extensions.AI.Abstractions, Microsoft.Extensions.Logging.Abstractions, and System.Text.Json, eliminating the vulnerable chain.
  • Adapted call sites in Microsoft.Agents.AI.GitHub.Copilot, the Agent_With_GitHubCopilot sample, and the unit/integration tests to match the new SDK API:
    • UserMessageDataAttachmentsItem / UserMessageDataAttachmentsItemFileUserMessageAttachmentFile
    • McpLocalServerConfig (stdio) / McpRemoteServerConfig (http) → McpStdioServerConfig / McpHttpServerConfig (the explicit Type discriminator is no longer needed)
    • McpServers dictionary value type changed from object to the new McpServerConfig base type
    • PermissionRequestResult.Kind is now strongly typed: stringPermissionRequestResultKind enum (Approved / Rejected)

Verified dotnet build succeeds with 0 warnings/errors across net8.0/net9.0/net10.0 for the src project, unit tests, integration tests, and the sample. All 45 unit tests pass.

Note: there is overlap with #5699 which performs the same SDK upgrade; either PR can supersede the other.

Contribution Checklist

  • The code builds clean without any errors or warnings
  • The PR follows the Contribution Guidelines
  • All unit tests pass, and I have added new tests where possible
  • Is this a breaking change? If yes, add "[BREAKING]" prefix to the title of the PR.

Agent-Logs-Url: https://github.com/microsoft/agent-framework/sessions/d9d91295-72ca-4a34-ac27-2b97ea1abcfe
Co-authored-by: rogerbarreto <19890735+rogerbarreto@users.noreply.github.com>
CopilotAI review requested due to automatic review settings May 7, 2026 14:57
CopilotAI removed the request for review from CopilotMay 7, 2026 14:57
@rogerbarreto
Roger Barreto (rogerbarreto) marked this pull request as ready for review May 7, 2026 14:58
CopilotAI review requested due to automatic review settings May 7, 2026 14:58
@moonbox3Evan Mattson (moonbox3) added the .NET Usage: [Issues, PRs], Target: .Net label May 7, 2026
@github-actionsgithub-actionsBot changed the title Pin Nerdbank.MessagePack to 1.1.62 to address NU1903.NET: Pin Nerdbank.MessagePack to 1.1.62 to address NU1903May 7, 2026

CopilotAI 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

Pins a vulnerable transitive dependency (Nerdbank.MessagePack) via .NET Central Package Management to eliminate NU1903 failures caused by GitHub.Copilot.SDK’s transitive dependency graph.

Changes:

  • Adds a central transitive pin for Nerdbank.MessagePack to version 1.1.62 in dotnet/Directory.Packages.props.
  • Documents the security motivation inline (GHSA-2cwq-pwfr-wcw3 / NU1903).

@lokitoth

Jacob Alber (lokitoth) commented May 7, 2026

Copy link
Copy Markdown
Contributor

We don't rely directly on Nerdbank.MessagePack, we get it through the GitHub.Copilot.SDK; should we just update that dependency instead (since the later ones, 1.0.0-beta.1 and 1.0.0-beta.2 don't include the transitive dependency that pulled this in: StreamJsonRpc)? (PR here)

(Happy to do it either way, so approving now, but wanted to raise awareness)

@lokitoth
Jacob Alber (lokitoth) added this pull request to the merge queueMay 7, 2026
@lokitoth
Jacob Alber (lokitoth) removed this pull request from the merge queue due to a manual request May 7, 2026
@lokitoth

Copy link
Copy Markdown
Contributor

(Sorry, wrong tab; did not mean to trigger merge queue)

@rogerbarreto

Copy link
Copy Markdown
Member

Copilot Please follow suggestion from Jacob Alber (@lokitoth), please check most recent version from the SDK

We don't rely directly on Nerdbank.MessagePack, we get it through the GitHub.Copilot.SDK; should we just update that dependency instead

….MessagePack)
Agent-Logs-Url: https://github.com/microsoft/agent-framework/sessions/87766014-7331-4d2c-bf53-d59097d66021
Co-authored-by: rogerbarreto <19890735+rogerbarreto@users.noreply.github.com>

CopilotAI commented May 7, 2026

Copy link
Copy Markdown
ContributorAuthor

Copilot Please follow suggestion from Jacob Alber (@lokitoth), please check most recent version from the SDK

We don't rely directly on Nerdbank.MessagePack, we get it through the GitHub.Copilo...

Done in cf5b467 — upgraded GitHub.Copilot.SDK to the latest 1.0.0-beta.2 (which no longer pulls in StreamJsonRpc / Nerdbank.MessagePack) and removed the transitive pin. Adapted call sites to the new SDK API (UserMessageAttachmentFile, McpStdioServerConfig/McpHttpServerConfig, Dictionary<string, McpServerConfig>, PermissionRequestResultKind enum). Builds clean on net8/9/10 and all 45 unit tests pass.

We don't rely directly on Nerdbank.MessagePack, we get it through the GitHub.Copilot.SDK; should we just update that dependency instead (since the later ones, 1.0.0-beta.1 and 1.0.0-beta.2 don...

Switched approach in cf5b467 to upgrade GitHub.Copilot.SDK to 1.0.0-beta.2 instead of pinning the transitive — drops the Nerdbank.MessagePack/StreamJsonRpc chain entirely. (Note: there is overlap with #5699; happy to defer if that one merges first.)

CopilotAI changed the title .NET: Pin Nerdbank.MessagePack to 1.1.62 to address NU1903.NET: Update GitHub.Copilot.SDK to 1.0.0-beta.2 to address NU1903May 7, 2026
@rogerbarreto

Copy link
Copy Markdown
Member

@github-project-automationgithub-project-automationBot moved this from In Review to Done in Agent FrameworkMay 7, 2026
@rogerbarreto
Roger Barreto (rogerbarreto) deleted the copilot/fix-nerdbank-messagepack-vulnerability branch May 7, 2026 18:24
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

.NETUsage: [Issues, PRs], Target: .Net

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

6 participants

@lokitoth@rogerbarreto@westey-m@moonbox3