0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

NestJSで脆弱性対応のためにパッケージを更新したメモ

Posted at

はじめに

NestJSを使ったプロジェクトを作成しAWSに環境を構築したところ
Inspectorによって脆弱性が検出されていた。

・CVE-2025-47935 - multer
・CVE-2025-47944 - multer

検索してみると本当に直近で脆弱性報告があり対処がされていたらしい。
https://iototsecnews.jp/2025/05/20/high-dos-risk-multer-flaws-threaten-millions-of-node-js-apps/

Multerいつ入れた?

package.jsonにも書いてないから何の話や、と思って調べたところ
@nestjs/platform-express が上位の依存関係として一緒にインストールされているものらしい

NestJS更新

脆弱性対応するにはMulter2.0.0を入れろとのこと
リリースノートを見ると v11.1.2 と v10.4.18 で Multer2.0.0 を使うように変更されている。
今回はv11系を更新したのでv10系は不明です。

更新手順自体はstackoverflowを参考にしました。

まずは自分のプロジェクトのバージョンを確認

~/nest-prj$ nest info

 _   _             _      ___  _____  _____  _     _____
| \ | |           | |    |_  |/  ___|/  __ \| |   |_   _|
|  \| |  ___  ___ | |_     | |\ `--. | /  \/| |     | |
| . ` | / _ \/ __|| __|    | | `--. \| |    | |     | |
| |\  ||  __/\__ \| |_ /\__/ //\__/ /| \__/\| |_____| |_
\_| \_/ \___||___/ \__|\____/ \____/  \____/\_____/\___/


[System Information]
OS Version     : Linux6.6.87.1-microsoft-standard-WSL2
NodeJS Version : v23.6.0
YARN Version    : 1.22.22

[Nest CLI]
Nest CLI Version : 11.0.5

[Nest Platform Information
platform-express version : 11.0.1
schematics version       : 11.0.0
testing version          : 11.0.1
common version           : 11.0.1
axios version            : 4.0.0
core version             : 11.0.1
cli version              : 11.0.5

~/nest-prj$ npm ls multer
kbp-vaultless-wrapper@0.0.1 /home/coatly/nest-prj
└─┬ @nestjs/platform-express@11.0.1
  └── multer@1.4.5-lts.1

事前準備として nest-cli の更新と npm-check-updates をインストール。
どうやらNestJSが公式に推奨しているらしい。
ただ nest-cli は不要だったかもしれない。

~/nest-prj$ npm install -g @nestjs/cli
~/nest-prj$ npm i npm-check-updates

npm-check-update を使用して NestJS パッケージの更新を確認する。

~/nest-prj$ npx npm-check-updates -u -f "/nestjs*/"
Upgrading /home/coatly/nest-prj/package.json
[====================] 7/7 100%

 @nestjs/cli               ^11.0.0  →  ^11.0.7
 @nestjs/common            ^11.0.1  →  ^11.1.2
 @nestjs/core              ^11.0.1  →  ^11.1.2
 @nestjs/platform-express  ^11.0.1  →  ^11.1.2
 @nestjs/schematics        ^11.0.0  →  ^11.0.5
 @nestjs/testing           ^11.0.1  →  ^11.1.2

Run npm install to install new versions.

メッセージに従いインストールを実施してバージョンを確認する。

~/nest-prj$ npm install
~/nest-prj$ nest info

 _   _             _      ___  _____  _____  _     _____
| \ | |           | |    |_  |/  ___|/  __ \| |   |_   _|
|  \| |  ___  ___ | |_     | |\ `--. | /  \/| |     | |
| . ` | / _ \/ __|| __|    | | `--. \| |    | |     | |
| |\  ||  __/\__ \| |_ /\__/ //\__/ /| \__/\| |_____| |_
\_| \_/ \___||___/ \__|\____/ \____/  \____/\_____/\___/


[System Information]
OS Version     : Linux6.6.87.1-microsoft-standard-WSL2
NodeJS Version : v23.6.0
YARN Version    : 1.22.22

[Nest CLI]
Nest CLI Version : 11.0.7

[Nest Platform Information
platform-express version : 11.1.2
schematics version       : 11.0.5
testing version          : 11.1.2
common version           : 11.1.2
axios version            : 4.0.0
core version             : 11.1.2
cli version              : 11.0.7

~/nest-prj$ npm ls multer
kbp-vaultless-wrapper@0.0.1 /home/coatly/nest-prj
└─┬ @nestjs/platform-express@11.1.2
  └── multer@2.0.0

更新できたようなので終わり。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?