-
Notifications
You must be signed in to change notification settings - Fork 378
Add DoNotUnpack flag to sign containers without extracting contents #16371
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Co-authored-by: ellahathaway <[email protected]>
…ogging structure Co-authored-by: ellahathaway <[email protected]>
…l.TryParse Co-authored-by: ellahathaway <[email protected]>
| } | ||
|
|
||
| [Fact] | ||
| public void ContainerSigningWithDoNotUnpack() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot - please also add a test for not unpacking a file that is signed with a detached signature
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added test ContainerSigningWithDoNotUnpackAndDetachedSignature that verifies a container with DoNotUnpack=true and a certificate supporting detached signatures is signed at the top level without unpacking its contents. Commit: 19c6497
Co-authored-by: ellahathaway <[email protected]>
|
@copilot Because a top-level file could be duplicated within other archives (e.g. an MSI at the top level as well as within a VS.* nupkg), I think a better way to implement this is via a new bit of metadata on |
I understand the concern about duplicated files. To clarify the intended design: should the <FileSignInfo Include="dotnet-sdk-source.tar.gz" CertificateName="LinuxSign" DoNotUnpack="true" />Or via extension: <FileExtensionSignInfo Include=".tar.gz" CertificateName="LinuxSign" DoNotUnpack="true" />This would allow the same file to be signed without unpacking when it appears at the top level, but still be unpacked when nested in another container. Please confirm and I'll refactor the implementation accordingly. |
@copilot - please implement this for both file name (FileSignInfo) and file extension (FileExtensionSignInfo). |
…tadata Co-authored-by: ellahathaway <[email protected]>
Implemented Usage examples: <!-- Per-file via FileSignInfo -->
<FileSignInfo Include="dotnet-sdk-source.tar.gz" CertificateName="LinuxSign" DoNotUnpack="true" />
<!-- Per-extension via FileExtensionSignInfo -->
<FileExtensionSignInfo Include=".tar.gz" CertificateName="LinuxSign" DoNotUnpack="true" />Added tests for both approaches. Commit: e7a45b0 Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
Co-authored-by: ellahathaway <[email protected]>
Description
Adds
DoNotUnpackmetadata flag toFileSignInfoandFileExtensionSignInfothat signs containers at the top level without unpacking. Prevents signing checked-in binaries in source archives.Changes
DoNotUnpackconstantDoNotUnpackproperty andWithDoNotUnpack()methodDoNotUnpackmetadata from bothFileSignInfoandFileExtensionSignInfoTryBuildZipData/TryBuildWixDatawhen DoNotUnpack is set via SignInfoShouldRepacknow usesSignInfo.DoNotUnpackContainerSigningWithDoNotUnpackViaFileSignInfo- verifies container is signed without unpacking via FileSignInfoContainerSigningWithDoNotUnpackViaFileExtensionSignInfo- verifies container is signed without unpacking via FileExtensionSignInfoContainerSigningWithoutDoNotUnpack- verifies normal unpacking behaviorContainerSigningWithDoNotUnpackAndDetachedSignature- verifies detached signature works with DoNotUnpackUsage
Via FileSignInfo (per-file):
Via FileExtensionSignInfo (per-extension):
With
DoNotUnpack=true, the container is signed as-is without extracting or signing nested binaries. This works with both regular signing and detached signature signing (.sigfiles).Precedence
FileSignInfo takes precedence over FileExtensionSignInfo for the DoNotUnpack value. This allows the same file to be signed without unpacking when it appears at the top level, but still be unpacked when nested in another container (unless explicitly overridden by FileSignInfo).
To double check:
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.