Skip to content

chore: define install-script policy#252

Merged
ootakazuhiko merged 4 commits into
mainfrom
codex/issue-235-install-script-policy
Jul 23, 2026
Merged

chore: define install-script policy#252
ootakazuhiko merged 4 commits into
mainfrom
codex/issue-235-install-script-policy

Conversation

@ootakazuhiko

Copy link
Copy Markdown
Collaborator

概要

  • npm 12のinstall-script policyをpackage.jsonのallowScriptsで明示しました。
  • active build:fullが使うSharpを0.35.3へ更新しました。この版はinstall script自体を持たないため、承認対象から除外しています。
  • 既定PDF engineではなくREADMEもdownload skipを指定するPuppeteerは、install scriptを明示denyしました。
  • lint transitiveの安全版再解決により、2026-07-23時点のnpm audit high 5を0へ解消しました。
  • policy、lock、active consumer、既定PDF engine、README導線を検査する8件のnegative mutation付き契約をBook QAとtest:lightへ追加しました。

before / after

  • before(npm 12.0.1): puppeteer@24.43.1とsharp@0.34.5のinstall scriptが未承認としてblock
  • after(npm 12.0.1): pending allowScripts 0。sharp@0.35.3はscript-free、Puppeteerは明示deny
  • before audit: high 5 / critical 0
  • after audit: 0 vulnerabilities

npm公式方針: https://docs.npmjs.com/cli/commands/npm-install-scripts/

検証

  • npm 12.0.1 clean npm ci: success、未承認install-script warning 0
  • npm 12.0.1 install-scripts ls --json: pending 0
  • npm audit: 0 vulnerabilities
  • Sharp 0.35.3実処理: 4x4 RGBA入力からWebP生成・再読込success
  • install-script contract: success
  • self-test: 8 negative mutations rejected
  • npm run test:light: success
  • Jekyll build: success
  • workflow YAML parse / actionlint 1.7.12: success
  • git diff --check: success

managed Faraday warning

actions/jekyll-build-pages:v1.0.13は固定Gemfileでgithub-pages=232を使用し、repository Gemfileはbundle check --dry-runにだけ使います。build本体のOctokit/Faraday bundleはrepositoryから変更できないため、本PRではwarning filterや効果のないfaraday-retry追記を行いません。

Rollback

本PRのsquash commitをrevertし、package / lock / policy contractを一体で戻します。

Closes #235

Copilot AI review requested due to automatic review settings July 22, 2026 23:43
@ootakazuhiko

Copy link
Copy Markdown
Collaborator Author

@codex review

Please review exact head f6abf1034cf7d87aba1b6fe8bb9f60e5ea8d0d32. Focus on npm 12 allowScripts semantics, the script-free Sharp 0.35.3 update, explicit Puppeteer denial, negative mutations, and Node 20 compatibility.

@ootakazuhiko

Copy link
Copy Markdown
Collaborator Author

@codex review

Please review exact head f6abf10. Correction: this is the PR head returned by GitHub. Focus on npm 12 allowScripts semantics, the script-free Sharp 0.35.3 update, explicit Puppeteer denial, negative mutations, and Node 20 compatibility.

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f6abf10f1d

ℹ️ 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".

Comment thread package.json Outdated
Comment thread package.json

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.

Pull request overview

npm v12 の install-script policy に合わせて、依存関係の install script 承認/拒否を package.json#allowScripts と契約テストで明示し、Book QA / test:light に組み込むPRです。あわせて Sharp を script-free なバージョンへ更新し、audit 脆弱性の解消を狙っています。

Changes:

  • allowScripts(Puppeteer install script の明示 deny)と install-script policy 契約チェック(self-test/negative mutation 付き)を追加
  • test:light と Book QA workflow に install-script policy 契約チェックを組み込み
  • Sharp を 0.35.3 に更新し、lockfile/overrides を再解決(audit high を解消)

Reviewed changes

Copilot reviewed 3 out of 4 changed files in this pull request and generated 3 comments.

File Description
scripts/check-install-script-policy.js install-script policy の契約チェック + self-test を新規追加
package.json allowScripts 追加、Sharp 更新、契約チェックを test:light に組み込み、overrides 更新
package-lock.json Sharp/依存の解決更新(install script 状態の反映含む)
.github/workflows/book-qa.yml ルート lock のキャッシュ対象化 + install-script policy 契約チェックを追加

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread scripts/check-install-script-policy.js
Comment thread scripts/check-install-script-policy.js
Comment thread package.json
@ootakazuhiko

Copy link
Copy Markdown
Collaborator Author

@codex review

再レビュー対象 head: ad0ea37a534ca6914be31f5bff5d54b6ba6b4dd0

既存5スレッドは全件確認し、4件は修正、allowScriptsに関する1件は npm 12.0.1 の実測と npm 公式仕様に基づき変更不要理由を返信して解決しました。特に install script package 集合の完全一致、Node.js engine 契約、negative fixture を再確認してください。

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ad0ea37a53

ℹ️ 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".

Comment thread package.json
@ootakazuhiko

Copy link
Copy Markdown
Collaborator Author

@codex review

再レビュー対象 head: cca221416d0eaf61e5ce3009f1338f57795b0844

最新P1に対応し、npm 12.0.1のpackageManager固定、Node実要件、Book QAでのnpm固定・assert、契約self-testを追加しました。既存threadはすべて解決済みです。install-script policyが実行時にも固定されることと、CI/toolchain整合を再確認してください。

@ootakazuhiko

ootakazuhiko commented Jul 23, 2026

Copy link
Copy Markdown
Collaborator Author

CI failure対応:

  • failed run: https://github.com/itdojp/github-workflow-book/actions/runs/29968111483
  • root cause: GitHub runner同梱npmを npm install --global npm@12.0.1 で自己更新した際、npmのglobal treeが途中状態となり promise-retry を読めず失敗
  • focused fix: runner同梱npmを変更せず、root policyの全コマンドを npx --yes npm@12.0.1 で実行
  • CI契約: npm 12.0.1版assert、通常 ci(allowScriptsを実運用)、audit、install-scripts ls pending 0
  • local: 同じnpxコマンドでclean ci / audit 0 / pending 0 / policy self-test成功
  • new head: 9400c31ce2283a740cfeb3eadb215d41f559a491

admin bypassは使用していません。

@ootakazuhiko

ootakazuhiko commented Jul 23, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

Re-review exact head 9400c31ce2283a740cfeb3eadb215d41f559a491. The GitHub runner npm self-update failure is fixed by invoking the pinned npm 12.0.1 through npx for every root policy operation, without mutating the runner-global npm. Verify the runtime policy and CI contract.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. What shall we delve into next?

Reviewed commit: 9400c31ce2

ℹ️ 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".

@ootakazuhiko
ootakazuhiko merged commit c914318 into main Jul 23, 2026
2 checks passed
@ootakazuhiko
ootakazuhiko deleted the codex/issue-235-install-script-policy branch July 23, 2026 00:12
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.

[P2][Build] npm allowScripts / Faraday warningを解消する

2 participants