diff --git a/syft/pkg/cataloger/rust/repository.go b/syft/pkg/cataloger/rust/repository.go index 9d444e14bff8..a9a6752e7f22 100644 --- a/syft/pkg/cataloger/rust/repository.go +++ b/syft/pkg/cataloger/rust/repository.go @@ -12,6 +12,7 @@ import ( "github.com/go-git/go-git/v5/storage/memory" "io" "net/http" + "os" "strings" ) @@ -55,6 +56,13 @@ var RegistryConfig = make(map[string]RepositoryConfig) const RepositoryConfigName = "config.json" func (i *SourceId) GetConfig() (*RepositoryConfig, error) { + if i.kind == SourceKindLocalRegistry { + return &RepositoryConfig{ + Download: i.url, + API: "", + AuthRequired: false, + }, nil + } if repoConfig, ok := RegistryConfig[i.url]; ok { return &repoConfig, nil } @@ -74,6 +82,11 @@ func (i *SourceId) GetConfig() (*RepositoryConfig, error) { func (i *SourceId) GetPath(path string) ([]byte, error) { var content []byte switch i.kind { + case SourceKindLocalRegistry: + if path == RepositoryConfigName { + return nil, nil + } + return os.ReadFile(fmt.Sprintf("%s/index/%s", i.url, path)) case SourceKindSparse: var resp, err = http.Get(fmt.Sprintf("%s/%s", i.url, path)) if err != nil {