NuGet.org can now hold a package until a human promotes it. Give your agent's release workflow a key that can only stage
Staged publishing, announced on 17 November, splits uploading a package from releasing it. A stage-only credential, a 30-line diff check and one click on the website put a person between an agent-written pipeline and your consumers.

NuGet.org now lets a package sit in a private holding area, fully validated, until a person with two-factor authentication promotes it on the website. The .NET team announced staged publishing on 17 November 2026, and it changes what a release pipeline needs to be trusted with. If an agent writes or edits your publish workflow, that workflow no longer has to hold the power to release.
That’s the case worth making here, because it’s where the earlier advice (read the workflow carefully) runs out. A pipeline that can push to NuGet.org can ship whatever it builds, to every consumer who restores the next version. A pipeline that can only stage can ship nothing. The earlier posts on this site covered what an agent adds to your dependencies, such as npm 12’s blocked install scripts . This is the other end: what leaves your repository.
What staging does
According to the announcement, an uploaded package goes through the usual NuGet.org validation (malware scanning, signature checks, repository signing) but stays out of public pages, search and restore until it’s promoted. Promotion is a deliberate action on the website, “Promote” for one package or “Promote group” for a bundle, and it needs an authorised user signed in with two-factor authentication enabled. Existing dotnet nuget push workflows keep working. Staging is opt-in.
From the command line, the post shows dotnet package stage push, in the .NET 11 RC2 SDK:
dotnet package stage push ./artifacts/Contoso.Library.1.2.0.nupkg \
--source https://api.nuget.org/v3/index.json \
--api-key "$NUGET_API_KEY" \
--group november-release
Without --group the package is staged on its own. With it, NuGet.org creates the group if it doesn’t exist. Listing and group management commands are shown only as a roadmap, and the post says promotion will stay website-only. Check that your installed SDK has the command with dotnet package stage push --help before you build a pipeline around it, since the post names a release candidate.
The part that matters for agents: the key
The security value sits in two sentences of the announcement. A staging-only API key “can upload staged packages but cannot use the normal push path to publish them directly”, and Trusted Publishing policies can also be restricted to staging only.
Trusted Publishing is NuGet.org’s keyless route. According to the Microsoft Learn page, the workflow exchanges a GitHub OIDC token for a temporary API key that’s valid for 1 hour, and each token yields one key. The policy names a repository owner, a repository, the workflow file name (the file name only, not the path) and optionally a GitHub environment. The documented workflow uses NuGet/login@v1 with id-token: write.
Put the two together and you get a release job with no stored secret and no way to publish. The sketch below is assembled from the two pages, not run: the login step and permissions are from the Trusted Publishing docs, the stage command is from the announcement, and the policy itself is set on nuget.org, not in the file.
name: release
on:
push:
tags: ["v*"]
jobs:
stage:
runs-on: ubuntu-latest
environment: release
permissions:
id-token: write
contents: read
steps:
- uses: actions/checkout@v4
- uses: actions/setup-dotnet@v4
with:
dotnet-version: 11.0.x
- run: dotnet pack -c Release -o artifacts
- name: NuGet login (OIDC to a short-lived key)
uses: NuGet/login@v1
id: login
with:
user: ${{ secrets.NUGET_USER }}
- run: >
dotnet package stage push artifacts/*.nupkg
--source https://api.nuget.org/v3/index.json
--api-key ${{ steps.login.outputs.NUGET_API_KEY }}
--group ${{ github.ref_name }}
With the policy scoped to staging, an agent that edits this file can rename steps, add a signing stage or break the build, but it can’t make a package public. If a pull request quietly swaps stage push for nuget push, the exchange still returns a key that the push path refuses. Set the policy’s environment to release and protect that environment in GitHub, and a stolen workflow file elsewhere in the repository can’t mint a key either.
Treat the stage-only restriction as the thing to verify when you create the policy. The Learn page for Trusted Publishing doesn’t describe that option in the version read for this piece, only the announcement does, so confirm the setting in the nuget.org policy form and try the failing case (a direct push using the staged key) before relying on it.
Promotion is only worth something if someone looks
A click on a website is a gate only as good as the thing the clicker sees. NuGet.org’s validation says the package is signed and free of known malware. It doesn’t say that this version is what you meant to ship. The question to ask before “Promote” is a diff against the last release.
The check below compares two .nupkg files (they’re zip archives) and flags the changes a reviewer should read: new MSBuild .props or .targets files, new tools/ or analyzers/ content, and new dependencies. The first of those is the one to look at hardest. Per the NuGet docs, a package can ship build, buildMultiTargeting or buildTransitive files named <package_id>.props or .targets, and for PackageReference projects they’re made available to the consumer’s build on restore. A new targets file is code that runs in every consumer’s build.
import re, sys, zipfile
SENSITIVE = re.compile(
r"^(build|buildTransitive|buildMultiTargeting)/.*\.(props|targets)$|^tools/|^analyzers/", re.I)
def files(path):
with zipfile.ZipFile(path) as z:
return {n for n in z.namelist() if not n.endswith("/")
and not n.startswith(("_rels/", "package/", "[Content_Types]"))}
def deps(path):
with zipfile.ZipFile(path) as z:
nuspec = next(n for n in z.namelist() if n.endswith(".nuspec"))
xml = z.read(nuspec).decode()
return set(re.findall(r'<dependency id="([^"]+)" version="([^"]+)"', xml))
old, new = sys.argv[1], sys.argv[2]
added, removed = sorted(files(new) - files(old)), sorted(files(old) - files(new))
dep_added, dep_removed = sorted(deps(new) - deps(old)), sorted(deps(old) - deps(new))
for f in added:
print(("REVIEW + " if SENSITIVE.search(f) else " + ") + f)
for f in removed:
print(" - " + f)
for i, v in dep_added:
print(f"REVIEW dependency + {i} {v}")
for i, v in dep_removed:
print(f" dependency - {i} {v}")
sys.exit(1 if any(SENSITIVE.search(f) for f in added) or dep_added else 0)
Run against a 1.1.0 and a 1.2.0 package where the newer one adds an XML doc file, a buildTransitive targets file and a dependency, it prints:
REVIEW + buildTransitive/Contoso.Library.targets
+ lib/net10.0/Contoso.Library.xml
REVIEW dependency + Contoso.Telemetry 1.0.3
The exit code is 1, so the same script can run in the staging job as a non-blocking annotation or as a check whose output goes into the release issue. It only reads zip entries and the .nuspec, so it works on a package a human downloads from the staging page or on the one the pipeline just built. It’s a regex over XML, deliberately crude: good enough to put the right three lines in front of a person, not a substitute for opening the targets file.
The same idea works with any agent. The tool that wrote the workflow is irrelevant, because the control is the credential’s scope and the diff a person reads.
What to watch
The announcement is candid about the rough edges, and they affect the workflow above.
- There’s no private restore feed, even for the owner. A staged package can’t be tested by installing it, so test the
.nupkgfrom the build output or a private feed first. - Group promotion isn’t atomic. Packages in a group become restorable at different times, so a library and the package that depends on it can be visible out of order for a short while.
- A failed or still-validating item blocks promoting its group until it’s resolved.
- Staged content expires if nobody promotes it. The post doesn’t give the window, so watch the expiry notices rather than assuming a number.
- The post doesn’t say whether you can re-upload the same version to replace a broken staged package. A commenter asked and there was no answer in the text. Until that’s clear, assume a bad staged version means a new version number.
- The human step only helps if there’s a human. A team that promotes everything within a minute of staging, unread, has moved the risk and not removed it.
Try it on a package you own that has low traffic: stage one version from CI, run the diff script against the previous release, and promote it by hand. If you can’t answer what the new buildTransitive file does, that was the reason for the gate.