Skip to content

fix(deps): next 配下の postcss を override し脆弱性アラートの原因を除去 - #730

Merged
ROhta merged 1 commit into
mainfrom
fix/postcss-override-next-pin
Jul 29, 2026
Merged

fix(deps): next 配下の postcss を override し脆弱性アラートの原因を除去#730
ROhta merged 1 commit into
mainfrom
fix/postcss-override-next-pin

Conversation

@ROhta

@ROhta ROhta commented Jul 29, 2026

Copy link
Copy Markdown
Owner

期待する挙動・状態

背景

next@16.2.12 が postcss を exact pin (8.4.31) で引き込むため、直接依存の postcss@8.5.23 と併存し、8.4.31 側にアラートが残り続けていた。直接依存を上げても next 配下は動かないため、Dependabot security update が無効な PR を作り続けていた。それらは security update ゆえ dependabot.ymlignore / cooldown を無視して公開直後に立つため、pnpm の minimumReleaseAge (24h) ゲートで CI が必ず落ちる状態でもあった。

確認済み項目

  • pnpm i --frozen-lockfile: exit 0
  • mise run check-versions: pnpm 版一致 11.17.0
  • eslint .: exit 0
  • vitest --run: 5 files / 14 tests pass
  • next build: exit 0 (TypeScript 検査・静的ページ 3 件生成まで完走、警告なし)
  • pnpm build-storybook: exit 0 (Chromatic 経路)
  • lockfile 差分が postcss 関連のみで、他パッケージに一切影響していないこと
  • 24h ゲート内の postcss@8.5.24 が混入していないこと (minimumReleaseAge が解決時に除外)
  • Vercel Preview デプロイの確認
  • main マージ後の再スキャンでアラート 3 件が閉じること (feature branch では閉じないため未確認)

見てほしいところ

  • override のスコープを next>postcss に限定した判断: 素の postcss: 指定は全 consumer に及ぶが、8.4.31 を引き込んでいるのは next のみなので親を限定した。将来 next 以外が古い postcss を引き込んだ場合は検知されず素通りするトレードオフがある
  • 値を ^8.5.23 (レンジ) にした判断: 直接依存の specifier と揃えることで postcss が lockfile 上 1 ノードに畳まれた状態を維持できる。exact 固定にすると将来また 2 ノードに割れる
  • pnpm-workspace.yaml に置いた判断: pnpm 11 は package.jsonpnpm フィールドを読まないため workspace yaml 側が唯一の選択肢という理解
  • next が pin を上げた後の後片付け: この override は next 側が postcss pin を更新したら不要になる。コメントに明記したが、削除トリガーを能動的に検知する仕組みは入れていない

Summary by CodeRabbit

  • バグ修正
    • 内部コンポーネントのバージョンを統一し、既知の脆弱性に関連する警告が残る問題を解消しました。
    • アプリケーションの安定性とセキュリティを改善しました。

next@16.2.12 が postcss を exact pin (8.4.31) で引き込むため、直接依存の
postcss@8.5.23 と併存し、8.4.31 側に OPEN な脆弱性アラートが 3 件残っていた。

- GHSA-qx2v-qp2m-jg93 (medium): </style> 未エスケープによる XSS
- GHSA-6g55-p6wh-862q (high): sourceMappingURL 経由の任意ファイル読み取り
- GHSA-r28c-9q8g-f849 (high): source map 自動読み込みのパストラバーサル

直接依存を上げても next 配下は動かないため、Dependabot security update が
postcss の新リリース毎に解決しない PR を作り続けていた (#727 / #729)。それらは
security update ゆえ dependabot.yml の ignore / cooldown を無視して公開直後に
立つため、pnpm の minimumReleaseAge (24h) ゲートで CI が必ず落ちる状態だった。

## override の範囲を next 配下に限定する理由

`next>postcss` セレクタで next 配下のみを対象にする。素の `postcss` 指定は全
consumer に及ぶが、8.4.31 を引き込んでいるのは next だけなので、影響範囲を実際の
問題箇所に一致させる。値は直接依存と同じ `^8.5.23` とし、postcss が lockfile 上
1 バージョンに畳まれた状態を維持する。

pnpm 11 は package.json の pnpm フィールドを読まないため pnpm-workspace.yaml に
記述する。next が pin を上げたらこの override は不要になる。

## 確認済み

- lockfile: postcss@8.4.31 のエントリが消え 8.5.23 単一に。他パッケージに差分なし
- 24h ゲート内の postcss@8.5.24 は混入せず (minimumReleaseAge が解決時に除外)
- pnpm i --frozen-lockfile: exit 0
- mise run check-versions: pnpm 版一致 11.17.0
- eslint .: exit 0
- vitest --run: 5 files / 14 tests pass
- next build: exit 0 (TypeScript 検査・静的ページ 3 件生成まで完走、警告なし)

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014MRnn98gA2cbVajJqkgw5E
@ROhta ROhta added the dependencies モジュールアップデート label Jul 29, 2026
Copilot AI review requested due to automatic review settings July 29, 2026 06:40
@ROhta ROhta self-assigned this Jul 29, 2026
@github-project-automation github-project-automation Bot moved this to 待機 in bingo_next Jul 29, 2026
@vercel

vercel Bot commented Jul 29, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
bingo-next Ready Ready Preview, Comment, Open in v0 Jul 29, 2026 6:40am

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@coderabbitai

coderabbitai Bot commented Jul 29, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 18f79ac3-a641-4ffc-967f-06433213c633

📥 Commits

Reviewing files that changed from the base of the PR and between bd89d78 and c8ec312.

⛔ Files ignored due to path filters (1)
  • application/pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml, !application/pnpm-lock.yaml
📒 Files selected for processing (1)
  • application/pnpm-workspace.yaml

📝 Walkthrough

Walkthrough

pnpm-workspace.yamloverrides を追加し、Next.js 配下の postcss^8.5.23 に統一する設定と背景コメントを追加しています。

Changes

依存関係更新

Layer / File(s) Summary
PostCSS override 設定
application/pnpm-workspace.yaml
next>postcss^8.5.23 に指定し、Next.js が固定する postcss@8.4.31 との併存を避ける設定を追加しています。

Estimated code review effort: 1 (Trivial) | ~5 minutes

Suggested labels: dependencies

Suggested reviewers: copilot

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed next 配下の postcss を override して脆弱性アラートの原因を解消する変更を適切に要約しています。
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Fix failing CI checks
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/postcss-override-next-pin

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@ROhta
ROhta merged commit a73ddef into main Jul 29, 2026
17 of 19 checks passed
@ROhta
ROhta deleted the fix/postcss-override-next-pin branch July 29, 2026 07:02
@github-project-automation github-project-automation Bot moved this from 待機 to 完了 in bingo_next Jul 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies モジュールアップデート

Projects

Status: 完了

Development

Successfully merging this pull request may close these issues.

2 participants