我刚在服务器上安装了Node.js,然后进行了基本的npm install
操作,但出现了很多类似于以下的消息:
$ npm install
npm WARN deprecated minimatch@2.0.10: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated minimatch@0.2.14: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated graceful-fs@1.2.3: graceful-fs v3.0.0 and before will fail on node releases >= v7.0. Please update to graceful-fs@^4.0.0 as soon as possible. Use 'npm ls graceful-fs' to find it in the tree.
npm WARN deprecated graceful-fs@2.0.3: graceful-fs v3.0.0 and before will fail on node releases >= v7.0. Please update to graceful-fs@^4.0.0 as soon as possible. Use 'npm ls graceful-fs' to find it in the tree.
npm WARN prefer global node-gyp@3.4.0 should be installed with -g
请注意右侧出现的信息:
npm WARN ... or higher to avoid a RegExp DoS issue
^^^^^^^^^^^^^^^^^^^^^^^^^^^
在我的本地服务器上,我已经使用了minimatch 3.0.3。然而,由于服务器没有使用最新版本的node,这对我来说是新的问题,并开始进行调查:
这个问题在npm的github页面被报道,并在其他问题中提到。一般来说,通过将minimatch
的版本升级至至少3.0.2版本即可解决此问题。
然而,我想知道RegExp DoS问题是什么?是否有任何特定的正则表达式可以通过minimatch进行DoS攻击?我无法想象这种情况会发生什么,也不想再现它,但我找不到更多的文档和minimatch的Github问题列表没有任何迹象。
从发布页面上看,我看到了3.0.2版本的唯一提交,基本上是将正则表达式语法封装起来的(我不熟悉JavaScript,无法详细了解其中所有细节)。