-
Notifications
You must be signed in to change notification settings - Fork 474
feat: Use OSV-Scalibr directly #2313
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
another-rex
wants to merge
25
commits into
google:main
Choose a base branch
from
another-rex:full-osv-scalibr-scan
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 18 commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
9907aa8
test: update snapshots
osv-robot 5905b95
First good attempt
another-rex fc17ec1
Merge remote-tracking branch 'upstream/bot/update-snapshots' into ful…
another-rex 434d8b8
Fixed scanning
another-rex f0915aa
Update snaps
another-rex 83a5be7
Merge remote-tracking branch 'upstream/main' into full-osv-scalibr-scan
another-rex 7c1f964
Add some more comments
another-rex c071760
Remove more unused functions
another-rex 0169992
Fix lints
another-rex 6a02a5a
Make scanning git commits directly also work
another-rex ce25d12
Test git commit scan
another-rex 54f941e
Address PR comments
another-rex 6dd5276
Fix lints
another-rex c89d943
Add function comment
another-rex cce5024
Fix windows path override issue?
another-rex 9808459
Merge remote-tracking branch 'upstream/main' into full-osv-scalibr-scan
another-rex dffb3f7
Address PR comments
another-rex d6eacda
Fix windows
another-rex b7ddd73
Fix for macos
another-rex 42af31d
Fix formatting
another-rex 8669795
Make to be more idomatic
another-rex 67e26eb
What was I doing
another-rex 08694a0
Remove cast.go
another-rex 77cba09
Attempt at root based checking
another-rex 99e1d9a
Fix logic for multi root scanning
another-rex File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
191 changes: 97 additions & 94 deletions
191
cmd/osv-scanner/scan/source/__snapshots__/command_test.snap
Large diffs are not rendered by default.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| // Package gitcommitdirect provides an dummy extractor that returns a preset list of commits | ||
| package gitcommitdirect | ||
|
|
||
| import ( | ||
| "context" | ||
|
|
||
| "github.com/google/osv-scalibr/extractor" | ||
| "github.com/google/osv-scalibr/extractor/standalone" | ||
| "github.com/google/osv-scalibr/inventory" | ||
| "github.com/google/osv-scalibr/plugin" | ||
| ) | ||
|
|
||
| const ( | ||
| // Name is the unique name of this extractor. | ||
| Name = "vcs/gitcommitdirect" | ||
| ) | ||
|
|
||
| // Extractor extracts git repository hashes including submodule hashes. | ||
| // This extractor will not return an error, and will just return no results if we fail to extract | ||
| type Extractor struct { | ||
| commits []string | ||
| } | ||
|
|
||
| // New returns a new instance of the extractor. | ||
| func New(commits []string) standalone.Extractor { | ||
| return &Extractor{ | ||
| commits: commits, | ||
| } | ||
| } | ||
|
|
||
| // Name of the extractor. | ||
| func (e *Extractor) Name() string { return Name } | ||
|
|
||
| // Version of the extractor. | ||
| func (e *Extractor) Version() int { return 0 } | ||
|
|
||
| // Requirements of the extractor. | ||
| func (e *Extractor) Requirements() *plugin.Capabilities { | ||
| return &plugin.Capabilities{} | ||
| } | ||
|
|
||
| func (e *Extractor) Extract(_ context.Context, _ *standalone.ScanInput) (inventory.Inventory, error) { | ||
| pkgs := make([]*extractor.Package, 0, len(e.commits)) | ||
| for _, commit := range e.commits { | ||
| pkgs = append(pkgs, &extractor.Package{ | ||
| SourceCode: &extractor.SourceCodeIdentifier{Commit: commit}, | ||
| }) | ||
| } | ||
|
|
||
| return inventory.Inventory{ | ||
| Packages: pkgs, | ||
| }, nil | ||
| } | ||
|
|
||
| var _ standalone.Extractor = &Extractor{} |
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| // Package types provides type conversion utility functions | ||
| package types | ||
|
|
||
| func MustCastSlice[OUT, IN any](a []IN) []OUT { | ||
| out := make([]OUT, len(a)) | ||
| for i := range a { | ||
| out[i] = any(a[i]).(OUT) | ||
| } | ||
|
|
||
| return out | ||
| } | ||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,101 @@ | ||
|
|
||
| [TestDoScan/Test_curl_git_scanning - 1] | ||
| { | ||
| "results": [ | ||
| { | ||
| "source": { | ||
| "path": "", | ||
| "type": "unknown" | ||
| }, | ||
| "packages": [ | ||
| { | ||
| "package": { | ||
| "name": "", | ||
| "version": "", | ||
| "ecosystem": "", | ||
| "commit": "33dffa3909a67e1b5d22647128ab7eb6e53fd0c7" | ||
| }, | ||
| "vulnerabilities": [ | ||
| { | ||
| "modified": "2025-11-02T06:08:01Z", | ||
| "published": "2025-10-31T07:15:38Z", | ||
| "schema_version": "1.7.3", | ||
| "id": "CVE-2025-63675", | ||
| "aliases": [ | ||
| "GHSA-97w9-v595-3h5q" | ||
| ], | ||
| "details": "cryptidy through 1.2.4 allows code execution via untrusted data because pickle.loads is used. This occurs in aes_decrypt_message in symmetric_encryption.py.", | ||
| "severity": [ | ||
| { | ||
| "type": "CVSS_V3", | ||
| "score": "CVSS:3.1/AV:L/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:L" | ||
| } | ||
| ], | ||
| "affected": [ | ||
| { | ||
| "ranges": [ | ||
| { | ||
| "type": "GIT", | ||
| "events": [ | ||
| { | ||
| "introduced": "0" | ||
| }, | ||
| { | ||
| "last_affected": "33dffa3909a67e1b5d22647128ab7eb6e53fd0c7" | ||
| } | ||
| ], | ||
| "repo": "https://github.com/netinvent/cryptidy" | ||
| } | ||
| ], | ||
| "versions": [ | ||
| "v1.0.4", | ||
| "v1.0.5", | ||
| "v1.0.7", | ||
| "v1.1.0", | ||
| "v1.2.0", | ||
| "v1.2.1", | ||
| "v1.2.2", | ||
| "v1.2.3", | ||
| "v1.2.4" | ||
| ], | ||
| "database_specific": { | ||
| "source": "https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2025-63675.json" | ||
| } | ||
| } | ||
| ], | ||
| "references": [ | ||
| { | ||
| "type": "PACKAGE", | ||
| "url": "https://github.com/javiermorales36/cryptidy-analysis" | ||
| }, | ||
| { | ||
| "type": "WEB", | ||
| "url": "https://github.com/netinvent/cryptidy/blob/cebc9ffd54cc20679d15a1a43ca9a5da645b0c58/cryptidy/symmetric_encryption.py#L220-L238" | ||
| } | ||
| ] | ||
| } | ||
| ], | ||
| "groups": [ | ||
| { | ||
| "ids": [ | ||
| "CVE-2025-63675" | ||
| ], | ||
| "aliases": [ | ||
| "CVE-2025-63675", | ||
| "GHSA-97w9-v595-3h5q" | ||
| ], | ||
| "max_severity": "6.9" | ||
| } | ||
| ] | ||
| } | ||
| ] | ||
| } | ||
| ], | ||
| "experimental_config": { | ||
| "licenses": { | ||
| "summary": false, | ||
| "allowlist": null | ||
| } | ||
| } | ||
| } | ||
| --- |
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.