mirror of
https://github.com/safedep/vet.git
synced 2025-12-10 12:07:30 -06:00
* Update Insight service API and client * Add cli banner * Show API errors from insight API * Use standard error model * Add reporting interface * Update markdown template * Add trials registration client * Add trials registration support * Add supported ecosystem filter to parsers * Update OSV scanner * Use table renderer for CEL filter output * Rename filter opt to filter * Add an opinionated console summary reporter * Update README * Update README * Update README * Add filter spec * Update spec driven CEL filtering * Add query workflow with docs * Add secrets scan workflow
44 lines
729 B
Go
44 lines
729 B
Go
package scanner
|
|
|
|
import (
|
|
"encoding/json"
|
|
"os"
|
|
"path/filepath"
|
|
|
|
"github.com/safedep/vet/pkg/models"
|
|
)
|
|
|
|
func scanDumpFilesForManifest(dir string) ([]*models.PackageManifest, error) {
|
|
var manifests []*models.PackageManifest
|
|
err := filepath.WalkDir(dir, func(path string, info os.DirEntry, err error) error {
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
if info.IsDir() {
|
|
return nil
|
|
}
|
|
|
|
path, err = filepath.Abs(path)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
data, err := os.ReadFile(path)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
var manifest models.PackageManifest
|
|
err = json.Unmarshal(data, &manifest)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
manifests = append(manifests, &manifest)
|
|
return nil
|
|
})
|
|
|
|
return manifests, err
|
|
}
|