如何修复npm审核修复问题


┌───────────────┬──────────────────────────────────────────────────────────────┐
│ Low           │ Prototype Pollution                                          │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package       │ lodash                                                       │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Patched in    │ >=4.17.5                                                     │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ react-native-cached-image                                    │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Path          │ react-native-cached-image > lodash                           │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ More info     │ https://npmjs.com/advisories/577                             │
└───────────────┴──────────────────────────────────────────────────────────────┘
found 11 vulnerabilities (2 low, 8 moderate, 1 high) in 26316 scanned packages
11 vulnerabilities require manual review. See the full report for details.

当我尝试npm install时就会出现这种情况,并且所有这些都需要手动审查。我试着访问这里查看更多信息,显然是因为我的lodash4.17.4版本。因此,我运行了npm install --save lodash@4.17.5并检查了我的package.json,以确保它正确反映。

然而,漏洞似乎仍然存在。想知道我是不是修错了?

根据要求,包装的主体.json

"dependencies": {
"lodash": "^4.17.5",
}

您可以使用https://github.com/rogeriochaves/npm-force-resolutions

1( 添加分辨率部分

"resolutions": {
"lodash": "^4.17.5"
}

2( 运行

rm -r node_modules
npx npm-force-resolutions
npm install

问题与依赖lodash4.17.4react-native-cached-image包有关,如您所见:https://github.com/kfiroo/react-native-cached-image/blob/master/package.json#L51

最新更新