Skip to content

Fix vulnerability ref resolution - #300

Merged
andrew merged 1 commit into
mainfrom
fix/vulns-ref-resolution
Jul 31, 2026
Merged

andrew merged 1 commit into
mainfrom
fix/vulns-ref-resolution

Conversation

@andrew

@andrew andrew commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Resolve Git refs before querying cached vulnerability snapshots so vulns blame and other ref-based vulnerability commands use commit SHAs.

Keep history scans on their existing exact-SHA path and add regression coverage for vulns blame and vulns exposure.

Fixes #299

Copilot AI left a comment

Copy link
Copy Markdown

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 fixes ref-based vulnerability queries by resolving Git refs (e.g., HEAD, branch names, HEAD~1) to commit SHAs before reading cached dependency snapshots, addressing cases where vulns blame/vulns exposure returned no results due to cache misses.

Changes:

  • Resolve refs to SHAs prior to GetDependenciesAtRef calls used by vulnerability commands.
  • Refactor vuln lookup into getVulnsAtRef (ref→SHA) and getVulnsAtCommit (SHA) to keep history scans on the exact-SHA path.
  • Add regression tests covering vulns blame and vulns exposure behavior at HEAD, and rename an existing unit test accordingly.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
cmd/vulns.go Resolves refs to commit SHAs before querying cached dependency snapshots; introduces commit-based helper for vuln queries.
cmd/vulns_test.go Renames/updates test to target the new commit-based helper.
cmd/vulns_blame_test.go Adds regression tests ensuring vulns blame and vulns exposure work when targeting HEAD.

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

@andrew
andrew merged commit 08bf434 into main Jul 31, 2026
8 checks passed
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.

vulns blame not returning any values

2 participants