Skip to main content

Dependabot セキュリティの更新の構成

          Dependabot security updatesまたは手動のプル要求を使用して、脆弱な依存関係を簡単に更新できます。

この機能を使用できるユーザーについて

Users with write access

リポジトリの Dependabot security updates の管理

個人アカウントまたは組織が所有するすべての適格なリポジトリに対して、 Dependabot security updates を有効または無効にすることができます。 詳細については、「セキュリティと分析機能の管理」または「組織のセキュリティおよび分析設定を管理する」を参照してください。

個々のリポジトリの Dependabot security updates を有効または無効にすることもできます。

個々のリポジトリの Dependabot security updates の有効化または無効化

  1. GitHub で、リポジトリのメイン ページに移動します。

  2. リポジトリ名の下にある [Settings] をクリックします。 [設定] タブが表示されない場合は、 [] ドロップダウン メニューを選び、 [設定] をクリックします。

    タブを示すリポジトリ ヘッダーのスクリーンショット。 [設定] タブが濃いオレンジ色の枠線で強調表示されています。

  3. サイドバーの [Security] セクションで、[ Advanced Security] をクリックします。

  4. [セキュリティ更新プログラムのDependabot ] の右側にある [ 有効] をクリックして機能を有効にするか 、[無効] をクリックして無効にします。 パブリック リポジトリの場合、この機能が常に有効になっている場合、ボタンは無効になります。

          Dependabot security updatesを 1 つのプル要求にグループ化する

グループ化されたセキュリティ更新プログラムを使用するには、まず次の機能を有効にする必要があります。

  •         **依存関係グラフ**。 詳しくは、「[AUTOTITLE](/code-security/supply-chain-security/understanding-your-software-supply-chain/configuring-the-dependency-graph)」をご覧ください。
    
  •         **
            Dependabot alerts
            **. 詳しくは、「[AUTOTITLE](/code-security/dependabot/dependabot-alerts/configuring-dependabot-alerts)」をご覧ください。
    
  •         **
            Dependabot security updates
            **. 詳しくは、「[AUTOTITLE](/code-security/dependabot/dependabot-security-updates/configuring-dependabot-security-updates)」をご覧ください。
    

メモ

グループ化されたセキュリティ更新プログラムが最初に有効になると、 Dependabot はすぐにグループ化されたプル要求の作成を試みます。 古い pull request を閉じて新しい pull request を開く Dependabot に気付く場合があります。

Dependabot security updates のグループ化された pull request は、以下の方法のいずれかまたは両方で有効にすることができます。

  • 使用できるセキュリティ更新プログラムをディレクトリ間やエコシステムごとにできるだけ多くグループ化するには、リポジトリ、または organization の [Advanced Security] の [Global settings] の [Advanced Security] 設定でグループ化を有効にします。
  • パッケージ名、開発と運用の依存関係、SemVer レベル、複数のディレクトリにわたるエコシステムごとによるグループ化など、グループ化をより細かく制御するには、リポジトリの dependabot.yml 構成ファイルに構成オプションを追加します。

メモ

dependabot.yml ファイル内で Dependabot security updates のグループルールを構成した場合、使用できるすべての更新は、指定したルールに従ってグループ化されます。 Dependabot は、Organization またはリポジトリ レベルでグループ化されたセキュリティ アップデートの設定も有効になっている場合、dependabot.yml で構成されていないディレクトリ間でのみグループ化されます。

個々のリポジトリのグループ化された Dependabot security updates の有効化または無効化

  1. GitHub で、リポジトリのメイン ページに移動します。

  2. リポジトリ名の下にある [Settings] をクリックします。 [設定] タブが表示されない場合は、 [] ドロップダウン メニューを選び、 [設定] をクリックします。

    タブを示すリポジトリ ヘッダーのスクリーンショット。 [設定] タブが濃いオレンジ色の枠線で強調表示されています。

  3. サイドバーの [Security] セクションで、[ Advanced Security] をクリックします。

  4. [グループ化されたセキュリティ更新プログラム] の右側にある [Dependabot] で、[ 有効] をクリックして機能を有効にするか 、[無効にする] をクリックして無効にします。

組織のグループ化された Dependabot security updates を有効または無効にする

           グループ化された Dependabot security updates を 1 つのプル要求に有効にすることができます。 詳しくは、「[AUTOTITLE](/code-security/securing-your-organization/enabling-security-features-in-your-organization/configuring-global-security-settings-for-your-organization#grouping-dependabot-security-updates)」をご覧ください。

構成ファイルを使用した既定の動作のオーバーライド

          Dependabot security updates ファイルをリポジトリに追加することで、`dependabot.yml`の既定の動作をオーバーライドできます。 
          `dependabot.yml` ファイルを使用すると、グループ化をより細かく制御し、Dependabot security updates設定の既定の動作をオーバーライドできます。

          `groups` オプションを`applies-to: security-updates` キーと共に使用して依存関係のセット (パッケージ マネージャーごと) を作成し、Dependabot複数の依存関係を同時に更新する 1 つのプル要求を開きます。 パッケージ名 (`patterns` や `exclude-patterns` キー)、依存関係の種類 (`dependency-type` キー)、SemVer (`update-types` キー) でグループを定義できます。

Dependabot は、dependabot.yml ファイルに表示される順序でグループを作成します。 依存関係の更新が複数のグループに属している可能性がある場合、一致する最初のグループにのみ割り当てられます。

          _セキュリティ_更新プログラムのみを必要とし、_バージョン_更新プログラムを除外する場合は、特定の `open-pull-requests-limit` のバージョン更新プログラムを防ぐために `0` を `package-ecosystem` に設定できます。

セキュリティ更新プログラムで使用可能な構成オプションについて詳しくは、「Dependabot セキュリティ更新プログラム用に pull request をカスタマイズする」をご覧ください。

YAML
# Example configuration file that:
#  - Has a private registry
#  - Ignores lodash dependency
#  - Disables version-updates
#  - Defines a group by package name, for security updates for golang dependencies

version: 2
registries:
  example:
    type: npm-registry
    url: https://example.com
    token: ${{secrets.NPM_TOKEN}}
updates:
  - package-ecosystem: "npm"
    directory: "/src/npm-project"
    schedule:
      interval: "daily"
    # For Lodash, ignore all updates
    ignore:
      - dependency-name: "lodash"
    # Disable version updates for npm dependencies
    open-pull-requests-limit: 0
    registries:
      - example
  - package-ecosystem: "gomod"
    directories:
      - "**/*"
    schedule:
      interval: "weekly"
    open-pull-requests-limit: 0
    groups:
      golang:
        applies-to: security-updates
        patterns:
          - "golang.org*"

メモ

          Dependabotセキュリティ更新プログラムにこの構成を使用するには、`directory`がマニフェスト ファイルへのパスである必要があります (または、マニフェスト ファイルの場所に一致するパスまたは glob パターンを含める必要`directories`)。また、`target-branch`を指定しないでください。

詳細については、次を参照してください。

  •         [AUTOTITLE](/code-security/dependabot/dependabot-alerts/about-dependabot-alerts)
    
  •         [AUTOTITLE](/code-security/dependabot/dependabot-alerts/configuring-dependabot-alerts)
    
  •         [AUTOTITLE](/code-security/supply-chain-security/understanding-your-software-supply-chain/dependency-graph-supported-package-ecosystems#supported-package-ecosystems)