fix(security): High 2件 (js-yaml / brace-expansion) を override 更新で解消 - #171
Merged
Conversation
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Contributor
Author
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
pnpm auditの High 2 件(js-yaml / brace-expansion)をpnpm-workspace.yamlの overrides 更新のみで解消します。記事(articles/)の変更はありません。1. 脆弱性の概要
js-yamlbrace-expansion[[[[...]]]]のようにネストした flow collection([]/{})を含む YAML でパース時間が指数的に増加し、CPU を占有できる。a{1..100000000}のようなレンジ/ネストしたブレース展開に上限が無く、短い文字列で巨大配列を生成してプロセスを OOM で落とせる。2. このコードベースでの攻撃シナリオ
本リポジトリは Zenn 記事(Markdown)の原稿置き場で、実行されるコードは
Makefileのmake lint(textlint)とmake preview(zenn previewのローカルサーバ)だけです。公開されるのは Zenn 側にレンダリングされた記事であり、このリポジトリの Node.js プロセスがインターネットに露出することはありません。js-yaml(経路:
. > textlint > @textlint/linter-formatter > js-yaml)攻撃の入口: textlint がフォーマッタ設定を読む際に
js-yamlが使われます。入力はtextlintrc.jsonとリポジトリ内の設定のみで、記事本文(Markdown)が YAML パーサに渡ることはありません(front matter の解釈は Zenn 側の処理で、本リポジトリの lint 経路には含まれません)。具体的な攻撃手法と成否: 悪意ある YAML を食わせるには textlint 設定ファイル自体を書き換える必要があり、外部からの到達経路はありません。仮に成立しても影響は「ローカル / CI の textlint が CPU を食って遅くなる」だけで、公開記事や閲覧者への影響はありません。
brace-expansion(経路:
. > textlint > glob > minimatch@10 > brace-expansion)攻撃の入口: textlint が
--ignore-path ./textlintignoreや対象ディレクトリarticlesを glob 展開する際に使われます。展開されるパターンはリポジトリ内のtextlintignoreの内容のみで、外部入力はありません。具体的な攻撃手法と成否:
textlintignoreにa{1..100000000}のような行を仕込めば lint プロセスを OOM で落とせますが、それはリポジトリへの書き込み権限が前提であり攻撃として成立しません(開発 / CI 環境限定・影響は lint ジョブの失敗のみ)。影響度評価: どちらも 低(開発時のツールチェーンのみ・予防的修正)。
3. 修正内容
pnpm-workspace.yamlの overrides を更新(js-yaml >=5.2.2、brace-expansionは 5.0.x 系の上限を<=5.0.7に直して>=5.0.8へ)。pnpm installによりpnpm-lock.yamlを更新(差分は該当 2 パッケージのみ)。brace-expansion@5.0.8を受け取るのは^5を要求するminimatch@10のみで、ブレースパターンの展開が動作することを確認済み(5.0.8 の CJS は{ expand, ... }を export するため旧 minimatch には当てない範囲指定にしています)。4. 確認結果
pnpm audit: High 0 件(修正前 2 件)。残るのは moderate 1 件(@hono/node-serverGHSA-frvp-7c67-39w9、textlint > @modelcontextprotocol/sdk経由。上流のパッチ待ちのため今回は対象外)。make lint: OK(textlint がエラーなく完走)Link to Devin session: https://app.devin.ai/sessions/9dc6db5c666e498fa0c0fb4369c8437c