node.js - Node 安全服务关闭 : getaddrinfo ENOTFOUND api. nodesecurity.io

标签 node.js security npm

Node 安全平台服务自今年 9 月 30 日起开始折旧。我一直在继续使用 NSP package直到今天终于失败了。我想公开记录错误,以便其他人以后可以找到它。

我今天遇到的错误:

Error: Client request error: getaddrinfo ENOTFOUND api.nodesecurity.io api.nodesecurity.io:443

> eslint . && nsp check

(+) Error: Client request error: getaddrinfo ENOTFOUND api.nodesecurity.io api.nodesecurity.io:443
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! htm-gateway@1.0.1 lint: `eslint . && nsp check`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the project@1.0.1 lint script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

最佳答案

"beginning with npm@6, a new command, npm audit, recursively analyzes your dependency trees to identify specifically what’s insecure, recommend a replacement, or fix it automatically with npm audit fix."

因此,更新

nsp check

npm audit --audit-level high

其他配置和选项可以找到here

请注意,--audit-level high 标志可能仅适用于 NPM 版本 > v6.4.0(阅读 v6.4.0-next.0 commits)

非零退出的可配置审计级别 npm audit 当前以退出代码 1 退出,如果发现任何级别的任何漏洞。在 npm audit 中添加了 --audit-level 标志,以允许它在仅发现低于某个级别的漏洞时通过。

示例:npm audit --audit-level=high 如果仅检测到低级或中等级别的漏洞,则会以 0 退出。


NPM 文档:https://docs.npmjs.com/auditing-package-dependencies-for-security-vulnerabilities

官方博客:https://blog.npmjs.org/post/175511531085/the-node-security-platform-service-is-shutting


Updates about ignoring security advisory

有 NPM 包可用于扩展新 npm-audit 命令的功能(例如忽略某些建议),例如:

关于node.js - Node 安全服务关闭 : getaddrinfo ENOTFOUND api. nodesecurity.io,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53716991/

相关文章:

laravel - 我需要在生产环境中运行 `npm run prod` 吗?

node.js - 在 npm install 上编译 CoffeeScript

javascript - https.request 维基百科页面 - 未找到错误。

javascript - module.exports 与对象

c# - 以编程方式获取 Windows 2003 中文件夹的组-用户-权限-特殊权限列表

node.js - cross-env 命令在 nodejs 中如何工作?

javascript - Node Express 服务器 : How to serve HTML file properly (scripts and css included) ?(csp、相对路径和类似的东西)

javascript - Express Nodejs,模块化应用程序

为提升的 Silverlight 应用程序启用 AllowElevatedTrustAppsInBrowser 的安全问题

java - 通过 Java 小程序传递用户 ID 和密码的替代方案?