Skip to content

Fix Cargo.lock Git source dependency matching - #1881

Merged
Greg Villicana (grvillic) merged 2 commits into
microsoft:mainfrom
cataggar:cataggar/fix-rust-cargo-git-source
Sep 25, 2026
Merged

Greg Villicana (grvillic) merged 2 commits into
microsoft:mainfrom
cataggar:cataggar/fix-rust-cargo-git-source

Conversation

@cataggar

@cataggar Cameron Taggart (cataggar) commented Sep 25, 2026 •

Copy link
Copy Markdown
Member

Summary

  • Resolve Cargo.lock Git dependency references against package sources that append #<commit>, while preserving exact matching for other sources and Git repository/ref.
  • Restore dependency edges for valid lockfiles containing both registry and Git copies of a crate.
  • Bump the RustSbom detector version to 3 because the dependency graph changes.
  • Skip the detector-version reminder on fork pushes, where the PR lives upstream and cannot be found in the fork.
  • Add unit tests for a Cargo-generated public itoa lockfile, a Git-to-Git dependency edge, a mismatched Git ref, and the detector version.

Fixes #1880

Tests

  • dotnet test test/Microsoft.ComponentDetection.Detectors.Tests/Microsoft.ComponentDetection.Detectors.Tests.csproj --no-restore -p:ExcludeIntegrationTests=false -- --filter "FullyQualifiedName~RustCargoLockParserTests|FullyQualifiedName~RustSbomDetectorTests" (51 passed)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@grvillic

Copy link
Copy Markdown
Collaborator

/azp run

@grvillic
Greg Villicana (grvillic) merged commit d888644 into microsoft:main Sep 25, 2026
11 of 12 checks passed
@github-actions

Copy link
Copy Markdown

👋 Hi! It looks like you modified some files in the Detectors folder.
You may need to bump the detector versions if any of the following scenarios apply:

  • The detector detects more or fewer components than before
  • The detector generates different parent/child graph relationships than before
  • The detector generates different devDependencies values than before

If none of the above scenarios apply, feel free to ignore this comment 🙂

@cataggar
Cameron Taggart (cataggar) deleted the cataggar/fix-rust-cargo-git-source branch September 25, 2026 16:31
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.

[Bug]: RustCargoLockParser cannot resolve Git-sourced dependency with commit fragment in Cargo.lock

2 participants