<?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>Sast on Tarragon</title><link>https://tarrragon.github.io/blog/tags/sast/</link><description>Recent content in Sast 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/sast/index.xml" rel="self" type="application/rss+xml"/><item><title>GitHub Advanced Security</title><link>https://tarrragon.github.io/blog/backend/07-security-data-protection/vendors/github-advanced-security/</link><pubDate>Mon, 18 May 2026 00:00:00 +0000</pubDate><guid>https://tarrragon.github.io/blog/backend/07-security-data-protection/vendors/github-advanced-security/</guid><description>&lt;p>GitHub Advanced Security（GHAS）是 GitHub 內建的 &lt;em>application security platform&lt;/em>、由四大模組組成：&lt;em>Code Scanning&lt;/em>（CodeQL 為預設 SAST、可接受第三方 SARIF）、&lt;em>Secret Scanning&lt;/em>（偵測 leaked credential、含 Push Protection 預防 push）、&lt;em>Dependency Review&lt;/em>（PR 級依賴變更 gate）、&lt;em>Dependabot&lt;/em>（自動化依賴 update + alert、細節見獨立 vendor 頁）。它跟 &lt;a href="https://tarrragon.github.io/blog/backend/07-security-data-protection/vendors/snyk/" data-link-title="Snyk" data-link-desc="跨 SCM 多模組 application security platform：Open Source (SCA) &amp;#43; Code (SAST) &amp;#43; Container &amp;#43; IaC &amp;#43; Cloud (CSPM)、Reachability analysis">Snyk&lt;/a> / &lt;a href="https://tarrragon.github.io/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 &amp;#43; Secret &amp;#43; License &amp;#43; SBOM、Apache 2.0、CI 友善">Trivy&lt;/a> 等獨立 SCA 工具的核心差異是 &lt;em>跟 GitHub workflow / PR / Security tab 深度整合&lt;/em> — security finding 直接出現在 PR review 跟 organization Security overview、不需另一個 dashboard。&lt;/p>
&lt;h2 id="服務定位">服務定位&lt;/h2>
&lt;p>GHAS 的核心定位是 &lt;em>把 application security 控制面收斂回 GitHub 平台&lt;/em>：SAST、Secret Scanning、Dependency Review、Dependabot 共用 GitHub 的 identity / permission / PR / branch protection / Actions / Security tab，讓 security finding 跟 code review 在同一個 surface 上決策。這跟 &lt;a href="https://tarrragon.github.io/blog/backend/07-security-data-protection/vendors/snyk/" data-link-title="Snyk" data-link-desc="跨 SCM 多模組 application security platform：Open Source (SCA) &amp;#43; Code (SAST) &amp;#43; Container &amp;#43; IaC &amp;#43; Cloud (CSPM)、Reachability analysis">Snyk&lt;/a> 走「跨 SCM、跨雲、自有 dashboard」是相反方向 — Snyk 把 security 抽到平台之上、GHAS 把 security 釘在 GitHub 之內。&lt;/p>
&lt;p>跟 &lt;a href="https://tarrragon.github.io/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 &amp;#43; Secret &amp;#43; License &amp;#43; SBOM、Apache 2.0、CI 友善">Trivy&lt;/a> 比、定位差更遠。Trivy 主打 &lt;em>container image / IaC / SBOM scan&lt;/em>、open-source 免費、適合塞進任何 CI；GHAS 主打 &lt;em>source code + secret + dependency&lt;/em>、Enterprise 付費、container scan 有但偏弱。兩者通常 &lt;em>並存&lt;/em> — Trivy 跑 container artifact、GHAS 跑 source repo。&lt;/p></description><content:encoded><![CDATA[<p>GitHub Advanced Security（GHAS）是 GitHub 內建的 <em>application security platform</em>、由四大模組組成：<em>Code Scanning</em>（CodeQL 為預設 SAST、可接受第三方 SARIF）、<em>Secret Scanning</em>（偵測 leaked credential、含 Push Protection 預防 push）、<em>Dependency Review</em>（PR 級依賴變更 gate）、<em>Dependabot</em>（自動化依賴 update + alert、細節見獨立 vendor 頁）。它跟 <a href="/blog/backend/07-security-data-protection/vendors/snyk/" data-link-title="Snyk" data-link-desc="跨 SCM 多模組 application security platform：Open Source (SCA) &#43; Code (SAST) &#43; Container &#43; IaC &#43; Cloud (CSPM)、Reachability analysis">Snyk</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> 等獨立 SCA 工具的核心差異是 <em>跟 GitHub workflow / PR / Security tab 深度整合</em> — security finding 直接出現在 PR review 跟 organization Security overview、不需另一個 dashboard。</p>
<h2 id="服務定位">服務定位</h2>
<p>GHAS 的核心定位是 <em>把 application security 控制面收斂回 GitHub 平台</em>：SAST、Secret Scanning、Dependency Review、Dependabot 共用 GitHub 的 identity / permission / PR / branch protection / Actions / Security tab，讓 security finding 跟 code review 在同一個 surface 上決策。這跟 <a href="/blog/backend/07-security-data-protection/vendors/snyk/" data-link-title="Snyk" data-link-desc="跨 SCM 多模組 application security platform：Open Source (SCA) &#43; Code (SAST) &#43; Container &#43; IaC &#43; Cloud (CSPM)、Reachability analysis">Snyk</a> 走「跨 SCM、跨雲、自有 dashboard」是相反方向 — Snyk 把 security 抽到平台之上、GHAS 把 security 釘在 GitHub 之內。</p>
<p>跟 <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> 比、定位差更遠。Trivy 主打 <em>container image / IaC / SBOM scan</em>、open-source 免費、適合塞進任何 CI；GHAS 主打 <em>source code + secret + dependency</em>、Enterprise 付費、container scan 有但偏弱。兩者通常 <em>並存</em> — Trivy 跑 container artifact、GHAS 跑 source repo。</p>
<p>跟 <a href="/blog/backend/07-security-data-protection/vendors/dependabot/" data-link-title="Dependabot" data-link-desc="GitHub 原生依賴更新自動化、Version Update &#43; Security Update &#43; Alerts、Grouped Updates 減 PR noise、Auto-merge 配 branch protection">Dependabot</a> 的關係是 <em>內含</em> — Dependabot 是 GHAS 四模組之一、跟 GHAS 同一個控制平面、跟 PR / Security tab 同一條 evidence chain。本頁聚焦 GHAS 整體 + Code Scanning / Secret Scanning / Dependency Review；Dependabot 的 update PR 政策、ecosystem 覆蓋、alert routing 細節留在該頁。</p>
<p>關鍵張力：GHAS 計費走 <em>per-active-committer + per-repo</em>、2024 後 Secret Scanning 跟 Code Scanning 拆開計費。大型 mono-repo 或 committer 數量膨脹的組織會撞到成本天花板、需要選擇性 enable repo + 拆模組買；同時、Push Protection 這類 <em>預防型</em> 控制只有 enable 後才有效、選擇性 enable 等於默認 risk 接受。</p>
<h2 id="本章目標">本章目標</h2>
<p>讀完本頁、讀者能判斷：</p>
<ol>
<li>GHAS 四大模組各自承擔哪段控制責任（SAST / Secret / PR-level dependency gate / 自動 update）、哪些跟 <a href="/blog/backend/07-security-data-protection/vendors/snyk/" data-link-title="Snyk" data-link-desc="跨 SCM 多模組 application security platform：Open Source (SCA) &#43; Code (SAST) &#43; Container &#43; IaC &#43; Cloud (CSPM)、Reachability analysis">Snyk</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>CodeQL 跟 SARIF 標準的關係、為什麼第三方 SAST 工具的 finding 也能進 GHAS Security tab</li>
<li>Secret Scanning 的 <em>Push Protection</em>（預防 push）跟 <em>Secret Scanning Alert</em>（偵測 leaked）的職責差、partner pattern vs custom pattern 何時用</li>
<li>何時用 GHAS、何時改走 Snyk / Trivy / GitLab Ultimate（GitLab 自家相當品）</li>
</ol>
<h2 id="最短判讀路徑">最短判讀路徑</h2>
<p>判斷 GHAS 配置是否健康、最少看四件事：</p>
<ul>
<li><strong>誰能 enable / disable</strong>：Organization owner / Security manager role 配置、enable GHAS 的 audit log 是否同步、誰能改 Code Scanning workflow（branch protection 是否擋住 workflow file 直接 push）</li>
<li><strong>哪些 repo 開啟</strong>：Org Security overview 看 <em>Code Scanning / Secret Scanning / Dependency Review coverage</em>、新建 repo 是否預設啟用（Organization-level default setting）、private / internal / public repo 是否一致開啟</li>
<li><strong>Push Protection 狀態</strong>：Secret Scanning Push Protection 是否 organization-wide enable、bypass 權限給誰（developer 個人 bypass vs 必須走 Security team approval）、bypass 事件是否進 audit</li>
<li><strong>Secret Scanning Coverage</strong>：partner pattern（AWS / GCP / Stripe / Slack 等預配）是否全開、custom pattern 是否涵蓋自家 internal token（service token、internal API key）、historical scan 是否跑過（不只新 commit、舊 commit 也要掃）</li>
</ul>
<p>四件事任一缺失、就是 <a href="/blog/backend/knowledge-cards/secret-management/" data-link-title="Secret Management" data-link-desc="說明 token、key、password 與憑證如何保存、輪替與撤銷">Secret Management</a> 跟 <a href="/blog/backend/07-security-data-protection/supply-chain-integrity-and-artifact-trust/" data-link-title="7.12 供應鏈完整性與 Artifact 信任" data-link-desc="定義 build provenance、artifact 信任與交付鏈風險問題">Supply Chain Integrity</a> 邊界的待補項目。</p>
<h2 id="日常操作與決策形狀">日常操作與決策形狀</h2>
<p><strong>Code Scanning 走 SARIF 標準</strong>：Code Scanning 不只是 CodeQL 的 UI、是 <em>SAST aggregation layer</em>。所有 SAST 結果（CodeQL 預設、或 Semgrep / Snyk Code / Brakeman / Bandit / SonarCloud / Checkmarx 等第三方）以 SARIF（Static Analysis Results Interchange Format）upload 到 Code Scanning、Security tab 統一展示、PR review 統一標註。意義是 <em>組織可以用多個 SAST 工具但只看一個 dashboard</em> — 不需要每個 vendor 各自登入。多工具 SARIF upload 用 GitHub Actions 的 <code>github/codeql-action/upload-sarif</code> step。</p>
<p><strong>CodeQL 是 first-class query language</strong>：CodeQL 用 Datalog-like 語法寫 <em>自定 query</em>、可以檢測 <em>organization-specific anti-pattern</em>（例：禁用某內部 deprecated function、強制 input validation 在特定 trust boundary）。vendor-provided pack（GitHub 維護的 CodeQL pack）覆蓋 OWASP Top 10 / CWE Top 25、自定 query 補組織 idiomatic check。代價是 <em>CodeQL 學習曲線陡</em> — 不是 regex / AST pattern、是完整的 graph query language。</p>
<p><strong>Secret Scanning 三層職責</strong>：Secret Scanning 分三層。<em>Partner pattern</em> — GitHub 跟 AWS / GCP / Stripe / Slack / npm 等 vendor 預配 token pattern、預設 detection 範圍最大、leaked token 還會通知 vendor revoke。<em>Push Protection</em> — commit push 前 scan、發現 secret 直接 reject push、開發者必須先移除才能 push；這是 <em>預防</em> 不是 <em>偵測</em>、不需要等 leaked 後 rotation。<em>Custom pattern</em> — 組織自己的 internal token（service-to-service API key、legacy auth token）寫 regex pattern、配 validation endpoint 降 FP。</p>
<p><strong>Dependency Review 是 PR-level gate</strong>：每個 PR 跑 <em>新增 / 升級依賴的漏洞檢查 + license check</em>、把 <em>新引入 CVE</em> 列在 PR review、可設 branch protection 強制 PR 過 Dependency Review 才能 merge。這跟 <a href="/blog/backend/07-security-data-protection/vendors/dependabot/" data-link-title="Dependabot" data-link-desc="GitHub 原生依賴更新自動化、Version Update &#43; Security Update &#43; Alerts、Grouped Updates 減 PR noise、Auto-merge 配 branch protection">Dependabot</a> 是互補關係：Dependabot 是 <em>已 merge 依賴的 update PR</em>（時間軸：merge 後 vuln 出現、自動發 update PR）、Dependency Review 是 <em>PR 加新依賴時的 gate</em>（時間軸：merge 前 vuln 已知、擋 PR）。兩條軸都要開。</p>
<p><strong>Security overview 是 org-level dashboard</strong>：Organization Security tab 看 <em>跨 repo</em> 的 Code Scanning / Secret Scanning / Dependency / Dependabot alert 彙整、用 repo / severity / age filter 排序。對於 <em>security team 不是 repo owner</em> 的組織、Security manager role 給 security team 跨 repo read + triage 權限、不需要 admin。</p>
<p><strong>Security Advisories（CVE 揭露 workflow）</strong>：自家 OSS / 商業 product 出 CVE 時、走 <em>GitHub Security Advisory</em> — 在 private fork 修補、coordinated disclosure 時間到公開 advisory、GitHub 自動向 <a href="https://www.cve.org/">CVE Numbering Authority</a> 申請 CVE ID。這條 workflow 是 <em>維護者視角</em>、不是 <em>使用者視角</em>；使用者收到的是其他人發的 advisory 進 Dependabot alert。</p>
<p><strong>SARIF integration 是 GHAS 的 <em>aggregation</em> 角色關鍵</strong>：GHAS 不強迫只用 CodeQL — Snyk Code / Semgrep / SonarCloud 等 SAST 工具跑完輸出 SARIF、CI 上傳到 GitHub、Security tab 集中展示。意義是 <em>組織用 Snyk 做 SAST、但 finding 走 GHAS UI</em> 是合法配置；GHAS 賣的不只是 CodeQL、是 SAST 統一視圖。</p>
<h2 id="核心取捨表">核心取捨表</h2>
<table>
  <thead>
      <tr>
          <th>取捨維度</th>
          <th>GHAS</th>
          <th>Snyk</th>
          <th>Trivy</th>
          <th>Dependabot（GHAS 子模組）</th>
      </tr>
  </thead>
  <tbody>
      <tr>
          <td>主要範圍</td>
          <td>Source code + secret + dependency（PR-level）</td>
          <td>SCA + Container + IaC + SAST（跨 SCM）</td>
          <td>Container image + IaC + SBOM scan</td>
          <td>依賴 update + alert（merged code）</td>
      </tr>
      <tr>
          <td>SCM 綁定</td>
          <td>緊綁 GitHub</td>
          <td>跨 GitHub / GitLab / Bitbucket / Azure Repos</td>
          <td>無 SCM 綁定、跑在 CI / artifact registry</td>
          <td>緊綁 GitHub</td>
      </tr>
      <tr>
          <td>SAST 引擎</td>
          <td>CodeQL 預設 + 第三方 SARIF aggregation</td>
          <td>Snyk Code（DeepCode）</td>
          <td>無 SAST</td>
          <td>無</td>
      </tr>
      <tr>
          <td>Secret Scanning</td>
          <td>Partner pattern + Push Protection + custom pattern</td>
          <td>Snyk Secret Scanning（較弱）</td>
          <td>有限（filesystem secret scan）</td>
          <td>無</td>
      </tr>
      <tr>
          <td>Container 強度</td>
          <td>中（Code Scanning 可掃 Dockerfile）</td>
          <td>強（Snyk Container 是主打）</td>
          <td>強（Trivy 是 container scan 標準）</td>
          <td>無</td>
      </tr>
      <tr>
          <td>License / SBOM</td>
          <td>有（Dependency Review 含 license）</td>
          <td>強（SBOM 生成、license compliance dashboard）</td>
          <td>強（SBOM 是 first-class）</td>
          <td>無</td>
      </tr>
      <tr>
          <td>PR 整合</td>
          <td>深 — Security tab + PR review 直連</td>
          <td>中 — GitHub Check + 跨 SCM PR comment</td>
          <td>中 — 第三方 Action 整合</td>
          <td>深 — 自動發 PR</td>
      </tr>
      <tr>
          <td>計費</td>
          <td>Per-active-committer + per-repo（Enterprise）</td>
          <td>Per-developer + tier</td>
          <td>Open source 免費（Aqua 商業版加值）</td>
          <td>GHAS 一部分</td>
      </tr>
      <tr>
          <td>適合</td>
          <td>GitHub-heavy org、想統一 PR + security UI</td>
          <td>多 SCM / 多雲、SCA + Container 一站、license 強需求</td>
          <td>Container / IaC scan 為主、CI pluggable</td>
          <td>GitHub repo 想要自動依賴 update</td>
      </tr>
      <tr>
          <td>不適合</td>
          <td>GitLab / Bitbucket / 自管 Git 為主</td>
          <td>GitHub-only 又要省成本</td>
          <td>需要 SAST + Secret Scanning</td>
          <td>不想自動產生 PR（噪音）</td>
      </tr>
  </tbody>
</table>
<p>選 GHAS 的核心訴求：<em>GitHub 是 SCM</em> + 想 <em>PR review 跟 security finding 合一</em> + Enterprise 預算可吸收 per-committer cost。GitLab 主要的組織直接走 GitLab Ultimate 的對等功能；多 SCM 或 container 為主走 Snyk + Trivy 組合。</p>
<h2 id="進階主題">進階主題</h2>
<p><strong>CodeQL custom query 開發</strong>：寫自定 query 用 CodeQL CLI 本地開發、跑 <code>codeql database analyze</code>、SARIF output 上傳。常見場景：禁用 internal deprecated API、特定 framework 的 misuse pattern、組織 idiomatic security check。Query pack 可以 publish 到 GitHub Container Registry 或 internal registry、跨 repo 復用。代價是 <em>維護成本</em> — CodeQL query language 學習曲線陡、組織需要至少 1-2 個 security engineer 專門養護。</p>
<p><strong>Push Protection bypass workflow</strong>：Push Protection reject push 後、developer 可以 <em>bypass</em>（標記 false positive / test data / 風險已知）。Bypass 權限治理是關鍵 — 開放給 developer 個人 bypass 失去預防意義、強制 Security team approval 又拖慢 dev velocity。常見折中：低風險 pattern（test fixture token）developer 可 bypass、高風險 pattern（production credential）必須 Security team approve；所有 bypass 事件進 audit log。</p>
<p><strong>跟 GitHub Actions 整合</strong>：Code Scanning 走 GitHub Actions workflow 跑 CodeQL — <code>github/codeql-action/init</code> + <code>github/codeql-action/analyze</code>。同 workflow 可以加 <code>upload-sarif</code> step 接第三方 SAST 結果。Actions 用 GitHub-hosted runner 跑 CodeQL 是預設、大型 repo 跑 CodeQL analyze 可能超時、需改 self-hosted runner（大 RAM / 多 CPU）— 但 self-hosted runner 自身是 supply chain 風險、需要 ephemeral runner + 限制 secret access。</p>
<p><strong>SARIF 多工具整合</strong>：第三方 SAST / SCA / Container scan 工具（Snyk / Semgrep / Trivy / Brakeman / Bandit / Gosec）跑完輸出 SARIF、CI 上傳到 GHAS。實務上組織常用 <em>CodeQL + Semgrep</em> 雙軌 — CodeQL 跑深度 graph query、Semgrep 跑快速 pattern 規則；finding 在 Security tab 用 <em>tool</em> filter 分開看。</p>
<p><strong>Secret Scanning partner pattern</strong>：GitHub 維護的 partner pattern list 涵蓋 AWS / GCP / Azure / Stripe / Slack / npm / Docker Hub / GitHub PAT 等。leaked token detect 後、GitHub 自動通知 vendor、vendor 端可選擇 <em>自動 revoke</em> 該 token。意義是 <em>組織不需要做 rotation</em> — vendor 已經把 leaked token 廢掉。custom pattern 則需要組織自己提供 validation endpoint、GHAS 呼叫驗證才確認是真 leak。</p>
<p><strong>GHAS Cloud-hosted vs Self-hosted Runner 治理</strong>：CodeQL 跑在 GitHub-hosted runner 是預設、所有 source code 上傳到 GitHub 運算環境。對 <em>source code 機密度高</em> 的組織（金融 / 國防 / 法規限制 source 出境）、需走 self-hosted runner。Self-hosted runner 的供應鏈風險見 <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</a> — runner token 是 supply chain entry、OIDC short-lived token 是建議方向。</p>
<p><strong>GHAS Enterprise pricing trap</strong>：Per-active-committer 計費、organization 內所有 <em>過去 90 天有 commit</em> 的 user 都算 active committer、即使只 commit 1 行也計費。大型公司容易超支；2024 後 Secret Scanning 跟 Code Scanning 拆開計費、可只買 Secret Scanning（單價較低）給全 org、Code Scanning 給關鍵 repo。Public repo 上 GHAS 功能多數免費（Code Scanning、Secret Scanning、Dependency Review）；GitHub Enterprise Cloud 的 internal / private repo 才落入 GHAS 計費範圍 — 兩者範圍不同、新組織常踩到把 private repo 全開的成本。</p>
<h2 id="排錯與失敗快速判讀">排錯與失敗快速判讀</h2>
<ul>
<li><strong>新建 repo 沒自動開 GHAS</strong>：Organization-level default 沒設、新 repo 預設 disable — 開 Organization Security settings 的 <em>Enable for new repositories</em>、現有 repo 用 bulk enable</li>
<li><strong>Push Protection 大量誤殺</strong>：custom pattern regex 太寬、合法字串被當 secret — 加 validation endpoint 或收緊 regex、bypass 統計看 FP rate</li>
<li><strong>Secret Scanning 沒掃歷史 commit</strong>：只 enable 後新 commit 觸發、舊 commit leaked secret 沒被發現 — 跑 <em>historical scan</em>（enable 後 GitHub 自動掃過去全部 commit）、可能花數小時</li>
<li><strong>Dependency Review 沒擋住 vuln PR</strong>：Branch protection 沒加 <em>Dependency Review</em> required check — 加進 required status check、新 PR 才強制過</li>
<li><strong>Code Scanning workflow 跑很久 / 超時</strong>：repo 太大、GitHub-hosted runner RAM 不足 — 換 larger runner（GitHub Larger Runners）或 self-hosted、或只跑 changed file analysis</li>
<li><strong>Custom CodeQL query FP 多</strong>：query 寫得太寬、commit 都跳 alert — 加 <code>@precision high</code> 標籤、用 <code>Sink-Source</code> 分析降低 reach</li>
<li><strong>第三方 SAST SARIF 沒進 Security tab</strong>：upload-sarif step 沒設對 category 或 permissions — <code>security-events: write</code> permission 必須在 workflow 給；同 repo 多工具用不同 <code>category</code> 區分</li>
<li><strong>Bypass 沒進 audit</strong>：Push Protection bypass 沒同步到 SIEM — Enterprise audit log streaming 開、event filter 加 <code>secret_scanning.bypass</code></li>
</ul>
<h2 id="何時改走其他服務">何時改走其他服務</h2>
<table>
  <thead>
      <tr>
          <th>需求形狀</th>
          <th>改走</th>
      </tr>
  </thead>
  <tbody>
      <tr>
          <td>多 SCM（GitHub + GitLab + Bitbucket）</td>
          <td><a href="/blog/backend/07-security-data-protection/vendors/snyk/" data-link-title="Snyk" data-link-desc="跨 SCM 多模組 application security platform：Open Source (SCA) &#43; Code (SAST) &#43; Container &#43; IaC &#43; Cloud (CSPM)、Reachability analysis">Snyk</a></td>
      </tr>
      <tr>
          <td>Container image 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> 或 Snyk Container</td>
      </tr>
      <tr>
          <td>SBOM 生成 + license compliance</td>
          <td><a href="/blog/backend/07-security-data-protection/vendors/syft-grype/" data-link-title="Syft &#43; Grype" data-link-desc="Anchore 開源姐妹工具：Syft 產 SBOM (CycloneDX / SPDX) &#43; Grype scan 漏洞、Unix philosophy、cosign attestation 整合">Syft + Grype</a>（SBOM-first OSS）/ <a href="/blog/backend/07-security-data-protection/vendors/snyk/" data-link-title="Snyk" data-link-desc="跨 SCM 多模組 application security platform：Open Source (SCA) &#43; Code (SAST) &#43; Container &#43; IaC &#43; Cloud (CSPM)、Reachability analysis">Snyk</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>（SBOM 含在 scan）</td>
      </tr>
      <tr>
          <td>GitLab 為主</td>
          <td>GitLab Ultimate（SAST / Secret Detection / Dependency Scanning 內建）</td>
      </tr>
      <tr>
          <td>Secret scan 但不在 GitHub</td>
          <td>GitGuardian / Gitleaks</td>
      </tr>
      <tr>
          <td>Runtime detection（不只 source code）</td>
          <td><a href="/blog/backend/07-security-data-protection/detection-coverage-and-signal-governance/" data-link-title="7.13 偵測覆蓋率與訊號治理" data-link-desc="定義偵測覆蓋、訊號品質與誤報成本的治理問題">7.13 偵測覆蓋率與訊號治理</a> 系列工具</td>
      </tr>
  </tbody>
</table>
<h2 id="不在本頁內的主題">不在本頁內的主題</h2>
<ul>
<li>CodeQL 完整 query language reference</li>
<li>Dependabot 的 update PR 政策、ecosystem 覆蓋、grouped update（見 <a href="/blog/backend/07-security-data-protection/vendors/dependabot/" data-link-title="Dependabot" data-link-desc="GitHub 原生依賴更新自動化、Version Update &#43; Security Update &#43; Alerts、Grouped Updates 減 PR noise、Auto-merge 配 branch protection">Dependabot vendor 頁</a>）</li>
<li>GHAS Enterprise Server（自管 GitHub）跟 Cloud GHAS 的功能差異</li>
<li>各語言 / 框架的 CodeQL pack 完整覆蓋表</li>
<li>GHAS 跟 GitHub Copilot Autofix 整合的 AI-assisted remediation 細節</li>
</ul>
<h2 id="案例回寫">案例回寫</h2>
<p>GHAS 在 07 案例庫沒有 <em>直接 GHAS-level vendor 事件</em>。對照引用展示 GHAS 在 supply chain / source-level 控制的能力邊界：</p>
<table>
  <thead>
      <tr>
          <th>案例</th>
          <th>跟 GHAS 的關係</th>
      </tr>
  </thead>
  <tbody>
      <tr>
          <td><a href="/blog/backend/07-security-data-protection/red-team/cases/supply-chain/log4shell-cve-2021-44228-component-chain/" data-link-title="7.R7.2.7 Log4Shell 2021：共用元件風險與修補鏈" data-link-desc="共用元件漏洞如何同步影響多服務，並迫使團隊建立依賴治理 workflow">Log4Shell CVE-2021-44228</a></td>
          <td>Dependency Review + Code Scanning 應覆蓋 transitive 依賴、不只 direct import；Security Advisory 是維護者揭露 CVE 的 workflow</td>
      </tr>
      <tr>
          <td><a href="/blog/backend/07-security-data-protection/red-team/cases/supply-chain/xz-backdoor-2024-open-source-supply-chain/" data-link-title="7.R7.2.4 XZ Backdoor 2024：開源供應鏈長期滲透" data-link-desc="開源維護鏈遭滲透後，為何會直接影響廣泛 Linux 發行流程">XZ Backdoor 2024</a></td>
          <td>對照啟示 — GHAS Dependency Review 看 <em>package version</em>、看不到 <em>maintainer takeover</em>；需補 release-tarball vs git tag 差異跟 maintainer trust baseline</td>
      </tr>
      <tr>
          <td><a href="/blog/backend/07-security-data-protection/red-team/cases/supply-chain/solarwinds-2020-sunburst/" data-link-title="7.R7.2.1 SolarWinds 2020：更新鏈被濫用" data-link-desc="合法更新流程遭植入後，攻擊者如何長期潛伏與橫向擴散">SolarWinds 2020 Sunburst</a></td>
          <td>對照啟示 — Code Scanning 是 source-level、看不到 build-time 植入；需配合 artifact provenance（SLSA L2+）+ reproducible build</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>對照啟示 — GHAS 自身 token / Actions 權限治理是 supply chain risk、Push Protection + OIDC trust（非長期 token）是 mitigation</td>
      </tr>
      <tr>
          <td><a href="/blog/backend/07-security-data-protection/supply-chain-integrity-and-artifact-trust/" data-link-title="7.12 供應鏈完整性與 Artifact 信任" data-link-desc="定義 build provenance、artifact 信任與交付鏈風險問題">7.12 供應鏈完整性與 Artifact 信任</a></td>
          <td>GHAS 是 supply chain 治理工具集、章節原則對應四模組 workflow</td>
      </tr>
  </tbody>
</table>
<h2 id="下一步路由">下一步路由</h2>
<ul>
<li>上游：<a href="/blog/backend/07-security-data-protection/supply-chain-integrity-and-artifact-trust/" data-link-title="7.12 供應鏈完整性與 Artifact 信任" data-link-desc="定義 build provenance、artifact 信任與交付鏈風險問題">7.12 供應鏈完整性與 Artifact 信任</a></li>
<li>平行：<a href="/blog/backend/07-security-data-protection/vendors/snyk/" data-link-title="Snyk" data-link-desc="跨 SCM 多模組 application security platform：Open Source (SCA) &#43; Code (SAST) &#43; Container &#43; IaC &#43; Cloud (CSPM)、Reachability analysis">Snyk</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>、<a href="/blog/backend/07-security-data-protection/vendors/dependabot/" data-link-title="Dependabot" data-link-desc="GitHub 原生依賴更新自動化、Version Update &#43; Security Update &#43; Alerts、Grouped Updates 減 PR noise、Auto-merge 配 branch protection">Dependabot</a>、<a href="/blog/backend/07-security-data-protection/vendors/syft-grype/" data-link-title="Syft &#43; Grype" data-link-desc="Anchore 開源姐妹工具：Syft 產 SBOM (CycloneDX / SPDX) &#43; Grype scan 漏洞、Unix philosophy、cosign attestation 整合">Syft + Grype</a>（SBOM 走 SARIF 進 GHAS Code Scanning 是常見組合）</li>
<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.6 秘密管理與機器憑證治理</a>（Secret Scanning 配 <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）</li>
<li>跨類：<a href="/blog/backend/07-security-data-protection/detection-coverage-and-signal-governance/" data-link-title="7.13 偵測覆蓋率與訊號治理" data-link-desc="定義偵測覆蓋、訊號品質與誤報成本的治理問題">7.13 偵測覆蓋率與訊號治理</a>（GHAS alert 進 SIEM 的 routing）</li>
<li>跨模組：<a href="/blog/backend/08-incident-response/vendors/" data-link-title="事故處理 Vendor 清單" data-link-desc="規劃 on-call、incident response、status page 與 postmortem 工具的服務頁撰寫順序與判準">8 事故處理 vendor 清單</a>（leaked secret / SAST critical finding 進 IR 流程）</li>
<li>官方：<a href="https://docs.github.com/en/get-started/learning-about-github/about-github-advanced-security">GitHub Advanced Security Documentation</a></li>
</ul>
]]></content:encoded></item><item><title>Snyk</title><link>https://tarrragon.github.io/blog/backend/07-security-data-protection/vendors/snyk/</link><pubDate>Mon, 18 May 2026 00:00:00 +0000</pubDate><guid>https://tarrragon.github.io/blog/backend/07-security-data-protection/vendors/snyk/</guid><description>&lt;p>Snyk 是 &lt;em>developer-first&lt;/em> 的 &lt;em>跨 SCM 多模組 application security platform&lt;/em>、把 SCA、SAST、Container scan、IaC scan、CSPM 整合到一個 dashboard、五大模組共用同一套 Project / Issue / Fix 模型。流量打到 GitHub / GitLab / Bitbucket / Azure Repos 任一 SCM、Snyk 拉取 repo、按 manifest 建 Project、發現 Issue 後送 PR 修補。跟 &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 深度整合">GitHub Advanced Security&lt;/a> 比、Snyk &lt;em>跨 SCM&lt;/em> 跟 &lt;em>跨技術棧&lt;/em>；跟 &lt;a href="https://tarrragon.github.io/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 &amp;#43; Secret &amp;#43; License &amp;#43; SBOM、Apache 2.0、CI 友善">Trivy&lt;/a> 比、Snyk 是商業 SaaS、覆蓋面更廣、但年費按 Project 計價。&lt;/p>
&lt;h2 id="服務定位">服務定位&lt;/h2>
&lt;p>Snyk 的核心定位是 &lt;em>用一個工具一個 dashboard 同時管 SCA + SAST + IaC + Container + Cloud&lt;/em>。五大模組 — &lt;em>Snyk Open Source&lt;/em>（SCA、依賴漏洞）、&lt;em>Snyk Code&lt;/em>（SAST）、&lt;em>Snyk Container&lt;/em>（image scan）、&lt;em>Snyk IaC&lt;/em>（Terraform / CloudFormation / K8s manifest 安全）、&lt;em>Snyk Cloud&lt;/em>（CSPM、雲端配置 drift）— 共用 Project / Target / Organization / Issue 模型、Issue 跨模組可一起 prioritize。對 &lt;em>多 SCM + 多技術棧&lt;/em> 的組織、Snyk 比拼裝 GHAS + Trivy + Dependabot 更整合。&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 深度整合">GitHub Advanced Security&lt;/a> 的核心差異是 &lt;em>部署模型跟 SCM 範圍&lt;/em>：GHAS 綁 GitHub、走 GitHub Actions、PR 整合更深（Code Scanning alert 直接顯示在 PR review）；Snyk 走 SaaS、SCM 中立、但需要 OAuth 連到每個 repo。組織用 GitLab / Bitbucket / Azure Repos 或同時用多種 SCM、Snyk 是天然選擇。&lt;/p></description><content:encoded><![CDATA[<p>Snyk 是 <em>developer-first</em> 的 <em>跨 SCM 多模組 application security platform</em>、把 SCA、SAST、Container scan、IaC scan、CSPM 整合到一個 dashboard、五大模組共用同一套 Project / Issue / Fix 模型。流量打到 GitHub / GitLab / Bitbucket / Azure Repos 任一 SCM、Snyk 拉取 repo、按 manifest 建 Project、發現 Issue 後送 PR 修補。跟 <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 深度整合">GitHub Advanced Security</a> 比、Snyk <em>跨 SCM</em> 跟 <em>跨技術棧</em>；跟 <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> 比、Snyk 是商業 SaaS、覆蓋面更廣、但年費按 Project 計價。</p>
<h2 id="服務定位">服務定位</h2>
<p>Snyk 的核心定位是 <em>用一個工具一個 dashboard 同時管 SCA + SAST + IaC + Container + Cloud</em>。五大模組 — <em>Snyk Open Source</em>（SCA、依賴漏洞）、<em>Snyk Code</em>（SAST）、<em>Snyk Container</em>（image scan）、<em>Snyk IaC</em>（Terraform / CloudFormation / K8s manifest 安全）、<em>Snyk Cloud</em>（CSPM、雲端配置 drift）— 共用 Project / Target / Organization / Issue 模型、Issue 跨模組可一起 prioritize。對 <em>多 SCM + 多技術棧</em> 的組織、Snyk 比拼裝 GHAS + Trivy + Dependabot 更整合。</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 深度整合">GitHub Advanced Security</a> 的核心差異是 <em>部署模型跟 SCM 範圍</em>：GHAS 綁 GitHub、走 GitHub Actions、PR 整合更深（Code Scanning alert 直接顯示在 PR review）；Snyk 走 SaaS、SCM 中立、但需要 OAuth 連到每個 repo。組織用 GitLab / Bitbucket / Azure Repos 或同時用多種 SCM、Snyk 是天然選擇。</p>
<p>跟 <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> 比、Trivy 是 OSS、主 container + IaC、適合 CI 內 self-hosted；Snyk 商業 SaaS、覆蓋更廣（含 SAST 跟 Reachability）、適合 <em>組織級 governance + 跨團隊統一 dashboard</em>。Trivy 是 <em>跑工具</em>、Snyk 是 <em>買治理</em>。</p>
<p>關鍵張力：Snyk 的 <em>Project 是計費單位</em>。每個 manifest 算一個 Project（一個 repo 有 package.json + requirements.txt + Dockerfile = 3 Project）。大 monorepo 容易暴量、需要 <em>project filter / archive</em> 治理、否則年費失控。</p>
<h2 id="本章目標">本章目標</h2>
<p>讀完本頁、讀者能判斷：</p>
<ol>
<li>Snyk 五大模組在 application security stack 承擔哪一段、哪些靠其他工具</li>
<li>Project 計費模型、monorepo 跟 multi-manifest repo 的 Project 暴量風險跟治理路徑</li>
<li>Reachability analysis 的價值跟限制、何時減 noise、何時被誤判</li>
<li>何時用 Snyk、何時走 <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</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> / <a href="/blog/backend/07-security-data-protection/vendors/dependabot/" data-link-title="Dependabot" data-link-desc="GitHub 原生依賴更新自動化、Version Update &#43; Security Update &#43; Alerts、Grouped Updates 減 PR noise、Auto-merge 配 branch protection">Dependabot</a> 的取捨</li>
</ol>
<h2 id="最短判讀路徑">最短判讀路徑</h2>
<p>判斷 Snyk 配置是否健康、最少看四件事：</p>
<ul>
<li><strong>誰能 enable Snyk</strong>：Organization 的 admin / collaborator role 配置、Service Account token scope（不要用 personal API token 跑 CI、用 Service Account + scoped token）、Audit Log 是否同步到 SIEM</li>
<li><strong>Project import 治理</strong>：每個 SCM target 自動 import 哪些 manifest、是否有 <em>project filter</em> 排除 test fixture / vendored dependency、archived project 是否真的不計費、monorepo 是否走 <em>.snyk policy file</em> 控制</li>
<li><strong>Reachability analysis 是否啟用</strong>：Snyk Code + Open Source 整合、call graph 分析「我的 code 真的呼叫到 vulnerable 函式嗎」— 大幅減少 <em>transitive dep 但 unreachable</em> 的 noise、production 應該啟用</li>
<li><strong>SBOM export 是否走 release pipeline</strong>：CycloneDX / SPDX 格式是否定期匯出、是否進 <a href="/blog/backend/07-security-data-protection/supply-chain-integrity-and-artifact-trust/" data-link-title="7.12 供應鏈完整性與 Artifact 信任" data-link-desc="定義 build provenance、artifact 信任與交付鏈風險問題">supply chain integrity</a> 流程、合規要求（EO 14028 / NIS2）是否覆蓋</li>
</ul>
<p>四件事任一缺失、就是 <a href="/blog/backend/knowledge-cards/audit-log/" data-link-title="Audit Log" data-link-desc="說明高風險操作如何留下可追溯、可稽核的紀錄">Audit Log</a> 與 supply chain 治理邊界的待補項目。</p>
<h2 id="日常操作與決策形狀">日常操作與決策形狀</h2>
<p><strong>Project / Target / Organization 模型</strong>：<em>Organization</em> 是計費跟 RBAC 邊界、對應一個團隊或一個 BU。<em>Target</em> 是一個 SCM 來源（一個 GitHub repo / 一個 container registry image / 一個 Terraform stack）。<em>Project</em> 是 Target 內的單一掃描單位（一個 manifest 或一個 image tag）。Issue 是發現的漏洞 / license / misconfig、有 severity（Critical / High / Medium / Low）、CVSS、exploit maturity、fix availability。Project 暴量的根因通常是 monorepo 內 nested manifest 全被 auto-import、用 <code>.snyk</code> 或 import filter 排除。</p>
<p><strong>五大模組分工</strong>：<em>Snyk Open Source</em>（SCA）掃 package manifest（npm、pip、Maven、Go modules、Composer、NuGet 等 20+ 生態）對 Snyk Vulnerability DB（自家維護、補強 NVD 延遲）。<em>Snyk Code</em>（SAST）掃源碼、symbolic execution + ML、覆蓋 OWASP Top 10 跟 CWE。<em>Snyk Container</em> 掃 image base layer + installed package、支援 Docker / OCI / ECR / GCR / Harbor。<em>Snyk IaC</em> 掃 Terraform / CloudFormation / K8s YAML / Helm chart 對 CIS Benchmark + custom policy。<em>Snyk Cloud</em>（2023 收購 Fugue 後加入）是 CSPM、scan AWS / Azure / GCP runtime 配置 + IaC drift detection（cloud 實際狀態 vs Terraform 狀態的差異）。</p>
<p><strong>Snyk Code (SAST) vs GHAS CodeQL</strong>：Snyk Code 走 <em>快速 inline scan</em>（秒級回饋、走 cloud inference）、適合 dev loop；CodeQL 走 <em>深度 dataflow query</em>（分鐘級、執行更慢但表達力更強）、適合 release gate。同時用兩者並不矛盾 — Snyk Code 在 IDE / PR 給快速訊號、CodeQL 在 release 前跑深度檢查。</p>
<p><strong>Reachability analysis</strong>：跟 <em>純 dependency list 比對 CVE</em> 不同、Snyk 結合 Snyk Code (SAST) 跟 Snyk Open Source (SCA)、做 <em>call graph 分析</em>、判斷「我的 code 是否真的呼叫到 vulnerable 函式」。實務影響：多數 transitive dependency 的 CVE 在你的 app 內 <em>不 reachable</em>（你引入的 lib 沒呼叫到那條 path）— Reachability 過濾後、可以從 <em>幾百個 Critical / High</em> 降到 <em>幾個真的 exploitable</em>。限制：只支援部分語言（Java / JS / Python / Go 較完整）、且 dynamic dispatch / reflection / runtime plugin load 會被當成 reachable（false positive）或 unreachable（false negative）— 不可全信、是 <em>prioritization signal</em> 不是 <em>binary verdict</em>。</p>
<p><strong>Fix advice / Auto PR</strong>：發現 vuln 後、Snyk 自動發 PR 升級到 <em>最小 fix version</em>（包含 transitive dep 的 root cause upgrade）。跟 <a href="/blog/backend/07-security-data-protection/vendors/dependabot/" data-link-title="Dependabot" data-link-desc="GitHub 原生依賴更新自動化、Version Update &#43; Security Update &#43; Alerts、Grouped Updates 減 PR noise、Auto-merge 配 branch protection">Dependabot</a> 功能重疊、差異是 Snyk 跨 SCM（不只 GitHub）、且 fix advice 含 Reachability 標註（reachable vuln 的 PR 優先級高）。重複用兩者要關掉其一、否則 PR 量翻倍。</p>
<p><strong>跟 CI 整合</strong>：<code>snyk</code> CLI（<code>snyk test</code> / <code>snyk monitor</code> / <code>snyk container test</code> / <code>snyk iac test</code>）走 SNYK_TOKEN 環境變數、可在任何 CI 跑。官方 Snyk Action（GitHub Actions）跟 Jenkins / GitLab CI / CircleCI plugin 是 wrapper。release gate 推薦在 build 後跑 <code>snyk test --severity-threshold=high --fail-on=upgradable</code>、只擋 <em>可升級</em> 的 high+ vuln（無 fix 的 vuln 阻塞 release 沒意義、走 <em>.snyk policy</em> 暫時 ignore + alert）。</p>
<p><strong>SBOM export</strong>：<code>snyk sbom --format=cyclonedx1.4+json</code> / <code>--format=spdx2.3+json</code> 產 SBOM、支援 Snyk attestation（signed SBOM）。近年 supply chain compliance（US EO 14028、EU NIS2 / CRA）要求 SBOM、Snyk 是自動產線之一。SBOM 應該在 <em>release artifact 旁</em> 一起發布、走 <a href="/blog/backend/07-security-data-protection/supply-chain-integrity-and-artifact-trust/" data-link-title="7.12 供應鏈完整性與 Artifact 信任" data-link-desc="定義 build provenance、artifact 信任與交付鏈風險問題">supply chain integrity</a> 流程。</p>
<p><strong>License compliance</strong>：除了漏洞、Snyk 也掃 dependency license（GPL / AGPL / LGPL / proprietary / unknown）、可設 <em>license policy</em>（allow / disallow / require-review）、PR 引入違規 license 直接 fail check。對需要避開 copyleft license 的商業產品、license scan 跟 vulnerability scan 一樣關鍵。</p>
<p><strong>API token 治理</strong>：CI / 第三方 integration 用 <em>Service Account + scoped token</em>（限 Organization、限 permission）、不要用個人 personal token（離職就失效）。Token 進 <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> / <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>、定期 rotate。</p>
<h2 id="核心取捨表">核心取捨表</h2>
<table>
  <thead>
      <tr>
          <th>取捨維度</th>
          <th>Snyk</th>
          <th>GitHub Advanced Security</th>
          <th>Trivy</th>
      </tr>
  </thead>
  <tbody>
      <tr>
          <td>部署模型</td>
          <td>商業 SaaS</td>
          <td>GitHub 整合 SaaS</td>
          <td>OSS、self-hosted CLI</td>
      </tr>
      <tr>
          <td>SCM 範圍</td>
          <td>跨 SCM（GitHub / GitLab / Bitbucket / Azure Repos）</td>
          <td>GitHub only</td>
          <td>SCM 無關（CI / local 跑）</td>
      </tr>
      <tr>
          <td>SCA</td>
          <td>Snyk Open Source（含 Reachability）</td>
          <td>Dependabot（純 manifest 比對）</td>
          <td>是、限 OS package + language package</td>
      </tr>
      <tr>
          <td>SAST</td>
          <td>Snyk Code（fast inline）</td>
          <td>CodeQL（dataflow query）</td>
          <td>否</td>
      </tr>
      <tr>
          <td>Container scan</td>
          <td>Snyk Container</td>
          <td>透過 Dependabot + 第三方</td>
          <td>Trivy Container（主打）</td>
      </tr>
      <tr>
          <td>IaC scan</td>
          <td>Snyk IaC</td>
          <td>透過 Code Scanning + KICS / Checkov</td>
          <td>Trivy Config（主打）</td>
      </tr>
      <tr>
          <td>CSPM</td>
          <td>Snyk Cloud</td>
          <td>無</td>
          <td>無</td>
      </tr>
      <tr>
          <td>Reachability</td>
          <td>有（限部分語言）</td>
          <td>部分 CodeQL query 有</td>
          <td>無</td>
      </tr>
      <tr>
          <td>Auto-fix PR</td>
          <td>Snyk PR + fix advice</td>
          <td>Dependabot PR</td>
          <td>無</td>
      </tr>
      <tr>
          <td>計費模型</td>
          <td>按 Project（manifest）數</td>
          <td>GitHub seat-based</td>
          <td>免費</td>
      </tr>
      <tr>
          <td>學習曲線</td>
          <td>中 — UI 友善、CLI 直觀</td>
          <td>低 — 跟 GitHub 一體</td>
          <td>低 — 單一 binary、CLI 為主</td>
      </tr>
      <tr>
          <td>適合場景</td>
          <td>多 SCM + 多 stack + 想統一 dashboard</td>
          <td>純 GitHub + 想跟 PR 深整合</td>
          <td>純 container / IaC + 想 OSS + 預算敏感</td>
      </tr>
  </tbody>
</table>
<p>選 Snyk 的核心訴求：<em>組織用多個 SCM 或多技術棧（後端 + 前端 + container + Terraform + cloud）</em> + 需要 <em>統一 dashboard + 跨團隊 prioritization</em> + 接受按 Project 計費的成本。純 GitHub 組織用 GHAS 更整合、純 container CI 用 Trivy 免費、極大型 monorepo 用 Snyk 容易爆 Project 數要小心。</p>
<h2 id="進階主題">進階主題</h2>
<p><strong>Snyk Cloud (CSPM) 跟 IaC drift detection</strong>：Snyk Cloud 連 AWS / Azure / GCP read-only role、掃 runtime 配置（S3 bucket public、IAM over-permission、security group 0.0.0.0/0）對 CIS Benchmark + custom policy。跟 <em>Snyk IaC</em> 結合做 <em>drift detection</em> — Terraform 內定義是 private bucket、但 cloud 實際是 public（有人 console 手改）、Snyk 報 drift。對標 <a href="https://www.wiz.io/">Wiz</a> / Prisma Cloud / Lacework、Snyk Cloud 是 <em>跟 Snyk IaC 同源治理</em> 的優勢（同個 dashboard 看 IaC + runtime）。</p>
<p><strong>Custom Rule（Snyk IaC custom policy）</strong>：Snyk IaC 預設規則庫覆蓋 CIS Benchmark + AWS / GCP / Azure 最佳實踐、可寫 <em>custom policy</em>（Rego-like / SnykIQL）擴展。例：禁止 RDS 沒開 encryption-at-rest、禁止 S3 沒 versioning、禁止 K8s pod 跑 hostNetwork。Custom policy 走版控（git）跟 PR review、避免在 console 直接改。</p>
<p><strong>Reachability vs 純 static SCA</strong>：純 SCA（如 Dependabot / Trivy）只看 <em>manifest 中聲明的版本是否有 CVE</em>、不分 reachable / unreachable。結果是 Critical / High alert 大量、開發者 <em>alert fatigue</em> 後直接 ignore。Snyk Reachability 用 SAST + SCA 整合做 call graph、過濾掉 <em>vulnerable lib 載入了但 vulnerable 函式從未被呼叫</em> 的案例。限制：dynamic dispatch / reflection / 動態載入 plugin / native binding 都會讓 reachability 判斷失準、不可當成 binary truth。</p>
<p><strong>Snyk Insights（風險優先級 prioritization）</strong>：除了 CVSS、Snyk 加入 <em>exploit maturity</em>（exploit in-the-wild / PoC / no known exploit）、<em>fix availability</em>（有無 fix version）、<em>social trend</em>（CVE 被討論度）、<em>Reachability</em> 綜合算 <em>Priority Score</em>。production 用 Priority Score 排 backlog、而非單純 CVSS — 一個 <em>Critical 但 unreachable + no fix</em> 的 vuln 不該擋 release。</p>
<p><strong>SBOM 流程整合</strong>：把 <code>snyk sbom</code> 接到 CI release step、SBOM artifact 跟 release binary 一起進 registry / object store、走 <a href="https://in-toto.io/">in-toto attestation</a> 或 <a href="https://slsa.dev/">SLSA</a> provenance 流程、合規時可回溯。跟 <a href="/blog/backend/07-security-data-protection/vendors/syft-grype/" data-link-title="Syft &#43; Grype" data-link-desc="Anchore 開源姐妹工具：Syft 產 SBOM (CycloneDX / SPDX) &#43; Grype scan 漏洞、Unix philosophy、cosign attestation 整合">Syft + Grype</a> 流程的差異：Syft + Grype 是 OSS local-first + Unix philosophy、Snyk 是 SaaS、SBOM 含 Snyk Issue ID 跟 fix advice link。</p>
<p><strong>License policy enforcement</strong>：除了 vulnerability、license 違規（GPL / AGPL 引入到 proprietary product、unknown license dep）走同套 policy / PR fail-check 機制、production 應該把 license policy 跟 vulnerability policy 並列當 release gate。</p>
<h2 id="排錯與失敗快速判讀">排錯與失敗快速判讀</h2>
<ul>
<li><strong>Project 暴量計費</strong>：monorepo 自動 import 把 test fixture / node_modules-vendored 全當 Project — 用 <em>.snyk</em> 跟 import filter 排除、archived project 確認真的不計費</li>
<li><strong>Reachability 漏判 / 誤判</strong>：dynamic dispatch / reflection / plugin load 讓 call graph 失準、Critical vuln 被標 unreachable 但實際 reachable — 對 framework-heavy code（Spring / Django middleware / Rails initializer）保守處理、不全信 Reachability</li>
<li><strong>PR noise</strong>：Snyk + Dependabot 同時開、依賴升級 PR 翻倍 — 二選一、或讓 Snyk 處理 vuln-driven upgrade、Dependabot 處理 routine version bump</li>
<li><strong>CI fail-on 設不對</strong>：<code>--severity-threshold=low</code> 把 release 整個擋死 / <code>--severity-threshold=critical</code> 漏 high — production 通常 <code>--severity-threshold=high --fail-on=upgradable</code>、再用 <code>.snyk</code> policy file 例外管理</li>
<li><strong>License check 誤殺</strong>：transitive dep 引入 LGPL 被當 GPL 阻擋 — 細分 license policy（allow LGPL-with-dynamic-linking、disallow GPL）、走 review workflow 而非 fail-fast</li>
<li><strong>API token over-scoped</strong>：CI 拿到 admin-level Service Account token、整 org Project 都能改 — 改 scoped token、限 Organization + 限 permission、進 <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>SBOM 沒進 release pipeline</strong>：SBOM 只在 Snyk dashboard、release artifact 沒附 — 把 <code>snyk sbom</code> 加進 CI release step、SBOM 跟 binary 一起發</li>
<li><strong>Snyk Cloud drift 沒人看</strong>：CSPM alert 進 dashboard 但沒 routing 到 on-call — 接 <a href="/blog/backend/07-security-data-protection/vendors/" data-link-title="資安與資料保護 Vendor 清單" data-link-desc="規劃身份、秘密、金鑰、入口防護、供應鏈與偵測工具的服務頁撰寫順序與教學大綱">SIEM</a> / Slack / PagerDuty、高 severity drift 觸發 ticket</li>
</ul>
<h2 id="何時改走其他服務">何時改走其他服務</h2>
<table>
  <thead>
      <tr>
          <th>需求形狀</th>
          <th>改走</th>
      </tr>
  </thead>
  <tbody>
      <tr>
          <td>純 GitHub + 想跟 PR / Action 深整合</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 深度整合">GitHub Advanced Security</a></td>
      </tr>
      <tr>
          <td>純 container / IaC + OSS + 預算敏感</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></td>
      </tr>
      <tr>
          <td>純 dependency 升級（routine version bump）</td>
          <td><a href="/blog/backend/07-security-data-protection/vendors/dependabot/" data-link-title="Dependabot" data-link-desc="GitHub 原生依賴更新自動化、Version Update &#43; Security Update &#43; Alerts、Grouped Updates 減 PR noise、Auto-merge 配 branch protection">Dependabot</a></td>
      </tr>
      <tr>
          <td>Secret scanning（leaked API key in repo）</td>
          <td>GitGuardian / Gitleaks（Snyk 不主打）</td>
      </tr>
      <tr>
          <td>Runtime container threat detection</td>
          <td>Falco / Cilium Tetragon</td>
      </tr>
      <tr>
          <td>深度 SAST（dataflow query / taint analysis）</td>
          <td>CodeQL / Semgrep（Snyk Code 偏 fast inline、深度查走 CodeQL）</td>
      </tr>
      <tr>
          <td>CSPM 跨 multi-cloud + asset inventory</td>
          <td>Wiz / Prisma Cloud / Lacework（Snyk Cloud 較新、功能仍在追）</td>
      </tr>
  </tbody>
</table>
<h2 id="不在本頁內的主題">不在本頁內的主題</h2>
<ul>
<li>Snyk 完整 pricing tier（Team / Business / Enterprise）跟 Project 計費細節</li>
<li>Snyk Vulnerability DB 跟 NVD / GHSA 的覆蓋差異對照</li>
<li>Snyk Code SAST 規則完整 reference</li>
<li>Snyk IaC 內建 policy 完整列表 + CIS Benchmark 對照</li>
<li>Snyk Cloud 多雲 onboarding 步驟（AWS / Azure / GCP read-only role 設置）</li>
</ul>
<h2 id="案例回寫">案例回寫</h2>
<p>Snyk 在 07 案例庫沒有直接 vendor-level 事件、但多個 supply chain 案例展示 Snyk 工具能力的 <em>範圍跟邊界</em>：</p>
<table>
  <thead>
      <tr>
          <th>案例</th>
          <th>跟 Snyk 的關係</th>
      </tr>
  </thead>
  <tbody>
      <tr>
          <td><a href="/blog/backend/07-security-data-protection/red-team/cases/supply-chain/log4shell-cve-2021-44228-component-chain/" data-link-title="7.R7.2.7 Log4Shell 2021：共用元件風險與修補鏈" data-link-desc="共用元件漏洞如何同步影響多服務，並迫使團隊建立依賴治理 workflow">Log4Shell CVE-2021-44228</a></td>
          <td>對照啟示 — Reachability analysis 能快速回答「我的 service 是否真用到 vulnerable JndiLookup」、減少 emergency triage 的 noise</td>
      </tr>
      <tr>
          <td><a href="/blog/backend/07-security-data-protection/red-team/cases/supply-chain/xz-backdoor-2024-open-source-supply-chain/" data-link-title="7.R7.2.4 XZ Backdoor 2024：開源供應鏈長期滲透" data-link-desc="開源維護鏈遭滲透後，為何會直接影響廣泛 Linux 發行流程">XZ Backdoor 2024 Open Source Supply Chain</a></td>
          <td>對照啟示 — Snyk 看 package version + CVE、看不到 maintainer takeover；需補 release-tarball 比對 + maintainer trust signal</td>
      </tr>
      <tr>
          <td><a href="/blog/backend/07-security-data-protection/red-team/cases/supply-chain/3cx-2023-desktopapp-supply-chain/" data-link-title="7.R7.2.8 3CX 2023：桌面軟體更新鏈攻擊" data-link-desc="合法更新流程被植入後，桌面端供應鏈事件如何傳到企業端點">3CX 2023 Desktop App Supply Chain</a></td>
          <td>對照啟示 — Snyk Container 看 image 內 package CVE、看不到 update channel 被植入；需配合 artifact provenance / SLSA</td>
      </tr>
      <tr>
          <td><a href="/blog/backend/07-security-data-protection/supply-chain-integrity-and-artifact-trust/" data-link-title="7.12 供應鏈完整性與 Artifact 信任" data-link-desc="定義 build provenance、artifact 信任與交付鏈風險問題">7.12 供應鏈完整性與 Artifact 信任</a></td>
          <td>章節對應 — Snyk SBOM + License policy 是 supply chain governance 的工具、合規門檻（EO 14028 / NIS2）的標準產線之一</td>
      </tr>
  </tbody>
</table>
<h2 id="下一步路由">下一步路由</h2>
<ul>
<li>上游：<a href="/blog/backend/07-security-data-protection/supply-chain-integrity-and-artifact-trust/" data-link-title="7.12 供應鏈完整性與 Artifact 信任" data-link-desc="定義 build provenance、artifact 信任與交付鏈風險問題">7.12 供應鏈完整性與 Artifact 信任</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 深度整合">GitHub Advanced Security</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>、<a href="/blog/backend/07-security-data-protection/vendors/dependabot/" data-link-title="Dependabot" data-link-desc="GitHub 原生依賴更新自動化、Version Update &#43; Security Update &#43; Alerts、Grouped Updates 減 PR noise、Auto-merge 配 branch protection">Dependabot</a></li>
<li>下游：<a href="/blog/backend/07-security-data-protection/data-protection-and-masking-governance/" data-link-title="7.4 資料保護與遮罩治理" data-link-desc="以問題驅動方式整理資料分級、遮罩、匯出與備份治理">7.4 資料保護與遮罩治理</a>（vuln 阻擋不完全時、資料層也要遮罩）</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>、<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>（Snyk API token 存放）</li>
<li>跨模組：<a href="/blog/backend/08-incident-response/vendors/" data-link-title="事故處理 Vendor 清單" data-link-desc="規劃 on-call、incident response、status page 與 postmortem 工具的服務頁撰寫順序與判準">8 事故處理 vendor 清單</a>（Critical CVE 揭露時的 emergency triage routing）</li>
<li>官方：<a href="https://docs.snyk.io/">Snyk Documentation</a></li>
</ul>
]]></content:encoded></item></channel></rss>