Semgrep pip install in the Action runs unhashed with the job token in its env

Aperta Adatta ai principianti
#205 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
78/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
github-actions, go, python, shell
Ambito
ci-cd, security

Direzione di ricerca

Leggi .github/scanners/install.sh intorno alle righe 99–103 e action.yml intorno alle righe 79–88 e 180–192; confronta l’uso del token con docs/ci.md e il workflow correlato. Inizia verificando come il passaggio di installazione passa GH_TOKEN e come viene installato Semgrep. Il lavoro è terminato quando l’installazione di Semgrep non riceve il token e la descrizione dell’input spiega correttamente il pin della versione PyPI; esegui i test brevi e i controlli di lint elencati.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

ci severity: low

Summary

The Action's scanner install step sets the job token for the whole step, including the pipx install of Semgrep, which is pinned by version only. The scanners input description also says every download is hash-checked, which is not true for Semgrep.

Where

  • action.yml:180-192 (install step with GH_TOKEN)
  • .github/scanners/install.sh:99-103 (pipx install --force "semgrep==<version>")
  • action.yml:79-88 (scanners input description)
  • .github/workflows/scanners.yml:42-49

Details

The token is needed only by gh release download for the four release-file scanners. For Semgrep only the top-level version is pinned; its dependency tree is resolved from PyPI on every run, which .github/scanners/pins.env and docs/ci.md state openly. The step-wide environment means that install also sees the token. The description in action.yml says "Each download is checked against its pinned hash before it is installed"; docs/ci.md has the accurate wording.

Impact

Hardening: a consumer who sets scanners: semgrep or scanners: all gives the workflow token to a step that runs code it has not pinned by hash, in a step whose description says everything is hash-checked. The four release-file scanners are not affected.

Suggested fix

Run the pipx install without the token (env -u GH_TOKEN -u GITHUB_TOKEN ... pipx install ... in install.sh). Better, install from a committed requirements file with hashes (pip install --require-hashes -r semgrep.lock into a venv) so the whole tree is pinned like the other four scanners. Correct the scanners description in action.yml to say that Semgrep is installed from PyPI by version.

Acceptance criteria

  • The Semgrep install does not have the token in its environment
  • action.yml describes the Semgrep install accurately
  • Optional: a hash-locked requirements file, checked by the weekly tool-versions job

Related: #106

Getting started

  • Relevant files: .github/scanners/install.sh, action.yml, .github/scanners/pins.env
  • How to run tests: make test-short (Unix) or .\make.ps1 test-short (Windows PowerShell); make lint before you call it done
  • Related docs: docs/ci.md (External scanners)

Filed by repo-audit/full-audit at 50e92ec. Severity: low. Effort: S. audit-key: ci|.github/scanners/install.sh|semgrep-token-env

Lingua principale
Go
Stelle
0
Fork
1
Merge medio
8h 14m
PR unite (30g)
3

Preparare l'ambiente

Apri in Codespaces

Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di TMHSDigital/Spackle

Tutte le issue di TMHSDigital/Spackle

Issue simili

Altre issue su Go

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.