npm の段階的公開機能とインストール時の制御オプションが利用可能に
npm はサプライチェーンセキュリティ強化のため、承認プロセスを必要とする「ステージング公開」機能と、インストールソースを細かく制御する新しいフラグ機能を正式にリリースした。
キーポイント
ステージング公開の一般化
パッケージ公開時に即時利用可能にするのではなく、承認待ちキューに保存し、2FA を持つメンテナーが明示的に承認するまで公開されない仕組みが正式に利用可能になった。
インストールソース制御の強化
--allow-file, --allow-remote, --allow-directory の新フラグが追加され、npm install 時にローカルファイルや遠隔 URL からの依存関係解決を明示的に許可・拒否できるようになった。
CI/CD ワークフローとの連携
OIDC を活用した信頼できる公開者設定と組み合わせることで、非対話型の CI/CD 環境でも安全にステージング公開を行い、後から人間が承認するハイブリッドなワークフローを推奨している。
バージョン要件と移行
これらの新機能を利用するには npm CLI バージョン 11.15.0 以上が必要であり、既存の CI/CD ワークフローを「npm stage publish」へ更新する必要がある。
--allow-git デフォルト値の変更予告
次期メジャーバージョン(v12)では、--allow-git のデフォルトが「all」から「none」に変更されます。
新しいインストール制御フラグの導入
npm 11.15.0 で --allow-file、--allow-remote、--allow-directory が追加され、これらを none に設定することで即時に厳格な動作を適用できます。
影響分析・編集コメントを表示
影響分析
この発表は、ソフトウェアサプライチェーン攻撃に対する防御策として、開発者コミュニティ全体に「公開前の承認」という重要なセキュリティ層を追加する画期的な変化です。特に、CI/CD の自動化を維持しつつ人間による最終チェックを導入できる仕組みは、大規模プロジェクトやコンプライアンス要件が厳しい環境での採用が期待されます。
編集コメント
サプライチェーンセキュリティが喫緊の課題となる中、npm が提供するこの機能は、自動化と人的承認のバランスを最適化する重要なステップです。開発者は即座に CLI の更新を行い、ワークフローの見直しを検討すべきでしょう。
本日、npm のサプライチェーンセキュリティに焦点を当てた 2 つの更新を発表します。
ステージング公開(Staged publishing)が一般利用可能になりました。
新しいインストールソースフラグ(--allow-file, --allow-remote, --allow-directory)が、既存の --allow-git フラグを補完します。
これらは npm CLI 11.15.0 以降で利用可能です。
ステージング公開が一般利用可能になりました
npm におけるステージング公開が、本日一般利用可能となりました。パッケージバージョンを直接公開して即座に消費者に利用可能にするのではなく、事前にビルドされた tarball をステージキューにアップロードし、インストール可能になる前にメンテナが明示的に承認する必要があります。このキューは npmjs.com と npm CLI の両方で確認できます。
ステージング公開は、すべての公開(非対話型 CI/CD ワークフローから発生するものや、OIDC を使用した信頼できる公開を利用するものを含む)において「存在証明」を強化します。パッケージがレジストリにリリースされる前に、2FA 認証の課題に答える人間によるメンテナの承認が必要です。
ステージング公開は本日稼働を開始し、ドキュメントも同時に公開されています。
概要と入門ガイド
CLI リファレンスと権限
信頼できるパブリッシャー(更新版)
要件
npm stage を使用するには、npm CLI 11.15.0 以降が必要です。
ステージング動作を望む箇所では、npm publish の代わりに npm stage publish を使用するよう CI/CD ワークフローを更新してください。
推奨セットアップ
段階的公開は、信頼できる公開(OIDC)と組み合わせて行うことを推奨します。信頼できる公開の設定をステージング専用に制限することで、そのワークフローからの npm publish は拒否され、npm stage publish のみが受け入れられるようになります。CI ワークフローは非対話式で継続して実行され、後からメンテナーがウェブサイトまたは CLI からステージングされたバージョンを承認します。
ローカルでも npm stage publish を実行できますが、最も価値が高いセットアップは、CI でステージングキューへ公開し、信頼できるデバイスからメンテナーが承認する構成です。
2026 年 2 月にリリースされた一括の信頼できる公開設定を既に管理している場合は、それを使用してパッケージを段階的公開へ移行できます。CI ワークフローを新しい CLI バージョンに更新し、npm stage publish を使用することを忘れないでください。
新規インストールソースフラグ
npm 11.10.0 では、npm install が Git ソースから依存関係を解決できるかどうかを制御するために --allow-git を導入しました。npm 11.15.0 から、レジストリ以外のすべてのインストールソースに対して同じ明示的な許可リストアプローチを適用できるよう、さらに 3 つのフラグを追加します:
--allow-file: ローカルファイルパスおよびローカル tarball からのインストールを制御します。
--allow-remote: リモート URL(https tarball を含む)からのインストールを制御します。
--allow-directory: ローカルディレクトリからのインストールを制御します。
--allow-git (既存): github:, gitlab:, git+ URL、および簡略化された所有者/リポジトリ表記を含む、あらゆる Git ソースからのインストールを制御します。
各フラグは、すべて(現在のデフォルト)または none のいずれかを受け付け、.npmrc または package.json 設定でも設定可能です。
詳細については、以下のドキュメントをご覧ください:
npm install リファレンス (--allow-file, --allow-remote, --allow-git バリアントは同じページに記載されています)
設定リファレンス
2026 年 2 月の発表の復習として、--allow-git は CLI の次期メジャーバージョン (v12) でデフォルトが「すべて」から「none」に変更されます。新しい --allow-file, --allow-remote, および --allow-directory フラグは 11.15.0 で追加された機能です。より厳格な動作を今日から適用したい場合は、これらを none に設定してください。
議論に参加する
これらの変更の展開状況について、ぜひお聞かせください。フィードバックや質問は GitHub コミュニティのディスカッションで共有してください。
本記事「npm の段階的公開とインストール時の新しい制御機能」は、最初に The GitHub Blog で掲載されました。
原文を表示
Today we’re shipping two updates focused on supply-chain security for npm:
Staged publishing is generally available.
New --allow-* install source flags (--allow-file, --allow-remote, --allow-directory) complement the existing --allow-git flag.
Both are available in npm CLI 11.15.0 or newer.
Staged publishing is generally available
Staged publishing is now generally available on npm. Instead of a direct publish that immediately makes a package version available to consumers, the prebuilt tarball is uploaded to a stage queue where a maintainer must explicitly approve it before it becomes installable. The queue is visible both on npmjs.com and in the npm CLI.
Staged publishing reinforces proof of presence on every publish, including those that originate from non-interactive CI/CD workflows and those using trusted publishing with OIDC. A human maintainer with a 2FA challenge is required to approve a staged package before it is released to the registry.
Staged publishing is live today, and so are the docs.
Overview and getting started
CLI reference and permissions
Trusted publishers (updated)
Requirements
npm CLI 11.15.0 or newer is required to use npm stage.
Update CI/CD workflows to use npm stage publish instead of npm publish where you want staged behavior.
Recommended setup
We recommend pairing staged publishing with trusted publishing (OIDC). A trusted publishing configuration can be limited to stage-only, which means npm publish from that workflow will be rejected and only npm stage publish is accepted. Your CI workflows continue to run non-interactively, and a maintainer later approves the staged version from the website or the CLI.
You can also run npm stage publish locally, but the highest-value setup is CI publishing to the stage queue and a maintainer approving from a trusted device.
If you already manage trusted publishing configurations in bulk, released Feb 2026, you can use it to migrate your packages to staged publishing. Remember to update your CI workflows to the new CLI version and to use npm stage publish.
New install source flags
In npm 11.10.0 we introduced --allow-git to give you control over whether npm install can resolve dependencies from Git sources. Starting in npm 11.15.0, we are adding three more flags so you can apply the same explicit-allowlist approach to every nonregistry install source:
--allow-file: Controls installs from local file paths and local tarballs.
--allow-remote: Controls installs from remote URLs, including https tarballs.
--allow-directory: Controls installs from local directories.
--allow-git (existing): Controls installs from any Git source, including github:, gitlab:, git+ URLs, and bare owner/repo shorthands.
Each flag accepts all (the current default) or none, and can also be set in .npmrc or package.json config.
Learn more by checking out our docs:
npm install reference (the --allow-file, --allow-remote, --allow-git variants are on the same page)
Config reference
As a reminder from the Feb 2026 announcement, --allow-git will change its default from all to none in the next major version of the CLI (v12). The new --allow-file, --allow-remote, and --allow-directory flags are additions in 11.15.0—you can opt into stricter behavior today by setting them to none.
Join the discussion
We’d like to hear how you’re rolling this out. Share feedback and questions in the GitHub Community discussion.
The post Staged publishing and new install-time controls for npm appeared first on The GitHub Blog.
関連記事
今日のまとめ
AI日報で今日の重要ニュースをまとめ読み