Skip to content

[build] Fix BinSkim failure in 'Convert NuGet to MSI' job#10961

Merged
jonathanpeppers merged 1 commit intodotnet:mainfrom
jonathanpeppers:dev/peppers/binskim-msi-fix
Mar 18, 2026
Merged

[build] Fix BinSkim failure in 'Convert NuGet to MSI' job#10961
jonathanpeppers merged 1 commit intodotnet:mainfrom
jonathanpeppers:dev/peppers/binskim-msi-fix

Conversation

@jonathanpeppers
Copy link
Copy Markdown
Member

@jonathanpeppers jonathanpeppers commented Mar 17, 2026

Context: https://devdiv.visualstudio.com/DevDiv/_build/results?buildId=13575957&view=logs&j=5b07041f-3ad2-50e1-dcc0-0b413b70a215&t=033d44a8-e06e-5493-047f-4acab20a6c86

The "Convert NuGet to MSI" job fails with:

##[warning]Could not parse glob pattern D:\a\_work\1\s\bin\Build*\** for argument Target. The value will be passed to the tool without resolution.
BINSKIM : error ERR997.NoValidAnalysisTargets : No valid analysis targets were specified.
##[error]GuardianErrorExitCodeException: binskim completed with an Error exit code: 1. BinSkim failed. Verify the target(s) to be scanned.

This happens because the 1ES template applies sdl.binskim config globally to all jobs with no per-job override mechanism. The analyzeTargetGlob pattern bin\Build*\** (added in #10940, fixed in #10953) only matches build/test job output directories, but the MSI conversion job has no bin\Build*\ directory — it produces output under bin\msi-nupkgs\ instead.

Add bin\msi-nupkgs\** to the glob so the MSI conversion job has valid scan targets.

The 'Convert NuGet to MSI' job fails with:

    Could not parse glob pattern D:\a\_work\1\s\bin\Build*\**
    BINSKIM : error ERR997.NoValidAnalysisTargets : No valid analysis targets were specified.

This happens because the 1ES template applies sdl.binskim config globally
to all jobs. The analyzeTargetGlob pattern 'bin\Build*\**' only matches
build/test job output directories, but the MSI conversion job has no
bin\Build*\ directory — it produces output under bin\msi-nupkgs\ instead.

Add bin\msi-nupkgs\** to the glob so the MSI conversion job has valid
scan targets.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings March 17, 2026 17:42
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the 1ES SDL BinSkim configuration in the main Azure Pipelines definition to ensure security scanning includes outputs from the NuGet-to-MSI conversion job while continuing to avoid scanning test outputs that generate known false positives.

Changes:

  • Expand binskim.analyzeTargetGlob to include both build outputs (bin\Build*\**) and MSI conversion outputs (bin\msi-nupkgs\**).
  • Add clarifying comments explaining why multiple patterns are needed and why bin\Test* is intentionally excluded.

@jonathanpeppers
Copy link
Copy Markdown
Member Author

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@jonathanpeppers jonathanpeppers merged commit 0f6a01b into dotnet:main Mar 18, 2026
9 of 40 checks passed
jonathanpeppers added a commit to jonathanpeppers/xamarin-android that referenced this pull request Mar 18, 2026
Revert analyzeTargetGlob to a single pattern (bin\Build*\**) by removing
the semicolon-separated bin\msi-nupkgs\** addition from PR dotnet#10961.

Guardian's glob parser does not support semicolon-separated patterns.
When the value contains semicolons, Guardian prepends the source directory
to the entire string, creating an unparseable glob:

    D:\a\_work\1\s\bin\Build*\**;bin\msi-nupkgs\**

This causes BinSkim to fail with ERR997.NoValidAnalysisTargets in every
job that uses the global SDL config (Convert NuGet to MSI, Debugging
tests, etc.).

The 'Convert NuGet to MSI' job is fixed separately by adding a per-job
analyzeTargetGlob override in Xamarin.yaml-templates, matching the
approach already used by the sign-artifacts template.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
jonathanpeppers added a commit that referenced this pull request Mar 19, 2026
Revert the `analyzeTargetGlob` customization added in PRs #10940, #10953, and #10961.

The custom glob patterns caused more problems than they solved:

- `+|bin\Build*\**` — Guardian can't parse `+|` prefix (#10953)
- `bin\Build*\**` — breaks the 'Convert NuGet to MSI' job which has no `bin\Build*\` directory (#10961)
- `bin\Build*\**;bin\msi-nupkgs\**` — Guardian can't parse semicolons, breaks every job

Remove `analyzeTargetGlob` entirely and keep only `scanOutputDirectoryOnly: true`, which is the default configuration that worked before #10940.
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.

2 participants