Skip to content
This repository has been archived by the owner on Feb 13, 2023. It is now read-only.

npm install すると、5 vulnerabilities (4 high, 1 critical)と警告が出る #1

Closed
potappo opened this issue Oct 22, 2022 · 4 comments

Comments

@potappo
Copy link

potappo commented Oct 22, 2022

手元の環境だと簡単に解決できそうになかったので、ひとまず報告しておきます。
npm install 時のログは以下の通りです。

added 374 packages, and audited 375 packages in 9s

103 packages are looking for funding
  run `npm fund` for details

5 vulnerabilities (4 high, 1 critical)

To address issues that do not require attention, run:
  npm audit fix

Some issues need review, and may require choosing
a different dependency.

Run `npm audit` for details.

npm audit fix を実行することで、3つにまで減りました。

changed 4 packages, and audited 375 packages in 3s

104 packages are looking for funding
  run `npm fund` for details

# npm audit report

trim  <0.0.3
Severity: high
Regular Expression Denial of Service in trim - https://github.com/advisories/GHSA-w5p7-h5w8-2hfq
No fix available
node_modules/trim
  hast  <=0.0.2
  Depends on vulnerable versions of trim
  node_modules/hast
    textlint-plugin-html  *
    Depends on vulnerable versions of hast
    node_modules/textlint-plugin-html

3 high severity vulnerabilities

Some issues need review, and may require choosing
a different dependency.

textlint-plugin-html をどうにかすれば良いのだろうかと思い、textlint-plugin-html を clone して npm install してみましたが、Windowsではエラーで失敗したため、原因追及を保留しています。

> [email protected] prepublish
> npm run --if-present build


> [email protected] build
> NODE_ENV=production babel src --out-dir lib --source-maps

'NODE_ENV' は、内部コマンドまたは外部コマンド、
操作可能なプログラムまたはバッチ ファイルとして認識されていません。
npm ERR! code 1
npm ERR! path C:\prvt\pj\mdnJa\repos\textlint-plugin-html
npm ERR! command failed
npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c C:\Users\xxx\AppData\Local\Temp\prepublish-c7ac2ee6.cmd

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\xxx\AppData\Local\npm-cache\_logs\2022-10-22T06_19_23_254Z-debug-0.log

※ユーザー名はセキュリティ上の問題からxxxに書き換えてますが、すべてアルファベットです。

時間あるときにさらに原因追及してみますが、解決策あるようであれば、対応いただけると幸いです。

@mongolyy
Copy link
Owner

@potappo
ご報告ありがとうございます 🙇
私のほうでも確認してみます

@mongolyy
Copy link
Owner

@potappo
#2 #3 #4 で解決しました。
また、packege.jsonresolutionsを使用するために、パッケージ管理ツールをnpmからyarnに変更していますのでお気を付けください。

また、本来であれば、textlint-plugin-htmlで使われている、hastというライブラリをrehypeにバージョンアップができればいいのですが、ぱっとやってみた感じ、すぐにできるものではなかったので暫定対応として今の対応をしました。
時間があるようであれば textlint/textlint-plugin-html#2 に対応するようにしようと思います。

textlint-plugin-html をどうにかすれば良いのだろうかと思い、textlint-plugin-html を clone して npm install してみましたが、Windowsではエラーで失敗したため、原因追及を保留しています。

少しお気づきのようである気がしますが、現在のnpm scriptがmac/linux前提で書かれていることが原因だと思います。
buildのコマンドであれば、次のように変更することでwindowsで動かすことができます。(私は次の変更により、windows環境で動かせました。)

    "build": "SET NODE_ENV=production & babel src --out-dir lib --source-maps",

@mongolyy
Copy link
Owner

ご報告ありがとうございました。
いったんcloseとさせてください

@potappo
Copy link
Author

potappo commented Oct 24, 2022

修正ありがとうございました。

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants