Skip to content

chore: pnpmへ移行しセキュリティ設定を追加#1

Open
april418 wants to merge 11 commits into
masterfrom
chore/migrate-to-pnpm-security-settings
Open

chore: pnpmへ移行しセキュリティ設定を追加#1
april418 wants to merge 11 commits into
masterfrom
chore/migrate-to-pnpm-security-settings

Conversation

@april418
Copy link
Copy Markdown
Contributor

@april418 april418 commented Apr 3, 2026

概要

パッケージマネージャーをpnpmに統一し、セキュリティ設定を追加するPRです。

変更内容

1. パッケージマネージャー移行

  • pnpm 10.33.0 に統一 (packageManager フィールドで固定)
  • Node.js 24.14.1 に統一 (engines フィールドで固定)
  • 旧ロックファイル (yarn.lock / package-lock.json) を削除

2. セキュリティ設定

  • .npmrc / pnpm-workspace.yaml でセキュリティポリシーを設定
    • audit-level: high (高以上の脆弱性を検知)
    • ignore-scripts: true (postinstall等のスクリプト実行を無効化)
    • save-exact: true (バージョン完全固定)
    • engine-strict: true (Nodeバージョン厳格チェック)
    • minimumReleaseAge: 10080 (7日未満のパッケージをブロック)

3. 依存関係の最新化

  • 全依存関係を最新バージョンに更新 (pnpm update --latest)
  • ESLint flat config (eslint.config.mjs) へ移行 (gts 7.0)

4. CI/CD更新

  • GitHub Actionsワークフローのパッケージマネージャーをpnpmに変更
  • pnpm audit ステップを追加
  • Node.jsバージョンを24.14.1に統一

確認事項

  • pnpm install 成功
  • pnpm run build 成功
  • pnpm run test 成功 (テストがある場合)

april418 and others added 10 commits May 28, 2026 22:30
パッケージマネージャーをpnpm 10.33.0に統一し、
セキュリティ関連の設定を追加した。

主な変更:
- .npmrc / pnpm-workspace.yaml でセキュリティポリシーを設定
- 全依存関係を最新バージョンに更新 (pnpm update --latest)
- バージョンを完全固定 (save-exact)
- ESLint flat config (eslint.config.mjs) へ移行 (gts 7.0)
lodash 4.18.0で修正済みだが、公開から7日未満のため
minimumReleaseAgeによりインストールできない。
7日経過後にignoreCvesを削除しoverridesで修正すること。
- minimumReleaseAgeExcludeでlodash/lodash-esをmin-release-ageから除外
- overridesでlodash<=4.17.23を>=4.18.1に強制更新
- GHSA-r5fr-rjxr-66jc (Code Injection) の修正バージョンに更新
- ignoreCvesエントリを削除(脆弱性が修正済みのため不要)
lodash 4.18.1がminimumReleaseAge (7日) を超えたため、
minimumReleaseAgeExcludeからlodash/lodash-esを削除。
overridesによるセキュリティ強制は維持。

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- ignoreDeprecations: "6.0"とcomposite: falseを追加
- lib: DOMにES2023を追加
- webpack.config.jsをESLint ignoresに追加

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
pnpm.overrides で固定したセキュリティ更新が上流の patched release
で不要になった際、人手で外す手間と外し忘れによる古い override
残存を防ぐため、override を定期的に prune する workflow を追加する。

毎週月曜 6 時 UTC に走らせ、不要になった override を削除する
PR を自動作成する。im-core / cdp-client / rt.js / trust360 で
同じ構成が既に運用されており、それと同じ pinact 済み action SHA /
pnpm 10.33.0 / setup-node の node-version-file 連動を採用している。

Co-Authored-By: Claude <noreply@anthropic.com>
audit で 2 つの high vuln を検出して CI が落ちていた:

- tmp <0.2.6 (GHSA-ph9p-34f9-6g65, path traversal)
- fast-uri <=3.1.1 (GHSA-v39h-62p7-jpjc, path traversal)

tmp は既存 override (>=0.2.4) では 0.2.4 / 0.2.5 を許してしまい
新 CVE に該当するため、>=0.2.6 に bump する。tmp 0.2.6 は本日
(2026-05-27) リリースされたばかりで minimumReleaseAge (1 週間)
に抵触するため minimumReleaseAgeExclude に追加する。

fast-uri は ts-loader > webpack > schema-utils > ajv 経由の
推移依存。同じ高重要度 CVE を rt.js / cdp-client / trust360 等
他リポでも fast-uri@<=3.1.1: '>=3.1.2' で対応済みの組み合わせ。

Co-Authored-By: Claude <noreply@anthropic.com>
master 由来の test.yml は yarn install --immutable / yarn test を
使っていたが、本ブランチの pnpm 移行で yarn.lock を削除した結果
yarn install が exit する。NODE_OPTIONS=--openssl-legacy-provider
も webpack 5.105+ では不要になるため削除する。

他リポ (cdp-client / rt.js / trust360) と同じ pinact 済み action
SHA / pnpm 10.33.0 / node 24.14.1 / Security audit step の構成に
揃える。

合わせて vitest.config.ts を eslint.config.mjs の ignores に追加
する。flat config の typescript-eslint パーサが
parserOptions.project に含まれない vitest.config.ts を解析しよう
として parsing error を出すため。

Co-Authored-By: Claude <noreply@anthropic.com>
@april418 april418 force-pushed the chore/migrate-to-pnpm-security-settings branch from 932503a to 9215594 Compare May 28, 2026 13:32
依存ツリーが進んだ結果、natural resolution が patched 範囲内に
収まるようになった以下の override を削除する:

- brace-expansion@<1.1.13: '>=1.1.13'  → 経路上 >=1.1.13 (2.1.0/5.0.5)
- braces@<3.0.3: '>=3.0.3'             → 経路上 3.0.3 が natural
- fast-uri@<=3.1.1: '>=3.1.2'          → 経路上 3.1.2 が natural
- http-proxy-middleware@<2.0.7: '>=2.0.7' → 経路上 2.0.9 が natural
- micromatch@<4.0.8: '>=4.0.8'         → 経路上 4.0.8 が natural
- node-forge@<1.4.0: '>=1.4.0'          → 依存ツリーに含まれていない (dead)
- webpack-dev-middleware@<=5.3.3: '>=5.3.4' → 経路上 7.4.5 が natural
- webpack-dev-server@<=5.2.0: '>=5.2.1'    → 直接依存 5.2.3 で適用外
- lodash@<=4.17.23: '>=4.18.1'         → 経路上 4.18.1 が natural
- lodash-es@<=4.17.23: '>=4.18.1'      → 依存ツリーに含まれていない (dead)

audit (pnpm dlx pnpm@11.0.0-rc.1 audit) で high 0 / moderate 8 を
キープしていることを確認済み。pnpm test / build も pass。

tmp の override (および minimumReleaseAgeExclude) のみ残す:
tmp 0.2.6 は 2026-05-27 リリースされたばかりで強制適用が必要なため。

Co-Authored-By: Claude <noreply@anthropic.com>
@april418 april418 marked this pull request as ready for review May 28, 2026 14:32
@april418 april418 requested review from eknis and fecker May 28, 2026 14:33
Copy link
Copy Markdown
Member

@fecker fecker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@april418 april418 force-pushed the chore/migrate-to-pnpm-security-settings branch from 01d8760 to 786bd85 Compare May 29, 2026 15:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants