Skip to content

Fix SignCheck signing-validation issues (cabinet.dll on non-Windows, DAC exclusions, verbose build output, MSB4181, source-build strong-name) - #7580

Merged
akoeplinger merged 4 commits into
dotnet:mainfrom
akoeplinger:akoeplinger/signcheck-burn-windows-guard
Jul 8, 2026
Merged

akoeplinger merged 4 commits into
dotnet:mainfrom
akoeplinger:akoeplinger/signcheck-burn-windows-guard

Conversation

@akoeplinger

@akoeplinger akoeplinger commented Jul 7, 2026 •

Copy link
Copy Markdown
Member

This PR bundles a few related fixes to VMR signing validation / SignCheck that were found while testing signing validation on the release branch.

1. Skip Burn bundle CAB extraction on non-Windows

ExeVerifier unconditionally tried to extract Burn bundle containers, which CAB-unpacks via the native Windows-only cabinet.dll and throws DllNotFoundException on Linux/macOS. Guarded the Burn extraction so it only runs on Windows (moved the OS check into the VerifyRecursive branch).

2. Fix DAC exclusion entries being split across lines

The dynamically-appended mscordaccore.dll/mscordbi.dll exclusions used a raw ;; in the SignCheckExclusionItem Include value. MSBuild treats ; as an item separator, so each entry was written to the generated exclusions file as two separate lines instead of the required filename;;comment single-line format, breaking those DAC exclusions when DAC signing is disabled. Escaped the separators as %3B.

3. Restore detailed signing-validation output and stop flooding the build log

Since signing validation moved to the in-proc SignCheckTask, the SignCheck ConsoleLogger writes every processed file to stdout, which MSBuild echoes into the build log (thousands of Signed: True lines), and the per-file AuthentiCode/StrongName details of the offending files were no longer surfaced.

  • Added an Options.ConsoleOutput flag (default true, so the standalone tool is unchanged); the MSBuild task sets it to false since it consumes signcheck.log/signcheck.xml directly.
  • ProcessSignCheckResults no longer fails early on the terse "Signing issues found" marker (an expected outcome), only on a genuine error remaining after stripping it, so the per-file report runs.
  • The report now selects the full <File> elements from the results XML instead of only @Name, restoring the AuthentiCode/StrongName details for each offending file.

4. Fail with a real error instead of MSB4181

When SignCheck finds signing issues it returns a non-zero exit code but does not log an MSBuild error, so the build failed with the generic MSB4181 ("task returned false but did not log an error"). The task now logs a real error at the SignCheck.Run() call site when the result is non-zero, and the now-redundant catch-all <Error> in ProcessSignCheckResults was removed (the per-file report is still produced).

5. Ignore strong-name failures inside source-build tarballs

Source-build only public-signs its outputs, so binaries inside the source-built intermediate and SDK tarballs (Private.SourceBuilt.Artifacts.*.tar.gz, dotnet-sdk-*-centos.*-x64.tar.gz) carry a valid public key but a placeholder (zero-filled) strong-name signature. SignCheck's full strong-name verification correctly rejects these, producing false "unsigned" failures. Added IGNORE-STRONG-NAME exclusions for those tarballs.

Copilot AI review requested due to automatic review settings July 7, 2026 18:33
@dotnet-policy-service
dotnet-policy-service Bot requested a review from a team July 7, 2026 18:33

Copilot AI 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.

Pull request overview

This PR updates SignCheck’s ExeVerifier to avoid attempting WiX Burn bundle inner-container (CAB) extraction on non-Windows platforms, preventing DllNotFoundException failures caused by Microsoft.Deployment.Compression.Cab P/Invoking Windows-only cabinet.dll.

Changes:

  • Add a RuntimeInformation.IsOSPlatform(OSPlatform.Windows) gate around .wixburn Burn bundle payload extraction.
  • Add inline commentary explaining why inner-container verification is skipped on non-Windows while still verifying the outer executable’s Authenticode signature.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Burn bundle payloads are packed in CAB containers that can only be
extracted via the native cabinet.dll available on Windows. When signing
validation runs on a Linux/macOS agent, ExeVerifier threw a
DllNotFoundException trying to load cabinet.dll while scanning a Windows
Burn bundle .exe.

Guard the inner-container extraction to Windows. The outer executable's
Authenticode signature is still verified, and the payloads are verified
by the Windows leg of signing validation.

Co-authored-by: Copilot <[email protected]>
@akoeplinger
akoeplinger force-pushed the akoeplinger/signcheck-burn-windows-guard branch from 9ea8be2 to c95b1df Compare July 7, 2026 18:40
…ion.proj

The dynamically-appended mscordaccore.dll/mscordbi.dll exclusions used a raw
';;' in the SignCheckExclusionItem Include value. MSBuild treats ';' as an item
separator, so each entry was written to the generated exclusions file as two
separate lines (the file name and the comment) instead of the required
'filename;;comment' single-line format, breaking those DAC exclusions when DAC
signing is disabled. Escape the separators as '%3B' so each entry stays intact.

Co-authored-by: Copilot <[email protected]>
@akoeplinger
akoeplinger requested review from a team as code owners July 7, 2026 19:47
@akoeplinger akoeplinger changed the title Skip Burn bundle CAB extraction on non-Windows in SignCheck Fix SignCheck signing-validation issues (cabinet.dll on non-Windows, DAC exclusions, verbose build output) Jul 7, 2026
akoeplinger and others added 2 commits July 8, 2026 10:12
…d log

Since signing validation moved to the in-proc SignCheckTask, the SignCheck
ConsoleLogger writes every processed file to stdout, which MSBuild echoes into
the AzDO build log (thousands of "Signed: True" lines). Pre-migration, SignCheck
ran as a subprocess with its output redirected to signcheck.log, so only the
unsigned/DO-NOT-SIGN files were surfaced to the build log, with their
AuthentiCode/StrongName details.

Restore that behavior:
- Add an Options.ConsoleOutput flag (default true, so the standalone tool is
  unchanged) and have the MSBuild task set it to false. The task consumes
  signcheck.log and signcheck.xml directly, so the console output is redundant.
- In ProcessSignCheckResults, no longer fail early on the terse "Signing issues
  found" marker (an expected outcome, not a task failure); only a genuine error
  left in the log after stripping that marker fails early. This lets the
  per-file report run.
- Select the full <File> elements from the results XML instead of only @name, so
  the report again includes AuthentiCode and StrongName details for each
  offending file.

Co-authored-by: Copilot <[email protected]>
Source-build only public-signs its outputs, so binaries inside the
source-built intermediate and SDK tarballs carry a valid public key but a
placeholder (zero-filled) strong-name signature. SignCheck's full strong-name
verification correctly rejects these, causing false 'unsigned' failures.
Exclude the source-built tarballs via IGNORE-STRONG-NAME.

Co-authored-by: Copilot <[email protected]>
@akoeplinger
akoeplinger force-pushed the akoeplinger/signcheck-burn-windows-guard branch from 5ced9fa to d4e0d25 Compare July 8, 2026 09:14
@dotnet-policy-service
dotnet-policy-service Bot requested a review from a team July 8, 2026 09:14
@akoeplinger akoeplinger changed the title Fix SignCheck signing-validation issues (cabinet.dll on non-Windows, DAC exclusions, verbose build output) Fix SignCheck signing-validation issues (cabinet.dll on non-Windows, DAC exclusions, verbose build output, MSB4181, source-build strong-name) Jul 8, 2026
@akoeplinger
akoeplinger enabled auto-merge (squash) July 8, 2026 09:56
@akoeplinger
akoeplinger merged commit f1a785a into dotnet:main Jul 8, 2026
11 checks passed
@akoeplinger
akoeplinger deleted the akoeplinger/signcheck-burn-windows-guard branch July 8, 2026 14:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants