Upgrade to Pro — share decks privately, control downloads, hide ads and more …

やさしいとこから始めるGitHubリポジトリのセキュリティ

 やさしいとこから始めるGitHubリポジトリのセキュリティ

Azure DevOpsオンライン Vol.14 ~ DevSecOps
https://tfsug.connpass.com/event/385605/

Avatar for Yuta Matsumura

Yuta Matsumura

March 27, 2026
Tweet

More Decks by Yuta Matsumura

Other Decks in Technology

Transcript

  1. 松村 優大 (MLBお兄さん) © 2026 Yuta Matsumura. #tfsug 株式会社オルターブース (Chief

    Technical Architect) Microsoft MVP for Developer Technologies Microsoft Top Partner Engineer Award 2025 GitHub 公認トレーナー C#, PHP, Azure, GitHub #fukuten #devblogradio #fukuoka_mcp https://linktr.ee/tsubakimoto 2
  2. © 2026 Yuta Matsumura. #jazug 4 4/17 Global Azure @福岡を

    開催します! 登壇者・参加者を募集中です! https://jazug.connpass.com/event/384711/
  3. © 2026 Yuta Matsumura. #tfsug 7 GitHub Code Security コードの脆弱性を検出し、

    修正を支援する機能群 GitHub Secret Protection 機密情報の保護に 特化した機能群
  4. GitHub Code Security 機能名 用途 Code scanning コードの脆弱性とコーディングエラーをスキャンして検出 CodeQL CLI

    CodeQL を使用した高度な静的解析 Copilot Autofix Copilot がセキュリティ問題を自動修正 Security campaigns セキュリティ対策を組織全体で展開 Custom auto-triage rules for Dependabot Dependabot アラートを自動的に無視、スヌーズ、更新 対象に振り分け Dependency review 依存関係の変更をレビュー Security Overview セキュリティ状況の全体を可視化 © 2026 Yuta Matsumura. #tfsug 8
  5. CodeQL と Copilot Autofix • CodeQL • Code scanning に使用できるコード分析エンジン

    • セキュリティ上の脆弱なコードを検出する • Copilot Autofix • Code scanning で検出された脆弱なコードを GitHub Copilot で修正する © 2026 Yuta Matsumura. #tfsug 10
  6. GitHub Secret Protection 機能名 用途 Secret scanning キーやトークンなどのシークレットをリポジトリから検出 Push protection

    シークレットのプッシュをブロック Copilot secret scanning Copilot でパスワードなどのシークレットを検出 Custom patterns カスタムシークレットパターンの定義 Delegated bypass for push protection プッシュ保護のバイパス時に承認プロセスを実装 Delegated alert dismissal アラート解除時に承認プロセスを実装 Security campaigns セキュリティ対策を組織全体で展開 Security overview セキュリティ状況の全体を可視化 © 2026 Yuta Matsumura. #tfsug 13
  7. Secret scanning • API キー等のシークレットがリポジトリに混入したことを検知する機能 • スキャンする範囲 • リポジトリ:全ブランチの Git

    履歴 • Issue:タイトル、本文、コメント • Pull Request:タイトル、本文、コメント • Discussion:タイトル、本文、コメント • Wiki • Gist (secret) © 2026 Yuta Matsumura. #tfsug 15
  8. Push protection • シークレットが混在した Git コミット履歴のプッシュを防ぐ機能 • あえてプッシュを許可することも可能 Private/Internal リポジトリで

    Secret scanning や Push protection 等を 利用するには GitHub Advanced Security ($19/月) のライセンスが必要 © 2026 Yuta Matsumura. #tfsug 16
  9. dependabot.yml 設定項目 説明 Dependabot alerts 依存関係に影響を与えるリポジトリ内の脆弱性に関するアラートを有効化し ます。 Dependabot security updates

    リポジトリ内の脆弱なパッケージを更新するプルリクエストを自動で作成する 機能を有効化します。 Grouped security updates Dependabot が作成する依存関係のプルリクエストを、パッケージマネー ジャーごとにグルーピングする機能を有効化します。 Dependabot version updates 脆弱性の有無に限らず、依存関係のバージョンアップデートを自動でチェック し、プルリクエストを作成する機能を有効化します。 Dependabot malware alerts 依存関係にマルウェアが検出された際のアラートを有効化します。 © 2026 Yuta Matsumura. #tfsug 22
  10. アクションをコミット SHA でピン留めする • ワークフローではアクションのバージョンを指定する uses: actions/checkout@v6 • v6 というようなタグ指定からコミット

    SHA 指定に変えることで、 リポジトリに不正アクションを追加するリスクを軽減できる uses: actions/checkout@8e8c483... • GitHub Copilot + GitHub MCP Server で効率的に変換 © 2026 Yuta Matsumura. #tfsug 33 https://github.blog/changelog/2025-08-15-github-actions-policy-now-supports-blocking-and-sha-pinning-actions/
  11. SHA ピン留め違反のワークフロー © 2026 Yuta Matsumura. #tfsug 36 jobs: build:

    runs-on: ubuntu-latest steps: - uses: actions/checkout@v4
  12. OpenID Connect でクラウドに接続する • GitHub Actions でクラウド環境にデプロイする場合、GitHub から クラウドへの接続方式に OpenID

    Connect (OIDC) を使用する • パスワードや Personal Access Token を使用しない © 2026 Yuta Matsumura. #tfsug 37 https://docs.github.com/en/actions/concepts/security/openid-connect
  13. 例:Azure にデプロイする 1. Azureでの設定 1. Microsoft Entra ID に Actions

    用アプリを 登録する 2. フェデレーション資格情報を登録する 2. GitHub: Environment を登録する 3. ワークフロー 1. パーミッションの設定 (id-token: write) 2. azure/login アクションで Azure に接続 © 2026 Yuta Matsumura. #tfsug 38 https://docs.github.com/en/actions/how-tos/secure-your-work/security- harden-deployments/oidc-in-azure