Share via


Microsoft Security DevOps GitHub アクションを構成する

Microsoft Security DevOps は、静的分析ツールを開発ライフサイクルに統合するコマンド ライン アプリケーションです。 Security DevOps は、SDL、セキュリティ、コンプライアンス ツールなどの静的分析ツールの最新バージョンをインストール、構成、実行します。 Security DevOps はデータドリブンであり、複数の環境で決定性の実行を可能にする移植可能な構成を備えています。

Microsoft Security DevOps では、次のオープンソース ツールが使われます。

名前 Language ライセンス
マルウェア対策 Microsoft Defender for Endpoint による Windows のマルウェア対策保護。マルウェアをスキャンし、マルウェアが検出された場合はビルドを中断します。 このツールは、既定では Windows 最新エージェントでスキャンします。 オープンソースではない
Bandit Python Apache License 2.0
BinSkim バイナリ -- Windows、ELF MIT ライセンス
Checkov Terraform、Terraform プラン、CloudFormation、AWS SAM、Kubernetes、Helm チャート、Kustomize、Dockerfile、サーバーレス、Bicep、OpenAPI、ARM Apache License 2.0
ESlint JavaScript MIT ライセンス
Template Analyzer ARM テンプレート、Bicep MIT ライセンス
Terrascan Terraform (HCL2)、Kubernetes (JSON/YAML)、Helm v3、Kustomize、Dockerfiles、CloudFormation Apache License 2.0
Trivy コンテナー イメージ、コードとしてのインフラストラクチャ (IaC) Apache License 2.0

前提条件

Microsoft Security DevOps GitHub アクションを構成する

GitHub アクションを設定するには:

  1. GitHub にサインインします。

  2. GitHub アクションを構成するリポジトリを選びます。

  3. [Actions](アクション) を選択します。

    [Actions] (アクション) ボタンの場所を示すスクリーンショット。

  4. [New workflow](新しいワークフロー) を選択します。

  5. [Get started with GitHub Actions] (GitHub Actions の作業開始) ページで、[set up a workflow yourself] (自分でワークフローを設定する) を選びます

    [New workflow] (新しいワークフロー) ボタンを選ぶ場所を示すスクリーンショット。

  6. テキスト ボックスに、ワークフロー ファイルの名前を入力します。 たとえば、「 msdevopssec.yml 」のように入力します。

    新しいワークフローの名前を入力する場所を示すスクリーンショット。

  7. 次のサンプル アクション ワークフローをコピーして、[Edit new file] (新しいファイルの編集) タブに貼り付けます。

    name: MSDO
    on:
      push:
        branches:
          - master
    
    jobs:
      sample:
        name: Microsoft Security DevOps
    
        # MSDO runs on windows-latest.
        # ubuntu-latest also supported
        runs-on: windows-latest
    
        permissions:
          contents: read
          id-token: write
          actions: read
          security-events: write
    
        steps:
    
          # Checkout your code repository to scan
        - uses: actions/checkout@v3
    
          # Run analyzers
        - name: Run Microsoft Security DevOps Analysis
          uses: microsoft/security-devops-action@latest
          id: msdo
        # with:
          # config: string. Optional. A file path to an MSDO configuration file ('*.gdnconfig').
          # policy: 'GitHub' | 'microsoft' | 'none'. Optional. The name of a well-known Microsoft policy. If no configuration file or list of tools is provided, the policy may instruct MSDO which tools to run. Default: GitHub.
          # categories: string. Optional. A comma-separated list of analyzer categories to run. Values: 'code', 'artifacts', 'IaC', 'containers'. Example: 'IaC, containers'. Defaults to all.
          # languages: string. Optional. A comma-separated list of languages to analyze. Example: 'javascript,typescript'. Defaults to all.
          # tools: string. Optional. A comma-separated list of analyzer tools to run. Values: 'bandit', 'binskim', 'checkov', 'eslint', 'templateanalyzer', 'terrascan', 'trivy'.
    
          # Upload alerts to the Security tab
        - name: Upload alerts to Security tab
          uses: github/codeql-action/upload-sarif@v2
          with:
            sarif_file: ${{ steps.msdo.outputs.sarifFile }}
    
          # Upload alerts file as a workflow artifact
        - name: Upload alerts file as a workflow artifact
          uses: actions/upload-artifact@v3
          with:  
            name: alerts
            path: ${{ steps.msdo.outputs.sarifFile }}
    

    Note

    その他のツールの構成オプションと手順については、Microsoft Security DevOps Wiki を参照してください

  8. [Start commit] (コミットの開始) を選びます

    コミットの開始を選ぶ場所を示すスクリーンショット。

  9. [Commit new file](新しいファイルのコミット) を選択します。

    新しいファイルをコミットする方法を示すスクリーンショット。

    プロセスが完了するまでに最大 1 分かかる場合があります。

  10. [Actions] (アクション) を選んで、新しいアクションが実行されていることを確認します。

    新しいアクションが実行されていることを確認するために移動する場所を示すスクリーンショット。

スキャンの結果を表示する

スキャンの結果を表示するには:

  1. GitHub にサインインします。

  2. [Security] (セキュリティ)>[Code scanning alerts] (コード スキャン アラート)>[Tool] (ツール) に移動します。

  3. ドロップダウン メニューの [Filter by tool] (ツールでフィルター) を選びます。

コード スキャンの結果が、GitHub の特定の MSDO ツールによってフィルター処理されます。 これらのコード スキャン結果は、Defender for Cloud の推奨事項にも取り込まれます。

詳細情報

Defender for Cloud での DevOps セキュリティの詳細を確認する。

GitHub 組織 を Defender for Cloud に接続する方法について説明します。