Support for scanning manifest files (#36)

* feat: add extractor logic for manifest files

* feat: add manifest-based package installation detection

* feat: add osv-scanner for extracting lockfiles

* refactor: add comment for cmd parse

* refactor: add Ecosystem() method to PackageManager interface

* refactor: implement package-manager-specific extractors & replace osv-scanner with scalibr

* Update extractor/extractor.go

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Sahil Bansal <bansalsahil315@gmail.com>

---------

Signed-off-by: Sahil Bansal <bansalsahil315@gmail.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
Sahil Bansal
2025-06-12 18:58:58 +05:30
committed by GitHub
co-authored by Copilot
parent 302e17fe48
commit 5e9f2af972
13 changed files with 690 additions and 16 deletions
+19
View File
@@ -30,12 +30,28 @@ type ParsedCommand struct {
// Parsed install target if this is an install command
InstallTargets []*PackageInstallTarget
// IsManifestInstall indicates if this is a manifest-based installation
// (e.g., npm install, pip install -r requirements.txt)
IsManifestInstall bool
// ManifestFiles contains the list of manifest files to install from
// (e.g., ["requirements.txt"] for pip install -r requirements.txt)
ManifestFiles []string
}
func (pc *ParsedCommand) HasInstallTarget() bool {
return len(pc.InstallTargets) > 0
}
func (pc *ParsedCommand) HasManifestInstall() bool {
return pc.IsManifestInstall
}
func (pc *ParsedCommand) ShouldExtractFromManifest() bool {
return pc.IsManifestInstall && !pc.HasInstallTarget()
}
// PackageManager is the contract for implementing a package manager
type PackageManager interface {
// Name of the package manager implementation
@@ -44,6 +60,9 @@ type PackageManager interface {
// ParseCommand parses the command and returns a parsed command
// specific to the package manager implementation
ParseCommand(args []string) (*ParsedCommand, error)
// Ecosystem of the package manager
Ecosystem() packagev1.Ecosystem
}
// PackageResolver is the contract for resolving package info