feat: Go module (go.mod) dependency extraction for OSV scanning#6
Merged
Merged
Conversation
Copilot
AI
changed the title
feat: Go package manager (go.mod) dependency extraction
feat: Go module (go.mod) dependency extraction for OSV scanning
May 31, 2026
Copilot created this pull request from a session on behalf of
kadraman
May 31, 2026 15:24
View session
There was a problem hiding this comment.
Pull request overview
Adds a go.mod dependency extractor so Go projects produce exact-version coordinates for OSV scanning, wired through the manifest dispatcher and exercised by unit and fixture tests.
Changes:
- New
extractGoModDependenciesextractor handling block and single-linerequireforms, strippingvprefix and skipping pseudo-versions. - Dispatcher updated to route
go.modfiles to the new extractor. - New example fixture, README entry, and tests (6 unit + 1 fixture).
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/scan/deps/extract/goMod.ts | New Go module parser producing Go ecosystem coordinates. |
| src/scan/deps/extract.ts | Routes go.mod manifests to the new extractor. |
| examples/deps/go/mod-app/go.mod | Fixture with two vulnerable + one indirect dep. |
| examples/deps/README.md | Documents new Go fixture entries. |
| tests/depsExtraction.test.ts | Unit tests for block/single-line/pseudo/malformed/dedup. |
| tests/depsExamples.test.ts | Fixture integration test for Go coordinates. |
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.
go.modfiles were recognized as dependency manifests and triggered the deps aspect, but produced no extracted coordinates — resulting in false "no exact-version dependencies" skips for Go projects.Extractor —
src/scan/deps/extract/goMod.tsrequire ( ... )and single-linerequire module v1.2.3formsvprefix (e.g.v0.16.0→0.16.0) for OSVGoecosystem compatibilityv0.0.0-20231113122135-abcdef012345) — no meaningful semver for OSVGO_ECOSYSTEM = "Go"constantDispatcher —
src/scan/deps/extract.tsgo.mod→extractGoModDependenciescaseExample fixture —
examples/deps/go/mod-app/go.modTwo packages with known OSV advisories:
golang.org/x/crypto v0.16.0— CVE-2023-48795 (Terrapin, fixed ≥ v0.17.0)github.com/go-jose/go-jose/v3 v3.0.0— CVE-2024-28176 (fixed ≥ v3.0.3)Tests
Six new unit tests covering block/single-line requires, pseudo-version skipping, malformed input, deduplication, and line-number accuracy. One fixture integration test in
depsExamples.test.ts.