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

Đang mở Phù hợp với người mới
#205 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
78/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
github-actions, go, python, shell
Lĩnh vực
ci-cd, security

Hướng nghiên cứu

Đọc .github/scanners/install.sh quanh các dòng 99–103 và action.yml quanh các dòng 79–88 và 180–192; so sánh cách dùng token với docs/ci.md và workflow liên quan. Bắt đầu bằng cách kiểm tra bước cài đặt truyền GH_TOKEN như thế nào và Semgrep được cài đặt ra sao. Hoàn tất khi quá trình cài đặt Semgrep không nhận token và phần mô tả đầu vào giải thích chính xác việc ghim phiên bản PyPI; chạy các bài kiểm tra ngắn và kiểm tra lint được liệt kê.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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

Ngôn ngữ chính
Go
Star
0
Fork
1
Merge trung bình
8 giờ 14 phút
Pull request đã merge (30 ngày)
3

Chuẩn bị môi trường

Mở trong Codespaces

Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của TMHSDigital/Spackle

Tất cả issue của TMHSDigital/Spackle

Issue tương tự

Thêm issue về Go

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.