Skip to sessions and notes

These session notes are AI-generated and may contain mistakes. Verify important details against the original recording.

Securing Your NuGet Dependencies in the Age of AI

Jon Douglas

Session · 21:30 recording · 7 min read

At a glance

  • Client defenses: Package Cooldown (configurable 3-day buffer skipping fresh zero-day packages)
  • Deprecation of auto-run PowerShell scripts (init.ps1/install.ps1) in Visual Studio 18.14
  • Staged publishing CLI (dotnet package stage): private staged holding status & atomic promotion
  • Homograph / typosquatting defense: deprecation & warnings for non-ASCII Unicode package IDs
  • Registry hardening: Trusted Publishing via OIDC reaching 41% (targeting 70%), eliminating API keys

Executive Summary

"Every package that you restore is code that you choose to trust."

In this critical security session, Jon Douglas outlines Microsoft's comprehensive roadmap for securing the .NET package supply chain in the era of autonomous AI agents and rapid dependency consumption. As autonomous coding agents and developers restore millions of packages daily, attack vectors—such as typo-squatting, credential leaks, malicious script execution, and instant zero-day payload pushes—have escalated.

Microsoft introduces structural protections spanning four domains:

  1. NuGet Client Innovations:
    • Package Cooldown: Configurable time buffers (e.g., 3 days) in the .NET 11.2 CLI and Visual Studio 18.14, automatically skipping newly published package versions until they have been vetted by the ecosystem.
    • Deprecation of Auto-Run Scripts: Visual Studio 18.14 completely eliminates automatic execution of legacy init.ps1 and install.ps1 PowerShell package scripts.
    • Staged Publishing & Grouping: dotnet package stage allows authors to push packages privately for pre-release validation before atomic public promotion.
    • Homograph Attack Warnings: Deprecation of non-ASCII lookalike characters in package IDs (e.g. Cyrillic lookalikes mimicking Newtonsoft.Json).
  2. NuGet.org Registry Hardening:
    • Trusted Publishing (OIDC): Phasing out permanent API keys in favor of short-lived OpenID Connect tokens from GitHub Actions and GitLab (reaching 41% adoption, targeting 70%).
    • 30-Day API Key Lifetimes: All legacy API keys exceeding 30 days expired automatically on November 1st, enforcing credential rotation.
    • Proof of Presence: Enforcing 2FA human verification before staged package groups are released publicly.
    • Minutes-to-Removal Triage: Comprehensive upload-time malware scanning reducing report-to-removal triage from days/hours to minutes.
  3. AI Agent Tooling & Guardrails:
    • "Secure My Supply Chain" MCP Server: An official Model Context Protocol tool in Visual Studio providing 11–18 second deterministic supply chain audits directly against NuGet.org feeds.
    • Skills Inside Packages (skills/skill.md): Authors can embed markdown skill files directly into .nupkg archives, instructing AI agents on safe API usage and configuration patterns.
  4. Future Roadmap: Detached signatures via NuGet Signing v2 and standardized Package End-of-Life (EOL) lifecycle metadata.

Secure Supply Chain Architecture & Lifecycle

The modern NuGet security architecture enforces verification gates at authoring, publishing, registry indexing, and client consumption stages:

flowchart TD
    subgraph Authoring ["Package Authoring & CI/CD"]
        CI["CI Build (GitHub Actions / GitLab)"]
        OIDC["OIDC Token Exchange<br/>(Trusted Publishing - No API Keys)"]
        StageCmd["dotnet package stage push<br/>(Private Staging Group)"]
    end

    subgraph Registry ["NuGet.org Registry Engine"]
        MalwareScan["Automated Upload Malware Scanners"]
        ProofOfPresence{"Proof of Presence Gate<br/>(Human 2FA Verification)"}
        PublicRelease["Public Registry Listing"]
        FastRemoval["Minutes-to-Removal Pipeline<br/>(Malware / Typosquatting Triage)"]
    end

    subgraph Client ["Client Consumption & AI Agents"]
        Cooldown{"Package Cooldown Gate<br/>(e.g., 3-Day Buffer)"}
        Skip["Skip Untrusted New Version<br/>(Protect from Zero-Day Attack)"]
        Restore["Safe Restore Allowed"]
        MCPAudit["'Secure My Supply Chain' MCP Agent<br/>(Audits CPM, nuget.config, CVEs in 15s)"]
        AgentSkills["Agent Reads skills/skill.md<br/>(Enforces Safe Code Generation)"]
    end

    CI --> OIDC --> StageCmd --> Registry
    StageCmd --> MalwareScan --> ProofOfPresence
    ProofOfPresence -- "Owner Confirms" --> PublicRelease
    PublicRelease -. "Active Threats Detected" .-> FastRemoval
    PublicRelease --> Cooldown
    Cooldown -- "< 3 Days Old" --> Skip
    Cooldown -- ">= 3 Days Old" --> Restore
    Restore --> MCPAudit
    Restore --> AgentSkills

Key Technical Pillars

1. NuGet Client Security Innovations

Package Cooldown

Fast-moving supply chain attacks often push weaponized versions of popular packages, hoping automated CI/CD pipelines will pull them before security researchers react.

  • Introduced in .NET 11.2 CLI and Visual Studio 18.14 (Package Manager UI & Console).
  • Developers configure a cooldown duration (e.g., 3 days). If a version was published 6 hours ago, dotnet add package or restore ignores it, shielding the project from zero-day compromises until community vetting concludes.

Session Introduction
Session Introduction

Jon Douglas presents 'Securing the NuGet Supply Chain for Developers and Their Agents'.

Package Cooldown
Package Cooldown

Configuring a 3-day NuGet cooldown window to automatically skip unvetted package releases.

No More Auto-Run Package Scripts

Historically, packages targeting .NET Framework or Entity Framework executed init.ps1 or install.ps1 PowerShell scripts automatically whenever Visual Studio loaded the solution.

  • Breaking Change in VS 18.14: Visual Studio will no longer auto-execute PowerShell scripts embedded in packages.
  • Developers must explicitly approve and execute scripts, mitigating remote code execution vectors during solution load. Package authors are instructed to migrate build logic to declarative MSBuild .targets.

No More Auto-Run Scripts
No More Auto-Run Scripts

Visual Studio 18.14 disabling automatic execution of legacy init.ps1/install.ps1 PowerShell scripts.

Staged Publishing from the CLI

Developers can now push packages into a private holding status:

# Push package to private staged status
dotnet package stage Contoso.Core.1.0.0.nupkg --group "Contoso-v1.0"

# Check status of staging group
dotnet package stage status --group "Contoso-v1.0"

# Atomically publish and list all packages in the group
dotnet package stage publish --group "Contoso-v1.0" --list

Stage Publishing CLI
Stage Publishing CLI

CLI commands for staging, grouping, and atomically publishing package batches.

Homograph Attack Deprecation

Attackers have used lookalike Unicode characters (e.g. Cyrillic letters identical in appearance to Latin characters) to spoof trusted packages like Newtonsoft.Json.

  • In .NET 12 preview, NuGet clients emit explicit warnings when referencing non-ASCII package IDs, neutralizing typosquatting visual deceptions.

Homograph Attack Warning
Homograph Attack Warning

Deprecating non-ASCII package IDs to prevent visual homograph impersonation attacks.


2. NuGet.org Registry Hardening

Trusted Publishing (OIDC) & API Key Expiration

  • Trusted Publishing: Eliminates static API secrets. CI/CD runners (GitHub Actions, GitLab, and Azure DevOps in development) exchange short-lived OIDC tokens directly with NuGet.org.
  • Adoption: 41% of monthly publishes now use Trusted Publishing (approaching Microsoft's 70% target).
  • Hard Expiration: All newly minted API keys expire in 30 days or less. Existing long-lived API keys older than 30 days were permanently expired on November 1st.

Trusted Publishing Adoption Stats
Trusted Publishing Adoption Stats

Trusted Publishing adoption reaches 41%, eliminating persistent API keys in CI/CD.

API Key Expiration Reduced to 30 Days
API Key Expiration Reduced to 30 Days

Reducing API key lifetime to 30 days to mitigate credential leaks.

Proof of Presence & Staging Portal

Staged packages undergo automated malware scanning, digital signature validation, and metadata integrity checks while remaining unlisted.

  • Proof of Presence Gate: Once validations pass, package owners log into NuGet.org and verify their identity via 2FA before pressing the "Promote Group" button, releasing multi-package updates atomically.

Staged Publishing Flow
Staged Publishing Flow

Staging lifecycle: private upload -> malware validation -> proof of presence -> public listing.

Staging Groups Portal
Staging Groups Portal

NuGet.org Staging Groups management interface with atomic 'Promote Group' action.

Minutes-to-Removal Malicious Package Triage

  • NuGet.org now runs deep heuristic and signature malware scanners on every package upload.
  • Malicious package report-to-takedown latency has dropped from days or hours to minutes.
  • A 30-day package restoration window allows publishers to reverse false-positive detections.

Report to Removal in Minutes
Report to Removal in Minutes

Takedown response time reduced from days/hours down to minutes upon threat detection.


3. Securing the Supply Chain for AI Agents

"Secure My Supply Chain" MCP Tool

With autonomous AI agents altering dependencies, Microsoft introduces the Secure My Supply Chain MCP Server for Visual Studio and Copilot:

  • Accessible directly from the Package Manager UI, Package Sources settings, or MSBuild Error List.
  • Connects directly to real-time NuGet.org security feeds rather than relying on stale LLM training data.
  • Audits Directory.Packages.props, nuget.config, package source mappings, and project files in 11–18 seconds, providing token-optimized security hardening recommendations.

Secure My Supply Chain MCP Server
Secure My Supply Chain MCP Server

Introducing the 'Secure My Supply Chain' Model Context Protocol (MCP) server.

MCP Agent Audit Demo
MCP Agent Audit Demo

AI agent auditing package vulnerability data, Central Package Management, and source mappings in seconds.

Embedding Skills Inside NuGet Packages (skills/skill.md)

In .NET 11, package authors can ship agentic documentation directly inside their package archives:

  • Located at /skills/skill.md inside the .nupkg.
  • Informs tools like GitHub Copilot, Claude Code, and Codex how to properly consume the library (e.g., "Always configure clients via services.AddContosoHttpClient()", "Never set ServerCertificateCustomValidationCallback to true").
  • Eliminates manual prompt engineering and grounds coding agents in author-approved security practices.

Skills Inside NuGet Packages
Skills Inside NuGet Packages

Shipping skills/skill.md inside .nupkg to guide AI agent code generation.


4. Roadmap & Future Innovations

  • Package End of Life (EOL) Metadata: Formalizing an industry-standard lifecycle metadata schema distinct from "deprecated", clearly alerting developers and agents when a package version has exited active maintenance.
  • NuGet Signing v2: Introducing detached cryptographic signatures, enabling package signing without modifying the raw binary .nupkg archive.
  • Client Update Notifications: Native notifications in dotnet and nuget.exe when newer client tooling is available.

Roadmap EOL and Signing v2
Roadmap EOL and Signing v2

NuGet roadmap: Package End of Life (EOL) statuses, NuGet Signing v2, and client update notifications.


Actionable Steps for Developers This Week

Jon concludes with four critical tasks for engineering teams:

  1. Turn on Package Cooldown: Enable cooldown policies in .NET 11.2 or Visual Studio 18.14 to insulate your codebase from zero-day supply chain attacks.
  2. Migrate to Trusted Publishing: Transition CI/CD workflows from permanent API keys to OIDC before 30-day key expirations disrupt automated deployments.
  3. Audit Legacy PowerShell Install Scripts: Review packages relying on init.ps1 or install.ps1 before upgrading to Visual Studio 18.14.
  4. Deploy the NuGet MCP Agent: Use "Secure My Supply Chain" in Visual Studio to benchmark repository security posture against official NuGet.org telemetry.

Actionable Takeaways
Actionable Takeaways

Summary of immediate security actions: Cooldown, Trusted Publishing, script audit, and MCP.