Skip to content

[NuGet.org Bug]: NuGet.org tampers with the uploaded package, making attestation difficult #10026

@Smaug123

Description

@Smaug123

Impact

It bothers me. A fix would be nice

Describe the bug

I recently implemented GitHub Attestations for the NuGet packages I produce. This was pretty annoying to do, because NuGet.org inserts a signature file into any(?) nupkg you upload to it. So the only flow I can make work is:

  • upload the package;
  • wait for it to become available;
  • download the package;
  • unzip it and verify that its contents are byte-for-byte identical after removing the .signature file;
  • attest the package I downloaded.

This is awkward!

Repro Steps

Upload a package to NuGet. Download it again. Observe that its contents have changed.

Expected Behavior

It surprised me greatly that NuGet.org tampers with uploaded packages. (The obvious thing to do would have been to have NuGet serve a certificate separately from the package, but that ship has presumably long since sailed. "NuGet.org attests that this package was uploaded by someone capable of impersonating ThisParticularUser" is not information that belongs in the package; other package repositories do exist and it would be nice not to require each one to tamper incompatibly with the packages that get uploaded to it to attest to it!)

No solution comes to mind; it may be possible for NuGet.org not to tamper with uploaded packages, but I can't see how without either duplicating large swathes of API or breaking compatibility.

Screenshots

No response

Additional Context and logs

It is of course possible to sign NuGet packages, but this has exactly the same secrets-management problems that NuGet API keys have. The whole point is to attest meaningfully that this package was produced from this source; having to trust that package producers are correctly handling their certificates is a very big and unnecessary ask. (Of course, better would be to have reproducible NuGet packs, because then we could attest verifiably that a package was built from a particular source tree without a bunch of custom logic.)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions