Add Dependabot Alert Dismissal migration support to GEI #1351
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.
This PR adds support for migrating Dependabot alert dismissals in the GitHub Enterprise Importer (GEI), addressing the need to preserve dismissed Dependabot alerts and their dismissal reasons when migrating repositories.
New Features
CLI Command
gh gei migrate-dependabot-alerts
- New command to migrate Dependabot alert states and dismissal informationmigrate-code-scanning-alerts
andmigrate-secret-alerts
commandsAlert Matching Strategy
The implementation uses a robust two-tier matching approach:
This ensures reliable alert matching even when security advisory IDs differ between source and target instances.
Supported Dismissal Reasons
Preserves all standard Dependabot dismissal reasons:
false_positive
- Alert is not actually vulnerableinaccurate
- Alert is not accuratenot_used
- Vulnerable code is not usedno_bandwidth
- No time to fix right nowtolerable_risk
- Risk is acceptableState Migration
open
anddismissed
states (skipsfixed
as it's automatically managed)Implementation Details
Core Components
DependabotAlert
,DependabotAlertDependency
,DependabotAlertSecurityAdvisory
,DependabotAlertSecurityVulnerability
DependabotAlertState
with validation for states and dismissal reasonsDependabotAlertService
handles the migration logicDependabotAlertServiceFactory
for dependency injectionError Handling
Testing
Added 15 comprehensive tests covering:
All existing tests continue to pass (903 total tests).
Example Usage
This resolves the issue for organizations with large numbers of dismissed Dependabot alerts who need to preserve their security review decisions during repository migrations.
Fixes #1286.
Warning
Firewall rules blocked me from connecting to one or more addresses
I tried to connect to the following addresses, but was blocked by firewall rules:
api.github.com
/home/REDACTED/work/gh-gei/gh-gei/src/gei/bin/Debug/net8.0/gei migrate-dependabot-alerts --dry-run --source-org test-org --source-repo test-repo --target-org test-org --target-repo test-repo --github-source-pat dummy --github-target-pat dummy
(dns block)http://www.microsoft.com:80/pkiops/crl/Microsoft%20Identity%20Verification%20Root%20Certificate%20Authority%202020.crl
dotnet build src/OctoshiftCLI.sln
(http block)http://www.microsoft.com:80/pkiops/crl/Microsoft%20Public%20RSA%20Timestamping%20CA%202020.crl
dotnet build src/OctoshiftCLI.sln
(http block)www.githubstatus.com
/home/REDACTED/work/gh-gei/gh-gei/src/gei/bin/Debug/net8.0/gei --help
(dns block)/home/REDACTED/work/gh-gei/gh-gei/src/gei/bin/Debug/net8.0/gei migrate-dependabot-alerts --help
(dns block)/home/REDACTED/work/gh-gei/gh-gei/src/gei/bin/Debug/net8.0/gei migrate-dependabot-alerts --dry-run --source-org test-org --source-repo test-repo --target-org test-org --target-repo test-repo --github-source-pat dummy --github-target-pat dummy
(dns block)If you need me to access, download, or install something from one of these locations, you can either:
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.