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

Abierto Apto para principiantes
#205 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
2/5
Tiempo estimado
1-3 horas
Aptitud para principiantes
78/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
github-actions, go, python, shell
Área
ci-cd, security

Línea de trabajo

Lee .github/scanners/install.sh alrededor de las líneas 99–103 y action.yml alrededor de las líneas 79–88 y 180–192; compara el uso del token con docs/ci.md y el workflow relacionado. Empieza por comprobar cómo el paso de instalación pasa GH_TOKEN y cómo se instala Semgrep. La tarea estará terminada cuando la instalación de Semgrep no reciba el token y la descripción de la entrada explique correctamente su fijación de versión de PyPI; ejecuta las pruebas breves y las comprobaciones de lint indicadas.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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

Lenguaje dominante
Go
Estrellas
0
Forks
1
Merge medio
8 h 14 min
PR fusionados (30 d)
3

Preparar el entorno

Abrir en Codespaces

Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de TMHSDigital/Spackle

Todos los issues de TMHSDigital/Spackle

Issues similares

Más issues de Go

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.