Skip to content

Proposal: Add --allow-untrusted-signing flag to nuget sign commands - #14798

Merged
kartheekp-ms merged 3 commits into
NuGet:devfrom
elantiguamsft:feature/allow-untrusted-signing
Mar 20, 2026
Merged

kartheekp-ms merged 3 commits into
NuGet:devfrom
elantiguamsft:feature/allow-untrusted-signing

Conversation

@elantiguamsft

@elantiguamsft elantiguamsft commented Mar 10, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Add a new --allow-untrusted-root flag to nuget sign and dotnet nuget sign that allows signing NuGet packages with certificates whose root CA is not installed in a trusted root certificate store. When this flag is set, the UntrustedRoot X509 chain status is treated as a warning instead of a fatal error. The certificate chain is still fully built and validated for structural correctness.

Motivation

In enterprise and CI/CD environments, signing certificates are often provisioned from Azure Key Vault where the root CA is not (and should not be) installed into the machine's trusted root certificate store. Installing root CAs requires admin elevation, which fails in non-elevated CI containers and triggers UAC prompts on developer machines.

Today, nuget sign performs internal chain validation that treats UntrustedRoot as a fatal error with no workaround. Other signing tools (signtool.exe, VsixSigntool) already handle this scenario.

Implementation

A reference implementation is available in NuGet/NuGet.Client#7201. The approach:

  • Adds AllowUntrustedRoot boolean to SignArgs, CertificateSourceOptions, and SignPackageRequest
  • New GetCertificateChain overload with allowUntrustedRoot parameter
  • Moves UntrustedRoot from error flags to warning flags in GetChainStatusFlags()
  • Works on net472 (nuget.exe) and net8.0+ (dotnet nuget sign)
  • CLI: --AllowUntrustedSigning (nuget.exe) / --allow-untrusted-signing (dotnet CLI)

See the full proposal in accepted/2026/allow-untrusted-signing.md.

Add a new --allow-untrusted-signing flag to nuget sign and dotnet nuget sign
that allows signing NuGet packages with certificates whose root CA is not
installed in a trusted root certificate store. When this flag is set, the
UntrustedRoot X509 chain status is treated as a warning instead of a fatal
error. The certificate chain is still fully built and validated for structure.

Implementation PR: NuGet/NuGet.Client#7201

Co-authored-by: Copilot <[email protected]>
@dotnet-policy-service dotnet-policy-service Bot added the Community PRs (and linked Issues) created by someone not in the NuGet team label Mar 10, 2026
Replace incorrect claims about a nuget verify --allow-untrusted-root CLI
flag with accurate references to the allowUntrustedRoot attribute on
certificate elements in nuget.config's trustedSigners section.

Co-authored-by: Copilot <[email protected]>
@elantiguamsft
elantiguamsft requested a review from a team as a code owner March 10, 2026 22:03
@kartheekp-ms
kartheekp-ms requested a review from dtivel March 12, 2026 19:26
@kartheekp-ms kartheekp-ms self-assigned this Mar 12, 2026
dtivel
dtivel previously approved these changes Mar 12, 2026

@dtivel dtivel 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.

Thanks for writing this, @elantiguamsft. I agree with this proposal.

Align CLI flag naming with existing dotnet nuget trust --allow-untrusted-root
per reviewer feedback from @kartheekp-ms. The 'signing' word is redundant
since the command context already implies signing.

Co-authored-by: Copilot <[email protected]>
Comment thread accepted/2026/allow-untrusted-root.md Resolved
Comment thread accepted/2026/allow-untrusted-root.md Resolved
@kartheekp-ms
kartheekp-ms merged commit 6119532 into NuGet:dev Mar 20, 2026
1 check passed
@elantiguamsft
elantiguamsft deleted the feature/allow-untrusted-signing branch March 20, 2026 21:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Community PRs (and linked Issues) created by someone not in the NuGet team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants