[actions] Alternate actions/checkout paths suppress untrusted-checkout alerts
Ninguém assumiu esta issue ainda.
Avaliação
- Dificuldade
- 3/5
- Tempo estimado
- 1-2 dias
- Facilidade para iniciantes
- 68/100
Direção de pesquisa
Comece com ActionsMutableRefCheckout.getPath() e ActionsSHACheckout.getPath() em actions/ql/lib/codeql/actions/security/UntrustedCheckoutQuery.qll e, em seguida, compare-os com LocalScriptExecutionRunStep.getPath() em PoisonableSteps.qll. Use o reproducer vinculado para verificar a discrepância atual, adicione cobertura de regressão para as formas de caminho listadas e confirme que tanto as queries Critical quanto as High relatam os casos de caminhos alternativos, enquanto o checkout imutável continua sem ser relatado.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
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.
- Linguagem predominante
- CodeQL
- Estrelas
- 10.1k
- Forks
- 2.1k
- Merge médio
- 2d 10h
- PRs com merge (30d)
- 134
Guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de github/codeql
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 84/100
-
C#: cs/simplifiable-boolean-expression false positive on Nullable<bool> compared with a literal Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 82/100
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
-
false-positive
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 70/100
-
false-positive
Dificuldade 3/5 1-2 dias Facilidade para iniciantes 68/100
Todas as issues de github/codeql
Issues semelhantes
-
bug carvel-triage
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 88/100
carvel-dev/kapp-controller#1861 ·
-
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 92/100
-
Expose REVIEW_PATH_SPEC as a review.yml input to scope the diff (skip vendored/reference paths) Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 82/100
microsoft/BC-ALAgents#71 ·
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 84/100
-
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 90/100
k3s-io/k3s-ansible#565 ·