-
Notifications
You must be signed in to change notification settings - Fork 377
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]>
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]>
…ate, improve tests Co-authored-by: ellahathaway <[email protected]>
ellahathaway
left a comment
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.
Please refactor ExplicitCertificateKey to a name that more clearly describes its actual use, such as ExplicitSignInfoKey (or something similar). The current name implies a direct relationship to the certificate, but with recent changes, FileSignInfo can specify properties like DoNotUnpack without necessarily having a certificate. In other words, the key should represent the entity being signed (e.g., file name, path, or attributes) rather than its certificate correlation.
For example, we want to support scenarios like:
<FileSignInfo Name="MyPackage1.nupkg" Certificate="Microsoft400"/>
<FileSignInfo Name="MyPackage2.nupkg" DoNotUnpack="true"/>
<FileSignInfo Name="MyPackage3.nupkg" Certificate="Microsoft400" DoNotUnpack="true"/>where FileSignInfo entries can set properties independently of a certificate. The dictionary key type should reflect this broader use case, not just certificate mapping.
…tion logic Co-authored-by: ellahathaway <[email protected]>
Refactored |
Co-authored-by: mmitche <[email protected]>
mmitche
left a comment
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.
I think the logic looks all correct here
Implementation of DoNotUnpack via FileSignInfo and FileExtensionSignInfo
This PR implements the
DoNotUnpackfeature for SignTool that allows containers to be signed without unpacking their contents. The feature is configured viaFileSignInfoandFileExtensionSignInfometadata.Changes Made:
Core Implementation:
DoNotUnpackproperty andWithDoNotUnpack()methodDoNotUnpackmetadata fromFileExtensionSignInfoDoNotUnpackmetadata fromFileSignInfo(viaFileSignInfoEntrytype)FileSignInfoEntryfor file sign infoShouldRepacknow usesSignInfo.DoNotUnpackToString()to include DoNotUnpack info when file has signable parts and DoNotUnpack is trueTests:
Usage Examples:
Via FileSignInfo (per-file) with certificate:
Via FileSignInfo (per-file) without certificate:
Via FileExtensionSignInfo (per-extension):
Via FileExtensionSignInfo without certificate:
Precedence:
Testing:
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.