Flowcheck

io.github.CloudCorpRecords由 GitHub 帳號 CloudCorpRecords 發布v0.1.2更新於 Oct 29, 2026

Least-privilege auditor for GitHub Actions workflows: permissions, triggers, secrets.

已驗證STDIO僅桌面開發者工具安全與監控

概覽

AI 產生的概覽

靜態稽核 GitHub Actions 工作流程檔案的最小權限問題,並提出依作業強化的權限設定建議。

可以做什麼
  • 稽核工作流程:掃描儲存庫路徑下的所有工作流程,檢查缺少或 write-all 權限、作業授權過寬、危險觸發條件搭配檢出 PR 標頭、PR 執行中使用密鑰、自架 PR 執行器、快取投毒、成品上傳及可重複使用工作流程呼叫等問題,並附上檔案、作業與行號證據。
  • 產生強化方案:推斷每個作業的步驟實際需要的權限,輸出逐作業權限區塊與頂層合併區塊。
  • 給出結論:以 EXPOSED、REVIEW 或 HARDENED 及各等級問題數量回傳 JSON 報告。
適用情境
適合在審查或參與使用 GitHub Actions 的儲存庫時,於合併前對權杖權限與觸發條件形態做靜態、唯讀的檢查,或需要可直接貼上的逐作業最小權限設定。
執行需求
透過 npx 或 Docker 映像以 stdio 在本機執行。稽核不需憑證與網路,只讀取本機儲存庫路徑下的工作流程 YAML。限制:每次最多 500 個工作流程檔案,單一檔案最大 2 MiB。
安裝前請注意
檢查結果與強化方案皆為啟發式:不追蹤未知第三方 action、本機複合 action 與 github-script 步驟,也不辨識間接的 PR 標頭檢出,方案需人工複核。它只讀取本機檔案、不寫入任何內容,但報告內容會回傳給助理。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 Flowcheck,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。

其他 MCP 客戶端

參照 儲存庫 中的啟動說明。

README

flowcheck

The default GitHub token can write to your repo. Most workflows never check.

Every GitHub Actions workflow runs with a GITHUB_TOKEN. Repos created with legacy settings give that token write access to nearly everything, and a workflow with no permissions: block inherits whatever the repo default is. Add the trigger shapes that check out pull request code inside a privileged context, secrets passed wholesale to reusable workflows, and caches written by PR runs and read back by release runs, and the workflow file itself becomes the attack surface. The 2025 tj-actions compromise showed how fast a trusted action can turn; "pwn request" write-ups have shown the same for pull_request_target checkouts of PR heads for years.

flowcheck audits every workflow in a repo for least-privilege problems, shows the evidence per file, job, and line, and emits a hardened permissions block per job, inferred from what the job's steps actually do, that you can paste in.

Why this exists

GitHub Actions are the second largest confirmed open source supply-chain attack surface of the last year, behind only npm. The failures are rarely exotic: a missing permissions block, one write-all, a checkout of ${{ github.event.pull_request.head.sha }} under pull_request_target, a self-hosted runner answering PR triggers. All of them are visible in the YAML, statically, before anything runs. flowcheck reads the YAML with a real parser (anchors, merge keys, and block scalars included), never executes anything in the scanned repo, and is callable by agents through MCP so the audit can run inside contribution and release workflows, not just by hand.

Sibling tools ask different questions: actionpin asks whether action refs are pinned to SHAs. flowcheck asks whether permissions and triggers are least-privilege. They share no code.

What it checks

ruleseveritywhat it means
FC-PERMS-WRITE-ALLcritical (top level), high (job)permissions: write-all, every scope writable by the token.
FC-PR-HEAD-CHECKOUTcriticalpull_request_target, workflow_run, or issue_comment trigger combined with a checkout whose ref points at the PR head. Privileged context, untrusted code.
FC-NO-TOP-PERMISSIONShigh or mediumNo top-level permissions: block. Jobs inherit the repo default token, which is write-all on many repos.
FC-JOB-GRANT-BROADmedium (high for id-token)A job (or the top-level block it inherits) grants a write scope no step in the job needs, judged against the inferred needs.
FC-SECRETS-INHERIThigh or mediumA reusable workflow call passes secrets: inherit, handing every repo secret to the called workflow.
FC-REUSABLE-MISSINGhighA job calls a local reusable workflow (./.github/workflows/...) that does not exist in the estate. GitHub fails the caller at runtime.
FC-REUSABLE-NOT-CALLABLEhighA job calls a local workflow as reusable, but that file declares no workflow_call trigger, so it cannot be called.
FC-REUSABLE-INPUTSmediumA caller passes an input the callee does not declare in workflow_call inputs, or omits a required input that has no default.
FC-REUSABLE-SECRETSmediumA caller does not pass a secret the callee declares required: true in workflow_call secrets (and does not use secrets: inherit).

Reusable graph checks resolve local calls only: a remote reusable call (owner/repo/.github/workflows/... at a ref) cannot be read from the local estate and is not flagged by the graph rules. | FC-SELF-HOSTED-PR | high | A self-hosted runner in a workflow with PR-reachable triggers. Fork code on your machine and your network. | | FC-SECRETS-ON-PR | medium | Secret references in a pull_request workflow. Same-repo PR branches run with secrets before merge. | | FC-CACHE-POISON | medium | A cache step under a PR trigger in a workflow that also has a privileged (write) consumer: a poisoned cache entry can execute inside a later privileged run. | | FC-ARTIFACT-WORKSPACE | medium | actions/upload-artifact uploading the whole workspace (path: ., **, or no path), which routinely carries .git, config, and spilled secret material. | | FC-PERMS-READ-ALL | low | permissions: read-all instead of an explicit scope list. | | FC-NO-TIMEOUT | low | A job with no timeout-minutes. The platform default is 360 minutes. | | FC-NO-CONCURRENCY | low | A deploy-shaped job (release, publish, image push, or an environment) with no concurrency guard at job or workflow level. | | FC-DISPATCH-INPUT-INJECTION | low | A workflow_dispatch input interpolated directly into a run step, where free text becomes shell. | | FC-PARSE-ERROR | medium | The workflow YAML does not parse cleanly. |

Verdict rules:

  • EXPOSED: at least one critical or high finding. Exit code 1.
  • REVIEW: only medium or low findings. Exit code 1.
  • HARDENED: no findings. Exit code 0.
  • Usage errors exit with code 2. That includes a target that is not a directory or a single workflow file: a FIFO, a device, a regular non-workflow file, or a nonexistent path gets a stderr error and no verdict, never a HARDENED over zero files. A reader that closes the output pipe early makes the process exit 141, never 0.

The hardened plan

For every job, flowcheck infers the least privilege its steps need:

step shapeinferred grant
actions/checkoutcontents: read
release creation (gh release create, softprops/action-gh-release)contents: write
image push (docker/build-push-action with push, docker push, buildx --push)packages: write
PR writes (gh pr create, gh pr comment, labeler, stale)pull-requests: write
issue writes (gh issue comment and friends)issues: write
Pages deploy (actions/deploy-pages)pages: write, id-token: write
OIDC sign-in (AWS, Azure, Google auth actions, explicit OIDC use in scripts)id-token: write
build provenance (actions/attest-build-provenance)attestations: write, id-token: write
no token use at allpermissions: {}

audit prints the plan next to the findings; harden prints the per-job blocks plus a top-level union block. Nothing is written to your files: the plan is output, you paste it.

Usage

CLI

bash
# Audit the current reponpx @reneturcios/flowcheck audit
# Audit another path, machine readablenpx @reneturcios/flowcheck audit ~/src/my-repo --json
# Just the hardening plannpx @reneturcios/flowcheck harden ~/src/my-repo

Example output:

text
flowcheck audit .: EXPOSED  workflows: 2, jobs: 3, findings: 2 (critical: 1, high: 1, medium: 0, low: 0)  [CRITICAL] .github/workflows/pr.yml:14 FC-PR-HEAD-CHECKOUT (job inspect) Privileged trigger context (pull_request_target) combined with a checkout of the PR head (...)  [HIGH] .github/workflows/pr.yml:1 FC-NO-TOP-PERMISSIONS No top-level permissions block. ...EXPOSED: at least one critical or high finding. ...

Auditing needs no credentials and no network. Estate caps are explicit, never silent: at most 500 workflow files per run and 2 MiB per file, and the report's caps field plus a note say when a cap was hit and what was not scanned.

MCP server

Add to your MCP client config:

json
{  "mcpServers": {    "flowcheck": {      "command": "npx",      "args": ["-y", "@reneturcios/flowcheck", "mcp"]    }  }}

Tools: audit_workflows(path) returns the full audit report as JSON. harden_plan(path) returns the per-job hardened permissions blocks, the top-level union block, and the findings they answer.

Limits, stated plainly

  • Permission inference is heuristic. It recognizes the step shapes in the table above plus common gh CLI and script patterns. An unknown third-party action may need more (or less) than the plan suggests; the plan is a starting point a human reviews, not a proof.
  • Broad-grant findings are calibrated for invisible consumers: when a job contains a step whose token use cannot be seen in the workflow file (an unknown third-party action, a local composite action, or an actions/github-script step, which is arbitrary JavaScript that often delegates to repo files), the finding is reported at low severity with that caveat instead of medium or high. flowcheck does not follow local composite action files or scripts a step delegates to in v0.1.1.
  • The PR-head checkout rule needs an explicit ref expression pointing at the head (pull_request.head, head_ref, workflow_run.head). A checkout with no ref under pull_request_target checks out the base branch, which is the safe shape, and is not flagged. Indirect head checkouts assembled through env vars or outputs are not traced.
  • Self-hosted detection sees the literal self-hosted label in runs-on; runner groups named without the label are not recognized.
  • Reusable workflow jobs are planned from the call site only; the called workflow's own steps are a separate audit target.
  • Matrix-generated jobs are audited as written, once, not per matrix combination.
  • The secrets rule counts references under pull_request; it does not try to prove a specific secret reaches a specific step.

來源:README.md,提交 f4d5a1e

工具

2

audit_workflows

Audit GitHub workflow files under a repo path for least-privilege problems: missing or write-all permissions, per-job grants broader than the job's steps need, pull_request_target or workflow_run or issue_comment triggers combined with a checkout of the PR head, secrets in fork-reachable contexts, secrets: inherit to reusable workflows, self-hosted runners on PR triggers, cache poisoning surface, whole-workspace artifact uploads, missing timeouts, and missing concurrency guards on deploy-shaped jobs. Returns a HARDENED, REVIEW, or EXPOSED verdict with file, job, and line evidence per finding, plus a hardened permissions plan per job.

輸入參數path必填

harden_plan

Build the least-privilege hardening plan for workflows under a repo path without writing any files. For each job, infers the permissions its steps actually need (checkout is contents: read, release creation is contents: write, GHCR push is packages: write, PR comments are pull-requests: write, and so on) and returns a paste-ready permissions block per job plus a top-level union block, with notes where a grant is removed or a privileged trigger shape needs a human decision.

輸入參數path必填

版本歷史

3
  1. v0.1.2最新Oct 26, 2026
  2. v0.1.1Oct 23, 2026
  3. v0.1.0Oct 22, 2026

評分

已滿足適用檢查項的 90%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通25 分
  • 已宣告認證方式10 分

    請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。

  • 已列出工具必需15 分
  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分