Skip to content

feat(repo): migrate to Yarn 4 with 7-day npm cooldown#448

Merged
YusukeHirao merged 5 commits into
devfrom
chore/npm-cooldown
Apr 22, 2026
Merged

feat(repo): migrate to Yarn 4 with 7-day npm cooldown#448
YusukeHirao merged 5 commits into
devfrom
chore/npm-cooldown

Conversation

@YusukeHirao
Copy link
Copy Markdown
Member

@YusukeHirao YusukeHirao commented Apr 22, 2026

Summary

Yarn 4 への移行と、npm サプライチェーン攻撃対策として 7日未満のパッケージをインストール・更新対象から除外するクールダウン期間の設定(frontend-env#886 の展開)を同時に行います。

Yarn 4 移行

  • package.jsonpackageManager: "yarn@4.12.0" を追加、volta.yarn1.22.224.12.0
  • .yarnrc.yml を新規作成(他リポジトリと同じ nodeLinker: node-modules / npmRegistryServer / enableGlobalCache 構成)
  • yarn.lock を Yarn 4 形式に再生成
  • .gitignore に Yarn Berry 用の除外設定を追加

npm クールダウン

  • .yarnrc.ymlnpmMinimalAgeGate: 7d を追加(Yarn 4.10.0+)
  • .github/renovate.jsonminimumReleaseAge: "7 days" / internalChecksFilter: "strict" / osvVulnerabilityAlerts: true / vulnerabilityAlerts.minimumReleaseAge: null を追加

なぜ7日なのか

悪意あるパッケージの多くは公開から数時間〜数日以内に検出・削除されます。公開直後の短期間をブロックするだけで高い防御効果が得られます。

3日(Renovate の config:best-practices デフォルト)では防御期間として短く、14日以上は開発速度への影響が大きくなるため、7日を採用しています。Andrew Nesbitt も7日間のクールダウンの有効性について言及しています(Package Managers Need to Cool Down)。

参考資料

動作

ツール 動作
Yarn yarn install 時、公開7日未満のパッケージが含まれるとエラーで停止
Renovate 7日経過前はブランチ自体を作成しない(CVE対応のセキュリティ更新はバイパス)

Warning

Yarn 側には緊急時のバイパス手段がありません。
セキュリティパッチなど公開直後のパッケージをどうしても即座にインストールする必要がある場合は、.yarnrc.ymlnpmMinimalAgeGate を一時的にコメントアウトして対応してください。
対応後は必ず元に戻してください。

@cursor
Copy link
Copy Markdown

cursor Bot commented Apr 22, 2026

You have used all of your free Bugbot PR reviews.

To receive reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.

@YusukeHirao YusukeHirao changed the title feat(repo): add 7-day cooldown period for Renovate updates feat(repo): migrate to Yarn 4 with 7-day npm cooldown Apr 22, 2026
@YusukeHirao YusukeHirao merged commit 47d08ed into dev Apr 22, 2026
1 check passed
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.

1 participant