`npm audit` обнаружил уязвимость в npm? - PullRequest
0 голосов
/ 12 июня 2018

У меня появилась привычка регулярно проверять npm audit в большинстве моих проектов, и если я обнаружил, что одна из моих зависимостей имеет уязвимость, я либо пытаюсь ее исправить (через запрос на извлечение), либо сообщаю о проблеме.(через проблему GitHub)

Однако я недавно установил пакет и заметил некоторые действительно странные действия:

$ > npm install --save fingerprintjs2

+ fingerprintjs2@1.8.0
added 564 packages from 744 contributors and audited 4667 packages in 6.341s
found 9 vulnerabilities (2 low, 5 moderate, 2 high)
  run `npm audit fix` to fix them, or `npm audit` for details
$ > npm audit

                       === npm audit security report ===

┌──────────────────────────────────────────────────────────────────────────────┐
│                                Manual Review                                 │
│            Some vulnerabilities require your attention to resolve            │
│                                                                              │
│         Visit https://go.npm.me/audit-guide for additional guidance          │
└──────────────────────────────────────────────────────────────────────────────┘
┌───────────────┬──────────────────────────────────────────────────────────────┐
│ Moderate      │ Out-of-bounds Read                                           │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package       │ stringstream                                                 │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Patched in    │ >=0.0.6                                                      │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ fingerprintjs2                                               │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Path          │ fingerprintjs2 > npm > libcipm > npm-lifecycle > node-gyp >  │
│               │ request > stringstream                                       │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ More info     │ https://nodesecurity.io/advisories/664                       │
└───────────────┴──────────────────────────────────────────────────────────────┘
┌───────────────┬──────────────────────────────────────────────────────────────┐
│ Moderate      │ Out-of-bounds Read                                           │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package       │ stringstream                                                 │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Patched in    │ >=0.0.6                                                      │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ fingerprintjs2                                               │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Path          │ fingerprintjs2 > npm > node-gyp > request > stringstream     │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ More info     │ https://nodesecurity.io/advisories/664                       │
└───────────────┴──────────────────────────────────────────────────────────────┘
┌───────────────┬──────────────────────────────────────────────────────────────┐
│ Moderate      │ Out-of-bounds Read                                           │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package       │ stringstream                                                 │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Patched in    │ >=0.0.6                                                      │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ fingerprintjs2                                               │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Path          │ fingerprintjs2 > npm > npm-lifecycle > node-gyp > request >  │
│               │ stringstream                                                 │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ More info     │ https://nodesecurity.io/advisories/664                       │
└───────────────┴──────────────────────────────────────────────────────────────┘
┌───────────────┬──────────────────────────────────────────────────────────────┐
│ Moderate      │ Out-of-bounds Read                                           │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package       │ stringstream                                                 │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Patched in    │ >=0.0.6                                                      │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ fingerprintjs2                                               │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Path          │ fingerprintjs2 > npm > npm-registry-client > request >       │
│               │ stringstream                                                 │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ More info     │ https://nodesecurity.io/advisories/664                       │
└───────────────┴──────────────────────────────────────────────────────────────┘
┌───────────────┬──────────────────────────────────────────────────────────────┐
│ Moderate      │ Out-of-bounds Read                                           │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package       │ stringstream                                                 │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Patched in    │ >=0.0.6                                                      │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ fingerprintjs2                                               │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Path          │ fingerprintjs2 > npm > request > stringstream                │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ More info     │ https://nodesecurity.io/advisories/664                       │
└───────────────┴──────────────────────────────────────────────────────────────┘
┌───────────────┬──────────────────────────────────────────────────────────────┐
│ High          │ Denial of Service                                            │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package       │ http-proxy-agent                                             │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Patched in    │ >=2.1.0                                                      │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ fingerprintjs2                                               │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Path          │ fingerprintjs2 > npm > npm-profile > make-fetch-happen >     │
│               │ http-proxy-agent                                             │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ More info     │ https://nodesecurity.io/advisories/607                       │
└───────────────┴──────────────────────────────────────────────────────────────┘
┌───────────────┬──────────────────────────────────────────────────────────────┐
│ High          │ Denial of Service                                            │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package       │ https-proxy-agent                                            │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Patched in    │ >=2.2.0                                                      │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ fingerprintjs2                                               │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Path          │ fingerprintjs2 > npm > npm-profile > make-fetch-happen >     │
│               │ https-proxy-agent                                            │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ More info     │ https://nodesecurity.io/advisories/593                       │
└───────────────┴──────────────────────────────────────────────────────────────┘
┌───────────────┬──────────────────────────────────────────────────────────────┐
│ Low           │ Prototype Pollution                                          │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package       │ lodash                                                       │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Patched in    │ >=4.17.5                                                     │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ fingerprintjs2                                               │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Path          │ fingerprintjs2 > npm > cli-table2 > lodash                   │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ More info     │ https://nodesecurity.io/advisories/577                       │
└───────────────┴──────────────────────────────────────────────────────────────┘
┌───────────────┬──────────────────────────────────────────────────────────────┐
│ Low           │ Prototype Pollution                                          │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package       │ lodash                                                       │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Patched in    │ >=4.17.5                                                     │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ fingerprintjs2                                               │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Path          │ fingerprintjs2 > npm > npm-audit-report > cli-table2 >       │
│               │ lodash                                                       │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ More info     │ https://nodesecurity.io/advisories/577                       │
└───────────────┴──────────────────────────────────────────────────────────────┘
found 9 vulnerabilities (2 low, 5 moderate, 2 high) in 4667 scanned packages
  9 vulnerabilities require manual review. See the full report for details.

На первый взгляд кажется, что fingerprintjs2 может иметь много плохих зависимостей, но выглядитближе к конкретным зависимостям - сообщается, что все уязвимости находятся внутри самого npm! .Хуже того, все они кажутся в основном одними и теми же 3 зависимостями

stringstream

  • fingerprintjs2 > npm > libcipm > npm-lifecycle > node-gyp > request > stringstream
  • fingerprintjs2 > npm > node-gyp > request > stringstream
  • fingerprintjs2 > npm > npm-lifecycle > node-gyp > request > stringstream
  • fingerprintjs2 > npm > npm-registry-client > request > stringstream
  • fingerprintjs2 > npm > request > stringstream

http-proxy-agent

  • fingerprintjs2 > npm > npm-profile > make-fetch-happen > http-proxy-agent
  • fingerprintjs2 > npm > npm-profile > make-fetch-happen > https-proxy-agent

lodash

  • fingerprintjs2 > npm > cli-table2 > lodash
  • fingerprintjs2 > npm > npm-audit-report > cli-table2 > lodash

Я не получил такого странного поведения от любых других моих пакетов (я установил vue, vuex,vue-router, jquery, bootstrap, fontawesome, sha1, express, gulp, .... всего тонн материала -но я никогда не видел этого), поэтому я знал, что это должно было как-то быть связано с FIngerprintJS

Глядя на их файл package.json для отведения, у них на самом деле нет зависимостей , итолько горстка devDependencies (все инструменты сборки):

{
  "name": "fingerprintjs2",
  "version": "1.8.0",
  "description": "Modern & flexible browser fingerprinting library",
  "repository": {
    "type": "git",
    "url": "https://github.com/Valve/fingerprintjs2.git"
  },
  "keywords": [
    "browser",
    "identification",
    "fingerprint",
    "fingerprinting",
    "privacy"
  ],
  "author": "Valentin Vasilyev",
  "license": "MIT",
  "bugs": {
    "url": "https://github.com/Valve/fingerprintjs2/issues"
  },
  "homepage": "https://github.com/Valve/fingerprintjs2",
  "main": "dist/fingerprint2.min.js",
  "devDependencies": {
    "gulp": "^3.9.1",
    "gulp-rename": "^1.2.2",
    "gulp-standard": "^10.1.1",
    "gulp-uglify": "^3.0.0",
    "standard": "^10.0.3"
  },
  "scripts": {
    "test": "specs/phantomjs.runner.sh specs/spec_runner.html",
    "gulp": "gulp",
    "lint": "standard --fix"
  },
  "standard": {
    "ignore": [
      "specs/lib",
      "specs/phantomjs-testrunner.js"
    ]
  }
}

Что здесь происходит?

Я пытался обновить NodeJS (сейчас на версии v10.4.0) и NPM (сейчасна Version 6.1.0), но это не помогло.

Единственная подсказка, которую я имею, это следующее:

$ > npm ls npm
test-audit@1.0.0 /home/sbarnett/src/test-audit
└─┬ fingerprintjs2@1.8.0
  └── npm@5.10.0

По какой-то причине FingerprintJS, похоже, требует версию NPM 5.10.0, хотяУ меня установлена ​​6.1.0.Я понятия не имею, зачем ей эта версия, хотя, поскольку в файле package.json нет упоминания

Обновление

Какой бы ни была причина этой странной ошибки, она больше не происходит, когдаЯ запускаю новый проект и устанавливаю fingerprintjs2 - так что я считаю, что одна из зависимостей fingerprintjs2 была обновлена ​​и исправила проблему

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...