Harden Dependabot policy evaluation when Dependency Graph enrichment fails - #206
Merged
Conversation
1 task
Co-authored-by: felickz <1760475+felickz@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix exception when dependabot alerts are found during action execution
Harden Dependabot policy evaluation when Dependency Graph enrichment fails
Aug 18, 2026
Contributor
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Scanned FilesNone |
Co-authored-by: felickz <1760475+felickz@users.noreply.github.com>
Co-authored-by: felickz <1760475+felickz@users.noreply.github.com>
Co-authored-by: felickz <1760475+felickz@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Review details
Suppressed comments (1)
ghascompliance/checks.py:249
- The missing-match fallback is not reachable for a non-empty real dependency graph:
Dependencies.findPurl()currently uses the tautologydep.fullname == dep.fullname(vendor/ghastoolkit/supplychain/dependencies.py:269), so it returns the first dependency even whenalert.purldoes not match. This can evaluate the alert against an unrelated package instead of the new fallback. Correct thefindPurlcomparison and cover this path with a realDependenciescollection rather than mockingfindPurl.
# Find the dependency from the graph
- Files reviewed: 2/2 changed files
- Comments generated: 0 new
- Review effort level: Balanced
Co-authored-by: felickz <1760475+felickz@users.noreply.github.com>
Co-authored-by: felickz <1760475+felickz@users.noreply.github.com>
Contributor
|
@copilot resolve the merge conflicts in this pull request |
…dabot-alert-exception # Conflicts: # ghascompliance/checks.py # tests/test_checks.py Co-authored-by: felickz <1760475+felickz@users.noreply.github.com>
Co-authored-by: felickz <1760475+felickz@users.noreply.github.com>
Co-authored-by: felickz <1760475+felickz@users.noreply.github.com>
Co-authored-by: felickz <1760475+felickz@users.noreply.github.com>
| from ghastoolkit import ( | ||
| GitHub, | ||
| CodeScanning, | ||
| Dependency, |
Co-authored-by: felickz <1760475+felickz@users.noreply.github.com>
Contributor
Author
Contributor
There was a problem hiding this comment.
Review details
Suppressed comments (2)
Previously missed (2) — in code that hasn't changed since the last review.
ghascompliance/checks.py:299
- The lookup assumes Dependabot ecosystem names are identical to Dependency Graph PURL types. For example, the alert adapter produces
pkg:pip/...(vendor/ghastoolkit/octokit/dependabot.py:345), while SPDX Python dependencies use the canonicalpkg:pypi/...; both this PURL comparison and the manager/fullname fallback therefore miss a real Python dependency. This also affects ecosystems such as Go/golang, RubyGems/gem, and Rust/cargo, causing package-name conditions to receive only the fallback alert PURL. Normalize Dependabot ecosystem names to their PURL type aliases before matching and add representative coverage.
if unquote(dep.getPurl(version=False)).lower() == alert_purl
or (
(dep.manager or "").lower() == alert_manager
and unquote(dep.fullname).lower() == alert_fullname
ghascompliance/checks.py:258
GHASToolkitError.statusis optional, andgetDependencies()can raise one without a status (for example, for an unsupported GHES version). This warning then reportsstatus Noneand discards the useful exception message. Includeerritself so the fallback remains diagnosable while still showing HTTP status codes when available.
f"Dependency Graph API request failed with status {err.status}; processing Dependabot alerts without dependency enrichment"
- Files reviewed: 2/2 changed files
- Comments generated: 0 new
- Review effort level: Balanced
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.
Dependabot checks could abort with a 400 path during action execution, which prevented expected alert reporting in repositories with active vulnerability alerts. This change keeps evaluation running even when dependency enrichment is unavailable.
Problem scope
checkDependabotassumed Dependency Graph data was always retrievable and always mappable bypurl, causing alert processing to stop in failure/miss scenarios.Behavior change in Dependabot flow
depgraph.getDependencies()withGHASToolkitErrorhandling.findPurl(alert.purl)has no match, continue and evaluate against fallback names derived fromalert.purl.Policy matching fallback
namesinput now uses:alert.purlalert.purl(versionless fallback slot)Regression coverage
purl.