Skip to content

fix(deps): audit scoped CLI YAML override and security patches - #258

Merged
ootakazuhiko merged 1 commit into
mainfrom
fix/issue257-dependency-audit
Oct 15, 2026
Merged

ootakazuhiko merged 1 commit into
mainfrom
fix/issue257-dependency-audit

Conversation

@ootakazuhiko

@ootakazuhiko ootakazuhiko commented Oct 15, 2026 •

Copy link
Copy Markdown
Collaborator

概要

Refs #257 / portal itdojp/it-engineer-knowledge-architecture#297。ユーザー承認済みの「限定override契約改訂案」の検証PRです。本文・公開assets・build・Node/npm・CLI本体・Pages・formatter pinは変更しません。

  • base 7bb50dae86cc57d2febf9bbaf1b828e41d8ef037
  • reviewed candidate a48af0b8a2f747bb683cb6036ca3646eeb30901d
  • 変更4ファイル: package.json / package-lock.json / check-install-script-policy.js / check-chapter08-codeql-contract.js

限定契約

既存CLI0.49.1はjs-yaml ~5.2.1 を宣言していますが、公式修正版は5.4.1。上流範囲を書き換えず、CLI0.49.1 × 宣言~5.2.1 × scoped override5.4.1 × nested解決5.4.1 が一致する場合だけ監査済み例外として許可します。generic semver検査とglobal override禁止は維持。別CLI、別範囲、未監査5.4.2、ranged override等は拒否。installed packageと実CLIの正常/lint違反/不正YAMLも検査します。

最小依存修正

  • root js-yaml4.3.2 / nested5.4.1
  • markdown-it14.3.1 / brace-expansion5.0.12(既存override更新)
  • CLI専用smol-toml1.9.0 / math専用KaTeX0.18.2
  • qs6.16.1 / 必要side-channel chain
  • Sharp0.35.5 / platform packages・libvips1.3.4 / 必要@emnapi/runtime1.11.3

37 dependency entriesのnpm配布tarball SHA512とlock SRIを照合、official GHSA12件は#257参照。上流CLI宣言とnpm/Node、Puppeteer25.8.0、Sharp宣言^0.35.3、script-free/allowScripts契約は不変。Sharpの期待lock版1行のみ同期。

検証

  • Node22.22.2 / Node24.21.0 + npm12.0.1 fresh ci --ignore-scripts とfull audit:旧C0H5M3L3→新全severity0
  • 両Nodeでfull npm run test:light: security / install-policy63negative・実npm10.9.7+12.0.1隔離fixtures / Puppeteer25mock / metadata / 章別契約 / lint / Jekyll
  • CodeQL: dependency17negative、tuple4negative+1positive、既存workflow7negative+1positive、actual YAML CLI3ケース
  • old/new actualCLI YAML/TOML各正常・lint違反・不正設定 =6/版、YAML4/TOML2 parse値同等
  • 一般API/lint13serialized outputs同等、数式3MathML同等
  • actual ImageOptimizer:旧新各2設定×PNG/WebP/AVIF、resize・成功・errors0同等
  • 現行exact formattercffで5QA scans成功、Unicode/build smoke29routes/5assets
  • 41buildfilesの反復生成raw差分0、canonical/generated drift0、diffcheck成功
  • Chrome149 local/public root/ch08 ×1280/393 =8DOM、visible検索4input操作成功
  • exact-head PR CI: Book QA38700561019 / Docs38700560989
  • exact-head Codex manual + Copilot5529813651(COMMENTED0、配布検証制限は実SRI/CIで補足)、本文/inline/suggestions/threads照合0/0/0
  • Ready自動レビュー安定: summary6187125621、同head、2026-10-15T07:53:22Z Completed、2回安定、review0/0/0
  • 通常matched-head merge後actualmain CI/fresh install/audit/Pages API/deployment/HTTP

互換性境界・未変更事項

  • TOML1.9はnull-prototype objectへ変化。実CLIのspread/deep-extend/Object.entriesと出力を確認したCLI限定互換性であり、一般利用者のprototype互換性ではありません。CLIはJSON→TOML→YAML fallbackを持つため「拡張子ごとの厳密parser」でもありません。
  • KaTeX HTML wrappers/styleは同一でない。MathML/lintを確認、Jekyll公開生成は不変。
  • Sharp Linux実callerを確認。全platform codec出力byte同一の主張なし。
  • formatter現行pin cff9fcf8bae31140f07b358d314fc64173cb7013 のfresh audit H3/M3は別件で残存。本PRのroot audit0で抑制/隠蔽せず、pin-onlyは別PR。
  • 既存layout warning2、mobile検索hidden等は残存。全面a11y保証ではありません。
  • 初回test:lightの旧YAML契約FAILと新fixture診断prefix不一致・TOML prototype差の検出ログは保持。実データを確認して契約/比較範囲を明示したもので、失敗skipやaudit抑制なし。
  • no force/rebase/main push/admin/settings/auto-merge。別担当white-hat/privateリポジトリ未変更。

完了証跡 — 限定override検証・通常merge・actualmain確認

PR #258 を通常matched-head squashでmergeしました。

  • reviewed head: a48af0b8a2f747bb683cb6036ca3646eeb30901d
  • actual main: 21d9ce24ae81224cde2176bbb8a28d6a3b751ddf
  • reviewed/main tree一致、single parent。admin/bypass/force/rebase/main push/settings変更なし。

契約・実行検証

CLI0.49.1 / upstream~5.2.1 / scoped+resolvedYAML5.4.1 のexact tuple例外のみ。global override禁止、他のCLI/範囲/未監査版拒否は維持。CodeQL17dependencynegative+4tuplenegative/1positive、既存workflow7negative/1positive、actualCLI正常/違反/不正設定。Node22/24/npm12.0.1 fulltest成功。

root旧C0H5M3L3→candidateとactualmain fresh install/audit全severity0。npm install-scripts pending0。旧新CLI10ケース/版(nested configPointer含む)、13serialized outputs・3MathML、Sharp実caller2設定×3形式/版が一致。TOML null-prototypeとKaTeX HTML差は別途明示済み、汎用完全互換性は主張しません。37tarball SRI照合済み。

Review / CI

  • Codex manual6187120269 → summary6187125621/no-major6187165311、Readyauto同head Completed2026-10-15T07:53:22Z、2回安定。
  • Copilot5529813651 COMMENTED0 findings(人間承認ではない)。外部配布版/SRIの検証制限は実配布hash/CIを補足済み。
  • wholePR review本文1/inline0/thread0、postmergeも unresolved/mismatch/missing 0/0/0、pendingreview0。
  • PR BookQA38700561019 / Docs38700560989 SUCCESS。
  • actualmain BookQA38702029147 / Docs38702029239 / Pages38702028073 SUCCESS。
  • Pages API built exactmain / deployment 7087082216 success。

Publication

actualmainでfresh install/fulltest/build/canonical drift0/built29routes5assets成功。公開29routes+2assets=31HTTP200、root/ch08/searchJS/mainCSS rawbytes不変。Chrome149 local/public root/ch08×1280/393で8DOM/4検索操作成功。mobile画像pixel差分0、desktopは検索input枠だけ差分あり・目視で本文/nav差なし(全面pixel一致とはしない)。反復build41files raw差分0。

残存・境界

本Issueはroot依存の受入条件を満たしました。現行formattercffのH3M3は別pin-only PRで扱い、root0で消えたとは扱いません。既存layoutwarning2/mobileheader clipping・searchhiddenは本文変更せず維持。CLI/Node/npm/allowScripts/build/docs/assets/Pages/pin不変。次は同repo直列の独立formatter pin検証です。

@ootakazuhiko

Copy link
Copy Markdown
Collaborator Author

@codex review

Exact head a48af0b8a2f747bb683cb6036ca3646eeb30901d。本PRの最小差分と本文の一次情報/実caller/old-new互換検証をご確認ください。exact CI全成功。依存とformatter pinは別PR、本文/assets/build/Node契約は変更しません。レビューはこのheadへの手動1回のみ。

@ootakazuhiko
ootakazuhiko requested a balanced review from Copilot October 15, 2026 07:43
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-15T07:53:22.558310Z a48af0b Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Already looking forward to the next diff.

Reviewed commit: a48af0b8a2

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔵 Needs a closer look

It is a security-sensitive dependency/override-contract change with a large lockfile whose integrity hashes and published version availability cannot be verified in this environment, and the author's own verification checklist is still incomplete.

0 open findings

What changed in this PR

This PR applies a batch of security/dependency updates to the book project's Node toolchain and codifies a narrowly-scoped exception that lets markdownlint-cli resolve a patched js-yaml (5.4.1) even though it falls outside the CLI's declared upstream range (~5.2.1). It references issue #257 (restore root npm audit gate before the formatter rollout) and is explicitly framed as a verification PR that only touches dependencies and their guarding contracts — not book content, published assets, build, Node/npm, or the formatter pin.

The changes are internally consistent: package.json and package-lock.json version/override edits line up with each other and with the two updated contract scripts, the new transitive dependencies (es-define-property, updated side-channel*, object-inspect) are present, and each forced override (js-yaml, smol-toml, katex, markdown-it) has a single consumer so the hoisted lock entries are correct. The new "audited override tuple" guard in the Chapter 8 contract is matched by 18 negative self-test cases, which I traced individually — each produces the asserted error substring.

Changes:

  • Add an isAuditedMarkdownlintYamlOverride guard (exact tuple: CLI 0.49.1 × declared ~5.2.1 × resolved 5.4.1 × override 5.4.1) plus a malformed-YAML fail-closed smoke check and new negative self-test cases in check-chapter08-codeql-contract.js.
  • Bump security-relevant dependencies in package.json/package-lock.json: js-yaml 4.3.2 / nested 5.4.1, markdown-it 14.3.1, brace-expansion 5.0.12, smol-toml 1.9.0, katex 0.18.2, qs 6.16.1, sharp 0.35.5 + platform/libvips 1.3.4 + @emnapi/runtime 1.11.3.
  • Update check-install-script-policy.js expected sharpVersion to 0.35.5 to match the new lock resolution.
File Description
scripts/​check-chapter08-codeql-contract.js Adds audited-tuple override exception, malformed-YAML smoke, installed-CLI tuple check, and new self-test cases covering the exception boundary.
scripts/​check-install-script-policy.js Bumps expected sharpVersion 0.35.3 → 0.35.5 to match the updated lockfile resolution.
package.json Updates js-yaml devDependency, refreshes overrides, and adds scoped smol-toml and katex overrides.
package-lock.json Syncs resolved versions/integrity for js-yaml, markdown-it, brace-expansion, smol-toml, katex, qs/side-channel chain, and the full sharp/libvips/@emnapi graph.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@ootakazuhiko

Copy link
Copy Markdown
Collaborator Author

Review確認と配布検証の補足

Copilot review 5529813651 はCOMMENTED / 0 findingsですが、外部npm配布version/SRIを当該review環境で検証できないという制限が付記されています。人間のAPPROVEDとは扱いません。以下を実行環境から補足します。

  • official GHSA12件とnpm registry配布metadataを取得し、変更dependency 37 tarballsすべての実bytes SHA512 = npm dist.integrity = lock integrity を照合しました。配布版を推測で手入力したものではありません。
  • Node22.22.2/24.21.0 +指定npm12.0.1 fresh install/full audit(全0)/全test:light成功。インストールscript pending 0。
  • exact a48af0b8a2f747bb683cb6036ca3646eeb30901d Book QA 38700561019 / Docs 38700560989 success。Codex manual request6187120269 / summary6187125621 / no-major6187165311 は同head。
  • 追加nested YAML/TOML --configPointer /config 正常/MD013違反4ケース/版も旧新一致。TOML null-prototype差は明示済みで、汎用prototype互換性を主張していません。
  • self-testの実出力は 17 dependency mutations + 4 tuple negatives/1 positive。review本文の「18」は実行計数には採用しません。
  • チェックリストのReady自動review/main/Pages欄は意図的に未完了です。後続ゲートが成功する前にチェックしません。remote review正文/inline/threadsを照合して0/0/0確認後、Ready自動reviewへ進めます。

代表配布のSRI(残りnative platformを含む全37件も照合済み)

lock package version verified integrity
js-yaml 4.3.2 sha512-SFNOvSJ+Dgf/9An904Yx+CgSlIPCkIpao4qo51lpee25TIRejdH3rhR4EZMGoNx3/TP3O+wzWuiTFl4sqbltzA==
markdownlint-cli/node_modules/js-yaml 5.4.1 sha512-28R/k+NAjeuf7+CKlTxWZVExJGwVVLwY06DgEnOMz2gEpfNkDcD7QvyiVPT0xy0XXhU8vHsd4Ot42OOPdJG7dQ==
smol-toml 1.9.0 sha512-hpd+HLON7HdZXqYchMM/+LaTTbdK0AU3NngIJ4KVyWbY9bfQqdL9cD+4yf6dUoU2Ap4VsU0JkQi6FxAI1B2mXQ==
katex 0.18.2 sha512-3snve4y0SXTMequLim1FMiPvLGElySam0blN5xQZBqEY3lOJz1TnuaaiugnBZBqHzlSAGmFTYL7MCQkORuLKCA==
sharp 0.35.5 sha512-Ywn4OnzGukp7CDMrp08RQ50YKmuwG47brZgIVPTvBaaAfQlRlygrRqSrxdCiL9M+LlzLBiJ68IR1QqvzHyjC7g==
markdown-it 14.3.1 sha512-4Ej49aYTDFIQ+uBkfX8GBvJGccoARxxPep+7aWTs55ozbjQJpW9M26Fe53vnGgvLeVzva/amzjQQaQu9w0vMhA==
brace-expansion 5.0.12 sha512-YovQ3rzhaLMIrDjNDMkNS01tea93qhEhG5xy8f6+R0l+dw3Ki+5sCoIoI942iuLZTHWogWktgwVDhU09iNEimQ==
qs 6.16.1 sha512-5Px6J7rfHBAGUhNQ3es4YzcOdBBw0SDcVtThJml4RdnKw4tKs2epA0kPZ+K8X+WiHktT93RHVcQ/3ym5aTCgtg==
@img/sharp-linux-x64 0.35.5 sha512-SxFtLTeJInhAA9Q836kux2vZNeOBQEx658qvbboZScr0wIARym3IcGmW7KpVD5sbVg0Ojy+udFQdayYIZyoNog==
@img/sharp-libvips-linux-x64 1.3.4 sha512-GJ//SSXbnwSDes02umB3nDJLFcQzw8a18V8fyhqr6tV515tOEMdImjjxj1AoafMRz56F3PHgftnj1QEKSU1zkw==

対象lock SHA256: b55308a8b2f2cdcd5d04cdd8f3e8b71b37d87aa02d3f9f9b28fc17a08cbd491c

@ootakazuhiko
ootakazuhiko marked this pull request as ready for review October 15, 2026 07:51
@ootakazuhiko
ootakazuhiko merged commit 21d9ce2 into main Oct 15, 2026
3 checks passed
@ootakazuhiko
ootakazuhiko deleted the fix/issue257-dependency-audit branch October 15, 2026 07:55
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