設定 Microsoft 安全性 DevOps GitHub 動作
Microsoft Security DevOps 是命令列應用程式,可將靜態分析工具整合到開發生命週期中。 Security DevOps 會安裝、設定和執行最新版的靜態分析工具,例如 SDL、安全性和合規性工具。 Security DevOps 是由可攜式設定所驅動,可跨多個環境啟用決定性執行。
Microsoft Security DevOps 使用下列開放原始碼工具:
名稱 | 語言 | 授權 |
---|---|---|
反惡意程式碼軟體 | Windows 中的反惡意程式碼軟體保護會從適用於端點的 Microsoft Defender 掃描惡意程式碼,並在找到惡意程式碼時中斷組建。 此工具預設會在 Windows 最新代理程式上進行掃描。 | 不是開放原始碼 |
Bandit | Python | Apache License 2.0 |
BinSkim | Binary--Windows、ELF | MIT 授權 |
Checkov | Terraform、Terraform plan、CloudFormation、AWS SAM、Kubernetes、Helm chart、Kustomize、Dockerfile、Serverless、Bicep、OpenAPI、ARM | Apache License 2.0 |
ESlint | JavaScript | MIT 授權 |
範本分析器 | ARM 範本、Bicep | MIT 授權 |
Terrascan | Terraform (HCL2)、Kubernetes (JSON/YAML)、Helm v3、Kustomize、Dockerfiles、CloudFormation | Apache License 2.0 |
Trivy | 容器映像,基礎結構即程式碼 (IaC) | Apache License 2.0 |
必要條件
Azure 訂閱 如果您沒有 Azure 訂閱,請在開始前建立免費帳戶。
請遵循指導來設定 GitHub 進階安全性,以在適用於雲端的 Defender 中檢視 DevOps 狀態評量。
在新視窗中開啟 Microsoft Security DevOps GitHub 動作。
確定在 GitHub 存放庫上將 [工作流程] 權限設定為 [讀取和寫入]。 這包括在 GitHub 工作流程中設定「id-token:寫入」權限,以與適用於雲端的 Defender 同盟。
設定 Microsoft 安全性 DevOps GitHub 動作
若要設定 GitHub 動作:
登入 GitHub。
選取您要用來設定 GitHub 動作的存放庫。
選取動作。
選取 [新增工作流程]。
在 [開始使用 GitHub Actions] 頁面上,選取 [自行設定工作流程]
在文字方塊中,輸入工作流程檔案的名稱。 例如:
msdevopssec.yml
。將下列範例動作工作流程 複製並貼到 [編輯新檔案] 索引標籤中。
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 }}
注意
如需其他工具組態選項和指示,請參閱 Microsoft Security DevOps Wiki
選取 [開始認可]。
選取 [認可新檔案]。
該程序最多可能需要一分鐘才能完成。
選取 [動作],並確認新動作正在執行。
檢視掃描結果
若要檢視掃描結果:
登入 GitHub。
瀏覽至 [安全性]>[代碼掃描警示]>[工具]。
從下拉式功能表中,選取 [依工具篩選]。
程式碼掃描結果會依 GitHub 中的特定 MSDO 工具進行篩選。 這些程式碼掃描結果也會提取至適用於雲端的 Defender 建議。
深入了解
相關內容
深入了解適用於雲端的 Defender 中的 DevOps 安全性。
了解如何將 GitHub 組織連線至適用於雲端的 Defender。
意見反映
https://aka.ms/ContentUserFeedback。
即將推出:我們會在 2024 年淘汰 GitHub 問題,並以全新的意見反應系統取代並作為內容意見反應的渠道。 如需更多資訊,請參閱:提交及檢視以下的意見反映: