[actions] Alternate actions/checkout paths suppress untrusted-checkout alerts
還沒有人認領這個 Issue。
評估
研究方向
從 actions/ql/lib/codeql/actions/security/UntrustedCheckoutQuery.qll 中的 ActionsMutableRefCheckout.getPath() 和 ActionsSHACheckout.getPath() 開始,然後將它們與 PoisonableSteps.qll 中的 LocalScriptExecutionRunStep.getPath() 進行比較。使用連結的 reproducer 驗證目前的不一致,為列出的路徑形式新增回歸涵蓋,並確認 Critical 和 High 查詢都會回報替代路徑的案例,而 immutable checkout 仍不會被回報。
由索引模型根據 Issue 內容生成。
描述
Description of the issue
actions/untrusted-checkout/critical does not report a privileged workflow that checks out an untrusted PR into a non-default path: and then executes a script or local action from that checkout. The actions/untrusted-checkout/high fallback is also suppressed, so neither query reports the workflow.
Minimal reproducer
on: pull_request_target
permissions:
contents: write
jobs:
execute:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
with:
repository: ${{ github.event.pull_request.head.repo.full_name }}
ref: ${{ github.event.pull_request.head.sha }}
path: candidate
- run: bash candidate/proof.sh
actions/checkout places path: candidate under $GITHUB_WORKSPACE, so this executes the same checked-out script relationship as a default checkout followed by bash proof.sh.
Reproduction
The complete reproducer is in public fork PR #1.
- Latest-release fork CI: CodeQL Action 4.37.1, CLI 2.26.1,
codeql/actions-queries0.6.31 - Current-main CI: queries compiled directly from
github/codeql@14450f5bf38ea9a3ce2e0e45dcf51c0bbdd01af5
Both successful runs scanned all 11 workflow files and produced the same result matrix:
| Case | Result |
|---|---|
Default checkout followed by bash proof.sh |
actions/untrusted-checkout/critical |
Default checkout followed by uses: ./.github/actions/proof |
actions/untrusted-checkout/critical |
Default checkout with quoted or $GITHUB_WORKSPACE script paths |
actions/untrusted-checkout/critical |
path: candidate, ./candidate, or candidate/ followed by the corresponding script |
no critical or high alert |
path: candidate followed by uses: ./candidate/.github/actions/proof |
no critical or high alert |
| Immutable checkout control | no critical or high alert |
The CI also executed harmless script and composite-action canaries through the tested paths before analysis.
Expected result
The alternate-path cases should be reported by actions/untrusted-checkout/critical, like their default-path controls. A path-representation mismatch should not suppress both the critical query and its high fallback.
Source-level cause
At current main:
ActionsMutableRefCheckout.getPath()andActionsSHACheckout.getPath()return explicit checkout paths verbatim.LocalScriptExecutionRunStep.getPath()and local-action paths are normalized intoGITHUB_WORKSPACE/...form.- The critical query compares those representations with
isSubpath, while the high query suppresses its fallback because the following step is still aPoisonableStep.
Normalizing explicit actions/checkout paths at the checkout model, with regression tests for bare, dot-relative, trailing-slash, and local-action forms, appears to be the smallest fix.
- 主要語言
- CodeQL
- 星號
- 10.1k
- 分支
- 2.1k
- 平均合併
- 2 天 10 小時
- 30 天內合併 PR
- 134
貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
github/codeql 的其他 Issue
-
難度 2/5 1-3 小時 新手友好度 84/100
-
難度 2/5 1-3 小時 新手友好度 82/100
-
難度 2/5 1-3 小時 新手友好度 78/100
-
false-positive
難度 2/5 1-3 小時 新手友好度 70/100
-
false-positive
難度 3/5 1-2 天 新手友好度 68/100
相似的 Issue
-
kind/bug needs-triage
難度 1/5 1 小時以內 新手友好度 72/100
matrixorigin/matrixone#29223 ·
-
難度 2/5 1-3 小時 新手友好度 84/100
copse-dev/agent-pane#2953 ·
-
bug ci-failure high priority
難度 2/5 1-3 小時 新手友好度 74/100
vllm-project/vllm-omni#7972 · 1 則留言 ·
-
難度 2/5 1-3 小時 新手友好度 90/100
simonw/sqlite-utils#872 ·
-
bug good first issue
難度 1/5 1 小時以內 新手友好度 88/100
amponce/archive-movie-browser#166 ·