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

未关闭 适合新手
#205 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
78/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
github-actions, go, python, shell
领域
ci-cd, security

调研方向

阅读 .github/scanners/install.sh 第 99–103 行附近以及 action.yml 第 79–88 行和第 180–192 行附近的内容;将令牌的使用方式与 docs/ci.md 及相关工作流进行比较。先检查安装步骤如何传递 GH_TOKEN,以及 Semgrep 是如何安装的。完成标准是:安装 Semgrep 时不接收令牌,且输入描述准确说明其 PyPI 版本固定方式;运行列出的简短测试和 lint 检查。

由索引模型根据 Issue 内容生成。

描述

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

主要语言
Go
星标
0
派生
1
平均合并
8 小时 14 分钟
30 天内合并 PR
3

环境准备

在 Codespaces 中打开

在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

TMHSDigital/Spackle 的其他 Issue

查看 TMHSDigital/Spackle 的全部 Issue

相似的 Issue

更多 Go Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。