fix: LFP npm handle missing package

This commit is contained in:
abhisek 2023-12-29 14:15:27 +05:30
parent ffd73b1e7d
commit 79377e36fc
No known key found for this signature in database
GPG Key ID: CB92A4990C02A88F

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}