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

Open Beginner friendly
#205 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
78/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
github-actions, go, python, shell
Domain
ci-cd, security

Research direction

Read .github/scanners/install.sh around lines 99–103 and action.yml around lines 79–88 and 180–192; compare the token use with docs/ci.md and the related workflow. Start by checking how the install step passes GH_TOKEN and how Semgrep is installed. Done when Semgrep installation does not receive the token and the input description accurately explains its PyPI version pin; run the listed short tests and lint checks.

Written by the indexing model from the issue text.

Description

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

Dominant language
Go
Stars
0
Forks
1
Avg merge
8h 14m
Merged PRs (30d)
3

Getting set up

Open in Codespaces

Starts the project's dev container in your browser, under your own GitHub account.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from TMHSDigital/Spackle

All issues in TMHSDigital/Spackle

Similar issues

More Go issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.