Merge pull request #178 from safedep/fix/lfp_npm_unavailable_package

fix: LFP npm handle missing package
This commit is contained in:
Abhisek Datta 2023-12-29 15:19:04 +05:30 committed by GitHub
commit 273d999561
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -96,10 +96,12 @@ func (npm *npmLockfilePoisoningAnalyzer) Analyze(manifest *models.PackageManifes
continue
}
// We don't strictly need this because the package name is extracted from `package-lock.json`
// The impact here is, pkg can be nil in the event and may cause a bug for reporters if they
// don't handle nil package
pkg, ok := pkgMap[packageName]
if !ok {
logger.Warnf("npmLockfilePoisoningAnalyzer: Package [%s] not found in manifest", packageName)
continue
logger.Debugf("npmLockfilePoisoningAnalyzer: Package [%s] not found in manifest", packageName)
}
trustedRegistryUrls := []string{npmRegistryTrustedUrlBase}