<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title>Gitleaks on Tarragon</title><link>https://tarrragon.github.io/blog/tags/gitleaks/</link><description>Recent content in Gitleaks on Tarragon</description><generator>Hugo -- gohugo.io</generator><language>zh-TW</language><copyright>Tarragon (CC BY 4.0)</copyright><lastBuildDate>Mon, 18 May 2026 00:00:00 +0000</lastBuildDate><atom:link href="https://tarrragon.github.io/blog/tags/gitleaks/index.xml" rel="self" type="application/rss+xml"/><item><title>Gitleaks</title><link>https://tarrragon.github.io/blog/backend/07-security-data-protection/vendors/gitleaks/</link><pubDate>Mon, 18 May 2026 00:00:00 +0000</pubDate><guid>https://tarrragon.github.io/blog/backend/07-security-data-protection/vendors/gitleaks/</guid><description>&lt;p>Gitleaks 是 &lt;em>純 CLI 的 OSS secret scanner&lt;/em>、MIT License、Go 寫、單一 binary 跑遍 macOS / Linux / Windows。它只做一件事 — 對 git history、working tree 或 staged changes 跑 regex + entropy + path filter 找 secret、輸出 JSON / SARIF / CSV 給下游消化。它沒有 dashboard、沒有 SaaS、沒有 cross-platform scan、也沒有 incident workflow — 這些刻意拿掉的東西是它跟 &lt;a href="https://tarrragon.github.io/blog/backend/07-security-data-protection/vendors/gitguardian/" data-link-title="GitGuardian" data-link-desc="Secret scanning &amp;#43; remediation SaaS、350&amp;#43; Detector &amp;#43; Validation endpoint、跨 SCM &amp;#43; SaaS（Slack / Notion）、Honeytokens decoy">GitGuardian&lt;/a> / &lt;a href="https://tarrragon.github.io/blog/backend/07-security-data-protection/vendors/github-advanced-security/" data-link-title="GitHub Advanced Security" data-link-desc="GitHub 內建 4 大模組：Code Scanning (CodeQL) &amp;#43; Secret Scanning &amp;#43; Dependency Review &amp;#43; Dependabot、跟 PR / Security tab 深度整合">GHAS Secret Scanning&lt;/a> 的核心分界。&lt;/p>
&lt;h2 id="服務定位">服務定位&lt;/h2>
&lt;p>Gitleaks 的核心定位是 &lt;em>git-aware secret scan 的 CLI 原語&lt;/em>、不是 secret 治理平台。Rule 寫在 &lt;code>.gitleaks.toml&lt;/code>、輸出走標準格式（SARIF / JSON / CSV）、跟下游 pipeline（CI、SIEM、GHAS Code Scanning）解耦。&lt;/p>
&lt;p>跟 &lt;a href="https://tarrragon.github.io/blog/backend/07-security-data-protection/vendors/gitguardian/" data-link-title="GitGuardian" data-link-desc="Secret scanning &amp;#43; remediation SaaS、350&amp;#43; Detector &amp;#43; Validation endpoint、跨 SCM &amp;#43; SaaS（Slack / Notion）、Honeytokens decoy">GitGuardian&lt;/a> 比、GitGuardian 是 SaaS + dashboard + remediation workflow + validation endpoint（呼叫真實 API 驗證 secret 是否有效降 FP）+ honeytoken decoy、Gitleaks 沒有任一項 — 它只回答「這個 string 看起來像不像 secret」。GitGuardian 適合大型組織 + 預算允許 + 要跨 Slack / Jira / Notion 等 SaaS scan；Gitleaks 適合預算敏感 + 只需要 git scope + 內部已有 CI / SIEM 接 SARIF 的場景。&lt;/p>
&lt;p>跟 &lt;a href="https://tarrragon.github.io/blog/backend/07-security-data-protection/vendors/github-advanced-security/" data-link-title="GitHub Advanced Security" data-link-desc="GitHub 內建 4 大模組：Code Scanning (CodeQL) &amp;#43; Secret Scanning &amp;#43; Dependency Review &amp;#43; Dependabot、跟 PR / Security tab 深度整合">GHAS Secret Scanning&lt;/a> 比、GHAS 限 GitHub 平台、提供 push protection（partner pattern 在 push 前直接擋）跟 partner 自動 revoke 等深度整合、但只覆蓋 GitHub repo；Gitleaks 跨 GitHub / GitLab / Bitbucket / 自架 Gitea、CLI 跑哪都行、缺點是沒有 partner revoke 跟 push protection 要自己用 hook 接。&lt;/p></description><content:encoded><![CDATA[<p>Gitleaks 是 <em>純 CLI 的 OSS secret scanner</em>、MIT License、Go 寫、單一 binary 跑遍 macOS / Linux / Windows。它只做一件事 — 對 git history、working tree 或 staged changes 跑 regex + entropy + path filter 找 secret、輸出 JSON / SARIF / CSV 給下游消化。它沒有 dashboard、沒有 SaaS、沒有 cross-platform scan、也沒有 incident workflow — 這些刻意拿掉的東西是它跟 <a href="/blog/backend/07-security-data-protection/vendors/gitguardian/" data-link-title="GitGuardian" data-link-desc="Secret scanning &#43; remediation SaaS、350&#43; Detector &#43; Validation endpoint、跨 SCM &#43; SaaS（Slack / Notion）、Honeytokens decoy">GitGuardian</a> / <a href="/blog/backend/07-security-data-protection/vendors/github-advanced-security/" data-link-title="GitHub Advanced Security" data-link-desc="GitHub 內建 4 大模組：Code Scanning (CodeQL) &#43; Secret Scanning &#43; Dependency Review &#43; Dependabot、跟 PR / Security tab 深度整合">GHAS Secret Scanning</a> 的核心分界。</p>
<h2 id="服務定位">服務定位</h2>
<p>Gitleaks 的核心定位是 <em>git-aware secret scan 的 CLI 原語</em>、不是 secret 治理平台。Rule 寫在 <code>.gitleaks.toml</code>、輸出走標準格式（SARIF / JSON / CSV）、跟下游 pipeline（CI、SIEM、GHAS Code Scanning）解耦。</p>
<p>跟 <a href="/blog/backend/07-security-data-protection/vendors/gitguardian/" data-link-title="GitGuardian" data-link-desc="Secret scanning &#43; remediation SaaS、350&#43; Detector &#43; Validation endpoint、跨 SCM &#43; SaaS（Slack / Notion）、Honeytokens decoy">GitGuardian</a> 比、GitGuardian 是 SaaS + dashboard + remediation workflow + validation endpoint（呼叫真實 API 驗證 secret 是否有效降 FP）+ honeytoken decoy、Gitleaks 沒有任一項 — 它只回答「這個 string 看起來像不像 secret」。GitGuardian 適合大型組織 + 預算允許 + 要跨 Slack / Jira / Notion 等 SaaS scan；Gitleaks 適合預算敏感 + 只需要 git scope + 內部已有 CI / SIEM 接 SARIF 的場景。</p>
<p>跟 <a href="/blog/backend/07-security-data-protection/vendors/github-advanced-security/" data-link-title="GitHub Advanced Security" data-link-desc="GitHub 內建 4 大模組：Code Scanning (CodeQL) &#43; Secret Scanning &#43; Dependency Review &#43; Dependabot、跟 PR / Security tab 深度整合">GHAS Secret Scanning</a> 比、GHAS 限 GitHub 平台、提供 push protection（partner pattern 在 push 前直接擋）跟 partner 自動 revoke 等深度整合、但只覆蓋 GitHub repo；Gitleaks 跨 GitHub / GitLab / Bitbucket / 自架 Gitea、CLI 跑哪都行、缺點是沒有 partner revoke 跟 push protection 要自己用 hook 接。</p>
<p>跟 TruffleHog OSS 比、兩者都是 OSS CLI secret scanner、TruffleHog 強在 <em>verifier</em>（對 200+ secret type 呼叫對應 API 驗證真偽）、Gitleaks 強在 <em>rule TOML 表達力跟 SARIF output 成熟度</em>。實務上很多組織兩個一起跑、用不同的 rule 覆蓋面互補。</p>
<p>關鍵張力：<em>Allowlist 治理</em> ↔ <em>FP 噪音</em> 是 Gitleaks 客戶最大的長期問題。OSS 沒有 validation endpoint、entropy + path filter 一定會誤判 test fixture / mock token / sample config、allowlist 不持續 review 會膨脹成「全部都白名單」最後 rule 失效。</p>
<h2 id="本章目標">本章目標</h2>
<p>讀完本頁、讀者能判斷：</p>
<ol>
<li>Gitleaks 在 secret scan stack 中承擔哪一段（pre-commit / CI scan / historical audit）、哪些要外接（<a href="/blog/backend/07-security-data-protection/vendors/hashicorp-vault/" data-link-title="HashiCorp Vault" data-link-desc="Self-hosted secret management 與 dynamic credential / encryption-as-a-service / PKI engine、跨雲跨環境的 secret 控制面">Vault</a> rotate、<a href="/blog/backend/07-security-data-protection/vendors/github-advanced-security/" data-link-title="GitHub Advanced Security" data-link-desc="GitHub 內建 4 大模組：Code Scanning (CodeQL) &#43; Secret Scanning &#43; Dependency Review &#43; Dependabot、跟 PR / Security tab 深度整合">GHAS Code Scanning</a> 收 SARIF dashboard）</li>
<li>Custom rule 跟 allowlist 的 ownership 設計（誰寫 rule、誰核准 allowlist、定期 review 週期）</li>
<li><code>detect</code> vs <code>protect</code> 兩個子命令的職責切分、跟 pre-commit framework / CI 整合的位置</li>
<li>何時用 Gitleaks、何時升級到 <a href="/blog/backend/07-security-data-protection/vendors/gitguardian/" data-link-title="GitGuardian" data-link-desc="Secret scanning &#43; remediation SaaS、350&#43; Detector &#43; Validation endpoint、跨 SCM &#43; SaaS（Slack / Notion）、Honeytokens decoy">GitGuardian</a> / <a href="/blog/backend/07-security-data-protection/vendors/github-advanced-security/" data-link-title="GitHub Advanced Security" data-link-desc="GitHub 內建 4 大模組：Code Scanning (CodeQL) &#43; Secret Scanning &#43; Dependency Review &#43; Dependabot、跟 PR / Security tab 深度整合">GHAS Secret Scanning</a> 的取捨</li>
</ol>
<h2 id="最短判讀路徑">最短判讀路徑</h2>
<p>判斷 Gitleaks 部署是否健康、最少看四件事：</p>
<ul>
<li><strong>誰能改 <code>.gitleaks.toml</code></strong>：rule 跟 allowlist 是否走 Git PR review、commit message 是否帶 allowlist 原因、是否有 owner 簽核</li>
<li><strong><code>detect</code> vs <code>protect</code> 是否都接</strong>：CI 跑 <code>gitleaks detect</code>（掃 history + working tree）、pre-commit hook 跑 <code>gitleaks protect</code>（只掃 staged changes）— 缺 protect 等於 leak 進 history 才知道、缺 detect 等於既有 leak 永遠不發現</li>
<li><strong>SARIF 是否上傳 dashboard</strong>：CI output 是否 upload 到 <a href="/blog/backend/07-security-data-protection/vendors/github-advanced-security/" data-link-title="GitHub Advanced Security" data-link-desc="GitHub 內建 4 大模組：Code Scanning (CodeQL) &#43; Secret Scanning &#43; Dependency Review &#43; Dependabot、跟 PR / Security tab 深度整合">GHAS Code Scanning</a> 或內部 SIEM、不然 finding 散在 CI log 沒人看</li>
<li><strong>Allowlist 是否定期 review</strong>：allowlist entry 是否帶 expire date / reason / owner、每季是否 revisit 把過期項目刪掉、不然 allowlist 會膨脹到掩蓋真實 leak</li>
</ul>
<p>四件事任一缺失、就是 <a href="/blog/backend/07-security-data-protection/detection-coverage-and-signal-governance/" data-link-title="7.13 偵測覆蓋率與訊號治理" data-link-desc="定義偵測覆蓋、訊號品質與誤報成本的治理問題">Detection Coverage and Signal Governance</a> 邊界的待補項目。</p>
<h2 id="日常操作與決策形狀">日常操作與決策形狀</h2>
<p><strong>Rule TOML / JSON</strong>：rule 結構是 <code>id</code> + <code>regex pattern</code> + 可選 <code>entropy threshold</code>（高熵字串通常是 secret、避開 lorem ipsum FP）+ 可選 <code>path filter</code>（限定 / 排除路徑）。預設 rule library 涵蓋 AWS / GCP / Azure / Stripe / Slack token 等 100+ pattern；organization 通常 <em>先 import 預設、再加自家 token format custom rule</em>。Custom rule 必須給 valid + invalid sample 跑 unit test、不然 regex 寫錯會大量 FP。</p>
<p><strong><code>gitleaks detect</code>（historical scan）</strong>：掃整個 git history + working tree、CI 跑、適合 <em>發現既有 leak</em>。預設掃 HEAD 到根、可用 <code>--log-opts</code> 限定 commit range 加速。實務上 PR scan 限定 <code>--log-opts=&quot;--since=...$(git merge-base origin/main HEAD)&quot;</code> 只看本 PR 新增 commit、避免每次跑整個 history 慢死。</p>
<p><strong><code>gitleaks protect</code>（pre-commit）</strong>：只掃 staged changes、pre-commit hook 跑、適合 <em>攔住未來 leak</em>。它不掃 history、意義是 <em>commit 前的最後一道閘</em>；配合 pre-commit framework（<code>pre-commit-hooks</code> 或 <a href="https://pre-commit.com/">pre-commit.com</a>）的 <code>repos: gitleaks</code> 配置直接接入。</p>
<p><strong>Report 格式（JSON / SARIF / CSV）</strong>：JSON 是 raw 結構、適合 script 處理；SARIF 是 OASIS 標準、跟 GHAS Code Scanning / 商業 SAST dashboard 共用；CSV 適合人讀 / Excel 二次處理。Production 通常 <em>CI 輸出 SARIF + 上傳 GHAS Code Scanning</em>、把 OSS scanner 的 finding 跟商業 SAST 同 dashboard、SOC 不用切多工具。</p>
<p><strong>跟 CI 整合</strong>：GitHub Actions 用 <code>gitleaks/gitleaks-action</code>、GitLab CI 用 official Docker image、Jenkins 用 binary download + shell step。CI 失敗策略要決定 — <em>block PR</em> 還是 <em>warn only</em>：嚴格組織 block PR、寬鬆組織 warn + 上 SARIF 讓 SOC 自行 triage、避免初期高 FP 阻塞所有 merge。</p>
<p><strong>跟 pre-commit framework 整合</strong>：<code>.pre-commit-config.yaml</code> 加 <code>- repo: https://github.com/gitleaks/gitleaks</code> 條目、<code>pre-commit install</code> 後每次 commit 自動跑。注意 <em>pre-commit 只在開發者 machine 跑</em>、繞過很簡單（<code>git commit --no-verify</code>）、所以一定要配 CI scan 兜底、不能只信 pre-commit。</p>
<p><strong>Allowlist 治理</strong>：<code>.gitleaks.toml</code> 裡 <code>[allowlist]</code> section 寫 <code>paths</code> / <code>regexes</code> / <code>commits</code> / <code>stopwords</code>。每個 entry 應該帶 reason（<code># allowlist reason: test fixture for OAuth flow, expire 2026-Q4</code>）、PR review 時要問「為什麼這個是 FP、什麼時候會過期」。Quarterly 跑 audit 把過期項目刪掉、避免 allowlist 變成「全部都白名單」。</p>
<h2 id="核心取捨表">核心取捨表</h2>
<table>
  <thead>
      <tr>
          <th>取捨維度</th>
          <th>Gitleaks</th>
          <th>GitGuardian</th>
          <th>GHAS Secret Scanning</th>
          <th>TruffleHog OSS</th>
      </tr>
  </thead>
  <tbody>
      <tr>
          <td>License</td>
          <td>MIT OSS</td>
          <td>Proprietary SaaS（free tier 限個人）</td>
          <td>GitHub Enterprise add-on</td>
          <td>AGPL OSS（Enterprise 商業）</td>
      </tr>
      <tr>
          <td>Scope</td>
          <td>Git only（history + tree + staged）</td>
          <td>Git + Slack + Jira + Notion + 自訂 source</td>
          <td>GitHub repo only</td>
          <td>Git + S3 + filesystem + more</td>
      </tr>
      <tr>
          <td>Dashboard</td>
          <td>無、輸出 SARIF / JSON 自己接</td>
          <td>內建 incident workflow + remediation</td>
          <td>GitHub Security tab</td>
          <td>無（CLI / API）</td>
      </tr>
      <tr>
          <td>Validation</td>
          <td>無（只看 regex + entropy）</td>
          <td>有（呼叫 API 驗證真偽）</td>
          <td>Partner pattern 自動 revoke</td>
          <td>有（200+ verifier）</td>
      </tr>
      <tr>
          <td>Push protection</td>
          <td>無、要自己 wire pre-commit</td>
          <td>有（透過 ggshield）</td>
          <td>有（partner pattern、push 前擋）</td>
          <td>無</td>
      </tr>
      <tr>
          <td>部署模型</td>
          <td>CLI binary、跑哪都行</td>
          <td>SaaS only</td>
          <td>GitHub SaaS / Enterprise Server</td>
          <td>CLI binary</td>
      </tr>
      <tr>
          <td>計費</td>
          <td>免費</td>
          <td>Per-developer / per-repo</td>
          <td>Per-committer</td>
          <td>免費（OSS） / 商業另計</td>
      </tr>
      <tr>
          <td>適合場景</td>
          <td>OSS-friendly、預算敏感、CI / SARIF 已有</td>
          <td>跨 SaaS scan + remediation workflow</td>
          <td>GitHub-only + push protection 為主</td>
          <td>多 source + verifier 為主</td>
      </tr>
      <tr>
          <td>退場成本</td>
          <td>低 — rule TOML 可移植到 GitGuardian</td>
          <td>高 — incident history / workflow 綁定</td>
          <td>中 — SARIF 可移植但 push protection 限 GHAS</td>
          <td>低</td>
      </tr>
  </tbody>
</table>
<p>選 Gitleaks 的核心訴求：<em>OSS + 預算敏感 + 只需要 git scope + 內部 CI / SIEM 已能消化 SARIF</em>、且願意自己投入 rule / allowlist 治理。要跨 SaaS scan + incident workflow 升 GitGuardian、要 push protection + partner revoke 走 GHAS Secret Scanning。</p>
<h2 id="進階主題">進階主題</h2>
<p><strong>Custom rule 寫法（regex + entropy + path）</strong>：自家 internal token 通常有特定 prefix（<code>xy_live_</code> / <code>int_token_</code>）、寫 custom rule 就是 <code>regex = '''xy_live_[A-Za-z0-9]{32}'''</code> + <code>entropy = 4.0</code> + <code>path = '''.*\.go$'''</code>。Entropy threshold 越高 FP 越少但 FN 越多、實務值 3.5–4.5 之間 tune。每個 rule 一定要在 repo 加 unit test fixture（valid + invalid sample）、CI 跑 rule 自我驗證、避免 regex 寫錯後 silent break。</p>
<p><strong>跟 SARIF + GHAS Code Scanning 整合補位</strong>：Gitleaks CI 跑完輸出 SARIF、用 <code>github/codeql-action/upload-sarif</code> 上傳到 GHAS Code Scanning。GHAS Code Scanning 不限 CodeQL 來源、任何 SARIF tool 都收。意義是 <em>OSS scanner + GHAS dashboard</em> 是預算友善組合 — 不買 GHAS Secret Scanning license、但 finding 集中在 Security tab 跟 SAST 共看。對應 <a href="/blog/backend/07-security-data-protection/vendors/github-advanced-security/" data-link-title="GitHub Advanced Security" data-link-desc="GitHub 內建 4 大模組：Code Scanning (CodeQL) &#43; Secret Scanning &#43; Dependency Review &#43; Dependabot、跟 PR / Security tab 深度整合">GHAS Advanced Security</a> 的 Code Scanning section。</p>
<p><strong>跟 Vault 自動 rotation pipeline</strong>：Gitleaks 找到 leak 不是終點、是 <em>rotation trigger</em>。CI 把 finding 推 SOAR（或自家 webhook）、SOAR 呼叫 <a href="/blog/backend/07-security-data-protection/vendors/hashicorp-vault/" data-link-title="HashiCorp Vault" data-link-desc="Self-hosted secret management 與 dynamic credential / encryption-as-a-service / PKI engine、跨雲跨環境的 secret 控制面">Vault</a> API 對該 credential type rotate（dynamic credential 直接 revoke、static secret 換新版本）、再 broadcast 給依賴該 secret 的 service rolling restart。沒這條 pipeline、Gitleaks 只是 finding 列表沒實際治理價值。</p>
<p><strong>Allowlist 治理（FP 不能無限）</strong>：OSS 沒 validation endpoint、test fixture / mock token / sample config 一定觸發 FP。allowlist 治理三原則 — <em>每個 entry 帶 reason + owner + expire date</em>、<em>PR review 必問「為什麼 FP」</em>、<em>quarterly audit 刪過期項目</em>。沒這個治理 allowlist 會在 6–12 個月內膨脹到「半個 repo 都在白名單」、那時候 rule 已經沒用、refactor 成本比一開始嚴格更高。</p>
<p><strong>跟 Trivy secret scan 重疊</strong>：<a href="/blog/backend/07-security-data-protection/vendors/trivy/" data-link-title="Trivy" data-link-desc="Aqua Security 開源 all-in-one scanner：Container / Filesystem / K8s / IaC &#43; Secret &#43; License &#43; SBOM、Apache 2.0、CI 友善">Trivy</a> 內建 secret scanner（用同樣的 regex pattern）、container image / filesystem 都掃。Gitleaks 跟 Trivy secret scan 在 <em>container build pipeline</em> 階段會重疊 — 實務分工：Gitleaks 掃 source repo（git history + working tree）、Trivy 掃 built artifact（image layer + filesystem）。兩者覆蓋不同階段、不衝突。</p>
<h2 id="排錯與失敗快速判讀">排錯與失敗快速判讀</h2>
<ul>
<li><strong>FP 太多、開發者開始忽略 Gitleaks finding</strong>：rule 沒 tune entropy threshold 或 path filter — 對 high-FP rule 加 <code>entropy = 4.0</code> 跟 <code>paths = ['''!test/.*''']</code>、staging branch 跑 1 週統計 FP 再 promote</li>
<li><strong>Pre-commit 被繞過（<code>--no-verify</code>）</strong>：開發者本機跑不過直接 bypass — pre-commit 不能當唯一防線、CI <code>gitleaks detect</code> block PR 才是真實 gate</li>
<li><strong>Historical scan 太慢、CI timeout</strong>：每次掃整個 git history — PR scan 限定 <code>--log-opts=&quot;$(git merge-base origin/main HEAD)..HEAD&quot;</code> 只看本 PR commit、nightly job 才跑 full history</li>
<li><strong>SARIF 上傳失敗 / GHAS dashboard 沒 finding</strong>：<code>github/codeql-action/upload-sarif</code> 權限不足或 <code>security-events: write</code> permission 沒給 — 補 GitHub Actions permission、或改 upload 內部 SIEM</li>
<li><strong>Allowlist 膨脹、規則失效</strong>：FP 全部塞 allowlist、沒 reason 沒 expire — quarterly audit、刪過期項目、把高 FP rule 改寫成更窄的 regex 而不是 allowlist 蓋過</li>
<li><strong>既有 leak 沒被發現、新 commit 攔得很乾淨</strong>：只接 <code>protect</code> 沒接 <code>detect</code> — CI 加 <code>detect</code> job、找出 history 中已 leak 的 secret 一次性 rotate（<a href="/blog/backend/07-security-data-protection/vendors/hashicorp-vault/" data-link-title="HashiCorp Vault" data-link-desc="Self-hosted secret management 與 dynamic credential / encryption-as-a-service / PKI engine、跨雲跨環境的 secret 控制面">Vault</a> 自動化）</li>
<li><strong>Custom rule 寫錯、silent skip 真 leak</strong>：rule regex 沒 unit test fixture、production 才發現 — 強制 custom rule 加 valid + invalid sample、CI 跑 rule 自驗</li>
</ul>
<h2 id="何時改走其他服務">何時改走其他服務</h2>
<table>
  <thead>
      <tr>
          <th>需求形狀</th>
          <th>改走</th>
      </tr>
  </thead>
  <tbody>
      <tr>
          <td>跨 Slack / Jira / Notion / 自架 SaaS scan</td>
          <td><a href="/blog/backend/07-security-data-protection/vendors/gitguardian/" data-link-title="GitGuardian" data-link-desc="Secret scanning &#43; remediation SaaS、350&#43; Detector &#43; Validation endpoint、跨 SCM &#43; SaaS（Slack / Notion）、Honeytokens decoy">GitGuardian</a></td>
      </tr>
      <tr>
          <td>Push protection + partner auto-revoke</td>
          <td><a href="/blog/backend/07-security-data-protection/vendors/github-advanced-security/" data-link-title="GitHub Advanced Security" data-link-desc="GitHub 內建 4 大模組：Code Scanning (CodeQL) &#43; Secret Scanning &#43; Dependency Review &#43; Dependabot、跟 PR / Security tab 深度整合">GHAS Secret Scanning</a></td>
      </tr>
      <tr>
          <td>Validation endpoint（驗證 secret 真偽）</td>
          <td><a href="/blog/backend/07-security-data-protection/vendors/gitguardian/" data-link-title="GitGuardian" data-link-desc="Secret scanning &#43; remediation SaaS、350&#43; Detector &#43; Validation endpoint、跨 SCM &#43; SaaS（Slack / Notion）、Honeytokens decoy">GitGuardian</a> 或 TruffleHog Enterprise</td>
      </tr>
      <tr>
          <td>Honeytoken decoy 主動防禦</td>
          <td><a href="/blog/backend/07-security-data-protection/vendors/gitguardian/" data-link-title="GitGuardian" data-link-desc="Secret scanning &#43; remediation SaaS、350&#43; Detector &#43; Validation endpoint、跨 SCM &#43; SaaS（Slack / Notion）、Honeytokens decoy">GitGuardian</a>（內建 honeytoken）</td>
      </tr>
      <tr>
          <td>Container image secret scan</td>
          <td><a href="/blog/backend/07-security-data-protection/vendors/trivy/" data-link-title="Trivy" data-link-desc="Aqua Security 開源 all-in-one scanner：Container / Filesystem / K8s / IaC &#43; Secret &#43; License &#43; SBOM、Apache 2.0、CI 友善">Trivy</a>（內建 secret scanner）</td>
      </tr>
      <tr>
          <td>Secret 找到後自動 rotate</td>
          <td>配 <a href="/blog/backend/07-security-data-protection/vendors/hashicorp-vault/" data-link-title="HashiCorp Vault" data-link-desc="Self-hosted secret management 與 dynamic credential / encryption-as-a-service / PKI engine、跨雲跨環境的 secret 控制面">HashiCorp Vault</a> dynamic credential</td>
      </tr>
      <tr>
          <td>SAST / SCA dashboard 整合</td>
          <td><a href="/blog/backend/07-security-data-protection/vendors/github-advanced-security/" data-link-title="GitHub Advanced Security" data-link-desc="GitHub 內建 4 大模組：Code Scanning (CodeQL) &#43; Secret Scanning &#43; Dependency Review &#43; Dependabot、跟 PR / Security tab 深度整合">GHAS Code Scanning</a>（收 SARIF）</td>
      </tr>
  </tbody>
</table>
<h2 id="不在本頁內的主題">不在本頁內的主題</h2>
<ul>
<li>Gitleaks v8 跟 v7 的 rule 格式遷移細節</li>
<li>Gitleaks 內部 git odb 解析跟性能 tuning（large monorepo 加速）</li>
<li>Pre-commit framework 本身的安裝跟治理（屬開發者工作流、不在資安範圍）</li>
<li>Rotation playbook 完整實作（屬 <a href="/blog/backend/07-security-data-protection/vendors/hashicorp-vault/" data-link-title="HashiCorp Vault" data-link-desc="Self-hosted secret management 與 dynamic credential / encryption-as-a-service / PKI engine、跨雲跨環境的 secret 控制面">Vault</a> / <a href="/blog/backend/07-security-data-protection/vendors/aws-secrets-manager/" data-link-title="AWS Secrets Manager" data-link-desc="AWS 原生 secret store &#43; 內建 RDS / Redshift rotation Lambda、Resource Policy 跨帳號共享、KMS 加密">AWS Secrets Manager</a> 章節）</li>
<li>Secret 治理整體政策（屬 <a href="/blog/backend/07-security-data-protection/secrets-and-machine-credential-governance/" data-link-title="7.6 秘密管理與機器憑證治理" data-link-desc="以問題驅動方式整理 secret、token、key 與機器身份治理">Secrets Management section</a> 上層原則）</li>
</ul>
<h2 id="案例回寫">案例回寫</h2>
<p>Gitleaks 在 07 案例庫沒有直接 vendor-level 事件、所有 secret leak case 都是 git history scan + rotation pipeline 的對照：</p>
<table>
  <thead>
      <tr>
          <th>案例</th>
          <th>跟 Gitleaks 的關係（對照啟示）</th>
      </tr>
  </thead>
  <tbody>
      <tr>
          <td><a href="/blog/backend/07-security-data-protection/red-team/cases/supply-chain/circleci-2023-secrets-rotation/" data-link-title="7.R7.2.3 CircleCI 2023：CI secrets 輪替壓力" data-link-desc="工程端點入侵後，CI 平台 secrets 如何成為高風險擴散點">CircleCI 2023 Secrets Rotation</a></td>
          <td>Gitleaks <code>detect</code> 跑整個 git history 找出已 leaked secret、配合 <a href="/blog/backend/07-security-data-protection/vendors/hashicorp-vault/" data-link-title="HashiCorp Vault" data-link-desc="Self-hosted secret management 與 dynamic credential / encryption-as-a-service / PKI engine、跨雲跨環境的 secret 控制面">Vault</a> rotation 流程清乾淨</td>
      </tr>
      <tr>
          <td><a href="/blog/backend/07-security-data-protection/red-team/cases/supply-chain/github-oauth-2022-token-supply-chain/" data-link-title="7.R7.2.2 GitHub OAuth 2022：第三方 token 供應鏈風險" data-link-desc="第三方整合 token 被竊後，如何形成跨組織存取風險">GitHub OAuth 2022 Token Supply Chain</a></td>
          <td>Pre-commit <code>protect</code> 攔未來 leak、但對既有 leak 要 historical scan 補位、單一防線不夠</td>
      </tr>
      <tr>
          <td><a href="/blog/backend/07-security-data-protection/cases/failure-credential-rotation-without-scope/" data-link-title="7.C9 反例：憑證輪替未分 Scope" data-link-desc="憑證輪替若未分域分批，容易造成跨系統連鎖中斷。">Failure: Credential Rotation Without Scope</a></td>
          <td>Gitleaks 找出 leaked static secret 是第一步、長期解是 <a href="/blog/backend/07-security-data-protection/vendors/hashicorp-vault/" data-link-title="HashiCorp Vault" data-link-desc="Self-hosted secret management 與 dynamic credential / encryption-as-a-service / PKI engine、跨雲跨環境的 secret 控制面">Vault</a> dynamic credential 取代 long-lived secret</td>
      </tr>
  </tbody>
</table>
<h2 id="下一步路由">下一步路由</h2>
<ul>
<li>上游：<a href="/blog/backend/07-security-data-protection/secrets-and-machine-credential-governance/" data-link-title="7.6 秘密管理與機器憑證治理" data-link-desc="以問題驅動方式整理 secret、token、key 與機器身份治理">7 章 Secrets Management section</a>、<a href="/blog/backend/07-security-data-protection/detection-coverage-and-signal-governance/" data-link-title="7.13 偵測覆蓋率與訊號治理" data-link-desc="定義偵測覆蓋、訊號品質與誤報成本的治理問題">Detection Coverage and Signal Governance</a></li>
<li>平行：<a href="/blog/backend/07-security-data-protection/vendors/gitguardian/" data-link-title="GitGuardian" data-link-desc="Secret scanning &#43; remediation SaaS、350&#43; Detector &#43; Validation endpoint、跨 SCM &#43; SaaS（Slack / Notion）、Honeytokens decoy">GitGuardian</a>、<a href="/blog/backend/07-security-data-protection/vendors/github-advanced-security/" data-link-title="GitHub Advanced Security" data-link-desc="GitHub 內建 4 大模組：Code Scanning (CodeQL) &#43; Secret Scanning &#43; Dependency Review &#43; Dependabot、跟 PR / Security tab 深度整合">GHAS Secret Scanning</a>、<a href="/blog/backend/07-security-data-protection/vendors/trivy/" data-link-title="Trivy" data-link-desc="Aqua Security 開源 all-in-one scanner：Container / Filesystem / K8s / IaC &#43; Secret &#43; License &#43; SBOM、Apache 2.0、CI 友善">Trivy</a></li>
<li>下游：<a href="/blog/backend/07-security-data-protection/vendors/hashicorp-vault/" data-link-title="HashiCorp Vault" data-link-desc="Self-hosted secret management 與 dynamic credential / encryption-as-a-service / PKI engine、跨雲跨環境的 secret 控制面">HashiCorp Vault</a>（找到 leak 後 rotate）、<a href="/blog/backend/07-security-data-protection/vendors/aws-secrets-manager/" data-link-title="AWS Secrets Manager" data-link-desc="AWS 原生 secret store &#43; 內建 RDS / Redshift rotation Lambda、Resource Policy 跨帳號共享、KMS 加密">AWS Secrets Manager</a> / <a href="/blog/backend/07-security-data-protection/vendors/google-secret-manager/" data-link-title="Google Secret Manager" data-link-desc="GCP 原生 secret store、CMEK &#43; Workload Identity Federation 整合、rotation 走自寫 Cloud Function 而非 built-in Lambda">Google Secret Manager</a> / <a href="/blog/backend/07-security-data-protection/vendors/azure-key-vault/" data-link-title="Azure Key Vault" data-link-desc="Azure 三合一 service（Secret &#43; Key &#43; Certificate）、整合 Managed Identity &#43; Entra ID RBAC、Premium tier 走 HSM">Azure Key Vault</a></li>
<li>跨類：<a href="/blog/backend/07-security-data-protection/vendors/github-advanced-security/" data-link-title="GitHub Advanced Security" data-link-desc="GitHub 內建 4 大模組：Code Scanning (CodeQL) &#43; Secret Scanning &#43; Dependency Review &#43; Dependabot、跟 PR / Security tab 深度整合">GHAS Code Scanning</a>（收 SARIF dashboard）、<a href="/blog/backend/07-security-data-protection/vendors/splunk/" data-link-title="Splunk" data-link-desc="業界 SIEM 標準、forwarder &#43; indexer &#43; search head 架構、SPL 為核心查詢語言、ingestion-based 計費跟偵測覆蓋率的 trade-off">Splunk</a> / <a href="/blog/backend/07-security-data-protection/vendors/elastic-security/" data-link-title="Elastic Security" data-link-desc="Elastic Stack 上的 SIEM &#43; EDR &#43; Cloud Security 套件、OSS 起源、KQL/EQL/Lucene/ES|QL 多查詢語言、resource-based pricing">Elastic Security</a>（finding 進 SIEM）</li>
<li>官方：<a href="https://github.com/gitleaks/gitleaks">Gitleaks GitHub</a>、<a href="https://github.com/gitleaks/gitleaks/blob/master/README.md">Gitleaks Documentation</a></li>
</ul>
]]></content:encoded></item></channel></rss>