🐛 Detect implicit NuGet restores - #5156
Open
theinfosecguy wants to merge 2 commits into
Open
Conversation
Signed-off-by: Keshav Malik <keshavaarav22@gmail.com>
theinfosecguy
marked this pull request as ready for review
August 3, 2026 06:20
theinfosecguy
requested review from
jeffmendoza and
justaugustus
and removed request for
a team
August 3, 2026 06:20
📄 Knowledge reviewDosu skipped reviewing this PR because your organization has used its |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What kind of change does this PR introduce?
Bug fix for the Pinned-Dependencies check.
What is the current behavior?
Pinned-Dependencies records explicit
dotnet restorecommands but misses commands that restore automatically, includingdotnet build,dotnet test,dotnet pack, anddotnet publish.It also skips Windows PowerShell workflow steps, so the workflow from #4381 reports no NuGet command details.
What is the new behavior (if this is a feature change)?
Pinned-Dependencies records these implicit restore commands unless restore is disabled with
--no-restoreor--no-build. It also recognizes MSBuild restore forms and simple directdotnetor MSBuild commands in PowerShell workflow steps.PowerShell parsing is intentionally conservative. Multiline, compound, and dynamic commands remain skipped because handling them safely requires a complete parser.
The existing locked-mode checks still determine whether the restored dependencies are pinned.
Which issue(s) this PR fixes
Fixes #4381
Special notes for your reviewer
I reproduced #4381 locally. Before this change, Pinned-Dependencies missed the restores triggered by
dotnet build,dotnet test, anddotnet pack. It now reports all three.make allgets through the build and race-enabled tests on my machine, then stops at lint. The two lint errors are inpolicy/and also occur on the parent commit. Linting just this diff reports no issues.Does this PR introduce a user-facing change?