-
Notifications
You must be signed in to change notification settings - Fork 0
Add supply chain security policy with npm cooldown #630
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| version: 2 | ||
|
|
||
| # 依存更新(version update)にクールダウンを適用し、公開直後のバージョンを自動取り込みしない。 | ||
| # - cooldown は version update のみ対象。security update(CVE 対応)は対象外で即時 PR が出る(設計どおり)。 | ||
| # - ローカル / CI の `npm install` 側の防御は `.npmrc` の min-release-age=7(CONTRIBUTING.md 参照)。 | ||
| updates: | ||
| # ── npm 依存 ── | ||
| - package-ecosystem: "npm" | ||
| directory: "/" | ||
| schedule: | ||
| interval: "weekly" | ||
| open-pull-requests-limit: 5 | ||
| groups: | ||
| npm-minor-patch: | ||
| update-types: | ||
| - "minor" | ||
| - "patch" | ||
| cooldown: | ||
| default-days: 7 # .npmrc の min-release-age=7 に合わせる | ||
| semver-major-days: 14 # major はより慎重に | ||
|
|
||
| # ── GitHub Actions(SHA ピン)── | ||
| - package-ecosystem: "github-actions" | ||
| directory: "/" | ||
| schedule: | ||
| interval: "weekly" | ||
| open-pull-requests-limit: 5 | ||
| # NOTE: Dependabot の cooldown は github-actions エコシステムでは未サポートのため付けない | ||
| # (付けると設定が拒否/無視される)。アクション更新は週次 PR を人手レビューで取り込む。 | ||
| groups: | ||
| github-actions: | ||
| patterns: | ||
| - "*" |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| # 依存パッケージのクールダウン(サプライチェーン対策) | ||
| # 公開後 7 日未満のバージョンは npm install / npm update の解決対象にしない。 | ||
| # 要 npm >= 11.10.0。古い npm(Node 22 同梱の npm 10.x 等)では無視されるため、 | ||
| # ローカルでは `npm i -g npm@^11.10` で更新すること。詳細は CONTRIBUTING.md を参照。 | ||
| min-release-age=7 | ||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| # コントリビューションガイド | ||
|
|
||
| ## 依存パッケージのクールダウン運用 | ||
|
|
||
| ### 方針 | ||
|
|
||
| 公開直後の npm パッケージバージョンは自動的にインストールしない。過去のサプライチェーン攻撃事例 | ||
| (2026-03 の axios 侵害事件など)を踏まえ、コミュニティ・自動セキュリティツールによる検出・報告の | ||
| 時間的猶予を確保する。 | ||
|
|
||
| ### 設定の全体像 | ||
|
|
||
| | レイヤ | 設定 | 守る対象 | | ||
| |---|---|---| | ||
| | ローカル / CI の `npm install`・`npm update` | `.npmrc` の `min-release-age=7` | 新しい依存を**解決して lockfile に書き込む**瞬間 | | ||
| | Dependabot の version update | `.github/dependabot.yml` の `cooldown` | Dependabot が出す定常アップデート PR | | ||
|
|
||
| 新しいバージョンが公開されてから **7 日**経過するまで、解決・提案の対象外になる。運用しながら必要に | ||
| 応じて調整する(例: 3 日 / 14 日)。 | ||
|
|
||
| ### 注意点(重要) | ||
|
|
||
| - **`min-release-age` は npm 11.10.0 以上が必要。** Node 22 同梱の npm(10.x)では**黙って無視され、 | ||
| 「効いていないのに通る」**状態になる。ローカル開発では npm を上げておくこと: | ||
|
|
||
| ```bash | ||
| npm install -g npm@^11.10 | ||
| npm --version # 11.10.0 以上を確認 | ||
| ``` | ||
|
|
||
| - **`npm config get min-release-age` が `null` を返すことがある。** npm 11.10+ は内部で `before`(絶対日付)に | ||
| 変換するため、設定が効いていても表示は `null` になりうる。実効値は `npm config get before` で確認する。 | ||
| - **`npm ci` は対象外。** lockfile 厳密インストールのため、クールダウンは効かない(CI は影響を受けない)。 | ||
| 守りどころは「依存を**追加・更新**して lockfile を書き換える瞬間」であり、ここは `npm install` / | ||
| `npm update` を使うローカル開発と Dependabot が該当する。 | ||
| - **security update(CVE 対応)はクールダウン対象外。** 脆弱性パッチは早く当てるべきなので、Dependabot | ||
| は cooldown を無視して即時 PR を出す(設計どおり)。 | ||
|
|
||
| ### 緊急パッチが必要な場合 | ||
|
|
||
| セキュリティ修正など 7 日待てない場合は、いずれかで対応する: | ||
|
|
||
| - `.npmrc` を一時的に書き換える PR を出す(マージ前にレビュー必須) | ||
| - バージョンを明示指定してインストールする(必要に応じて `--ignore-scripts` を併用し、悪意ある | ||
| インストールスクリプトの実行を抑止する) | ||
|
|
||
| いずれの場合も、**PR description に「なぜ通常のクールダウンを待たないか」を明記**すること。 |
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.
Uh oh!
There was an error while loading. Please reload this page.