[actions] Add detection for workflow_dispatch TOCTOU
- Lingua principale
- CodeQL
- Stelle
- 10.1k
- Fork
- 2.1k
- Merge medio
- 2g 15h
- PR unite (30g)
- 141
Descrizione
**Description of the issue**
There is a newer variation of GitHub Actions TOCTOU vulnerabilities known as "Workflow dispatch TOCTOU" - I wrote about a real-world example in a recent bug report writeup:
https://adnanthekhan.com/posts/dependabot-core-toctou-writeup/
I think this is a good candidate for a `High` detection where a PR has the following characteristics:
* Runs on workflow dispatch / repository dispatch with the PR number as an input parameter. Does NOT require a commit SHA.
* Checks out code from that PR without some approval check.
* Runs code.
High because there is a lot of context required to understand if a maintainer would _actually_ ever run the workflow on a fork, and that is not possible to determine via static analysis alone.
I believe this would require some code changes in the library code - adding a concept of a non externally triggered workflow that is intended to act upon untrusted code. This could then fire the UntrustedCheckoutTOCTOU alert
Guida per i contributori
Apri la guida per i contributori
Direzione di ricerca
Inizia esaminando gli scenari workflow_dispatch e repository_dispatch dell'issue e l'avviso UntrustedCheckoutTOCTOU esistente nel codice della libreria. Determina come rappresentare i workflow che agiscono su codice non attendibile senza un controllo di approvazione, quindi verifica che i workflow corrispondenti vengano rilevati mentre i workflow che richiedono un commit SHA non vengano rilevati.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- github-actions
- Ambito
- ci-cd, security
- Tipo di issue
- Funzionalità
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 25/100