Actions: Extractor for external actions and workflows does not take into account the ref
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 5/5
- Tiempo estimado
- Más de una semana
- Aptitud para principiantes
- 45/100
Línea de trabajo
Comienza con la convención .github/actions/external/ y el comportamiento de la biblioteca CodeQL QL descrito para CompositeActionImpl.getResolvedPath(). Rastrea cómo se comparan los valores de uses: como actions/checkout@v5 y @v6, y define después cómo deben representarse las refs o los SHAs resueltos. Se considera terminado cuando distintas refs de la misma action o workflow externo se ingieren y analizan de forma determinista.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
I'm trying to add external workflows to the repo before calling CodeQL. This would allow me to recurse into composite actions and callable workflows not defined in the same repo.
This would help detect cache poisoning attacks and unsafe checkouts from composite actions and callable workflows defined in different repos that the one being scanned. As well as other unsafe constructs inside these workflows and actions our organization might rely on.
The attack on tanstack, is an example of how the actual actions/cache call was "hidden" in a composite action:
https://tanstack.com/blog/npm-supply-chain-compromise-postmortem
on:
pull_request_target:
paths: ['packages/**', 'benchmarks/**']
jobs:
benchmark-pr:
steps:
- uses: actions/checkout@v6.0.2
with:
ref: refs/pull/${{ github.event.pull_request.number }}/merge # fork's merged code
- uses: TanStack/config/.github/setup@main # transitively calls actions/cache@v5
Currently, when storing external composite actions and callable workflows in .github/actions/external/ the actions are ingested and scanned along with the repos own workflows and thus more issues can be detected.
But the folder structure doesn't take into account the ref of the action, so I can only put a single implementation in, before scanning.
Why this is inherent to the CodeQL extractor's design
Looking at the CodeQL QL library conventions:
CompositeActionImpl.getResolvedPath() strips .github/actions/external/ → result is actions/checkout
The uses: string is actions/checkout@v5 — the QL library matches by path prefix, not by exact uses: string
So the CodeQL extractor itself doesn't support multiple versions of the same action at different refs. The directory convention has no slot for the version/ref.
Impact
When multiple workflows in the same repo use different versions of the same action, such as: actions/checkout@v5 and actions/checkout@v6, it's only possible to place one of these versions in the expected external folder.
This results in:
- Incorrect analysis results: CodeQL may analyze v6's
action.ymlwhen the workflow actually uses v5, or vice versa. If the actions differ in their internaluses:orrun:steps between versions, this could produce false positives or false negatives. - Non-deterministic: The result depends on the order dependencies are processed.
Possible mitigations
Proposed solution:
Ensure the ref is somehow part of (or supported in) the directory structure:
.github/actions/external/actions/checkout/{ref}/path/action.yaml
Given that refs themselves can contain / and other unsupported characters, and that they may actually point to a different sha between runs, it might be even better to resolve the ref to a sha and when stored under that path:
.github/actions/external/actions/checkout/{sha}/path/action.yaml
That would result in the most predictable scans.
This may require a sha->ref lookup in order to resolve to the right composite action.
- Lenguaje dominante
- CodeQL
- Estrellas
- 10.1k
- Forks
- 2.1k
- Merge medio
- 2 d 10 h
- PR fusionados (30 d)
- 134
Guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de github/codeql
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
-
C#: cs/simplifiable-boolean-expression false positive on Nullable<bool> compared with a literal Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
-
false-positive
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
-
false-positive
Dificultad 3/5 1-2 días Aptitud para principiantes 68/100
Todos los issues de github/codeql
Issues similares
-
ZCode 3.14.3 に対応する Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
supermomonga/zcode-acp#24 ·
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 90/100
learningequality/ricecooker#747 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
KhronosGroup/glTF-Blender-IO#2769 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100