Skip to content

[Bugfix] Pin requirements.txt versions to reduce supply-chain risk - #4091

Merged
yhl-amd merged 1 commit into
ROCm:mainfrom
yhl-amd:security/pin-python-deps
Jul 6, 2026
Merged

yhl-amd merged 1 commit into
ROCm:mainfrom
yhl-amd:security/pin-python-deps

Conversation

@yhl-amd

@yhl-amd yhl-amd commented Jul 6, 2026 •

Copy link
Copy Markdown
Contributor

Summary

requirements.txt listed most dependencies by bare name (pandas, pytest, psutil, matplotlib, pyyaml, einops, ninja) or a lower bound (pybind11>=3.0.1), so each install could resolve to an arbitrary newer release. Static analysis flagged this as a PyPI supply-chain surface (typosquat / upstream compromise pulling an unexpected version) — findings SEC-00190 / SEC-00291 / SEC-00839.

This pins every entry to the version shipped by the canonical build/test image rocm/atom-dev:latest, so installs are reproducible and match a known-good baseline.

What's pinned

package pinned version
pandas 3.0.3
pytest 9.0.3
psutil 7.2.2
matplotlib 3.10.9
pyyaml 6.0.3
einops 0.8.2
pybind11 3.0.4 (was >=3.0.1)
ninja 1.13.0
flydsl 0.2.2 (already pinned)

Baseline image digest: sha256:7826a9a904a905b3b14418b267e8c40d17ca5606d72d620ff407df2129c2e5e7.

Deliberately not pinned here

torch / triton are not added: the base image ships ROCm-specific builds (e.g. torch 2.10.0+rocm..., triton 3.7.0+amd.rocm...) that are not on PyPI, so pinning them in requirements.txt would break pip install on any environment other than that exact image. Their provenance is governed by the base image, not this file.

Test plan

  • pip install --dry-run -r requirements.txt inside rocm/atom-dev:latest — all entries already satisfied, no conflicts
  • CI install on the runner

Follow-up (not in this PR)

Full --require-hashes mode (via pip-compile --generate-hashes) would additionally defend against a compromised-but-same-version release. Left out here to keep the change minimal and avoid churn on transitive deps; can be a follow-up if desired.

https://amd-hub.atlassian.net/browse/ROCM-26829
https://amd-hub.atlassian.net/browse/ROCM-26902
https://amd-hub.atlassian.net/browse/ROCM-27182

requirements.txt listed most dependencies by bare name (pandas, pytest,
psutil, matplotlib, pyyaml, einops, ninja) or a lower bound (pybind11),
so each install could resolve to an arbitrary newer version — the pattern
flagged by static analysis as a PyPI supply-chain surface (typosquat /
upstream compromise pulling an unexpected release).

Pin every entry to the version shipped by the canonical build/test image
rocm/atom-dev:latest, so installs are reproducible and match a known-good
baseline. Verified with `pip install --dry-run -r requirements.txt` inside
that image: all entries already satisfied, no conflicts.

torch / triton are intentionally left out: the base image ships ROCm-specific
builds not published on PyPI, so pinning them here would break `pip install`
off-image. Their provenance is governed by the base image.

Covers findings SEC-00190 / SEC-00291 / SEC-00839 (requirements.txt scope).

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Signed-off-by: yihonglie <[email protected]>
@yhl-amd
yhl-amd requested a review from a team July 6, 2026 02:42
@github-actions

github-actions Bot commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

🏷️ CI Guide

Runs automatically on every PR:

  • ✅ Pre-checks (submodule verification, code formatting)
  • ✅ Aiter op tests (gfx942 + gfx950)
  • ✅ Triton tests on MI35X (only when aiter/ops/triton/** or related paths are changed)

Extended tests (opt-in via labels):

Label Tests
ci:triton-300x Run an additional Triton test job on MI300X in PRs; main branch always runs both MI35X and MI300X
ci:sglang SGLang integration tests: DeepSeek-R1-MXFP4 accuracy, Qwen 3.5 accuracy
ci:atom ATOM benchmark: DeepSeek-R1-0528, GPT-OSS-120B
ci:atom_full ATOM accuracy suite for PR and main models from ATOM models_accuracy.json
ci:vllm vLLM benchmark: GPT-OSS-120B, DeepSeek-R1-0528, Kimi-K2.5
ci:all All standard extended tests (excludes ci:atom_full)

Only add ci:atom_full for FlyDSL or Triton upgrades.
Add labels via the sidebar or gh pr edit 4091 --add-label <label>

@yhl-amd
yhl-amd merged commit 9f77f38 into ROCm:main Jul 6, 2026
40 checks passed
gyohuangxin pushed a commit that referenced this pull request Jul 6, 2026
…4106)

#4091 pinned pandas==3.0.3 (the version in rocm/atom-dev:latest, py3.12),
but the py3.10 wheel build container cannot install it — pandas 3.0
requires Python >=3.11 — so `build_aiter_wheels (3.10, ...)` on main
fails with "No matching distribution found for pandas==3.0.3".

The PR's own checks did not catch this: the py3.10 build only runs the
prebuild=false (no-op) matrix leg, while the real py3.10 build runs on
push to main.

Use an environment marker so each interpreter gets a compatible pinned
version:

  pandas==3.0.3; python_version >= "3.11"   # py3.12 baseline (atom-dev)
  pandas==2.3.3; python_version <  "3.11"   # latest pandas supporting py3.10

Verified with `pip install --dry-run -r requirements.txt`:
  - python:3.10-slim -> resolves pandas 2.3.3 + all others, no error
  - rocm/atom-dev:latest (py3.12) -> pandas 3.0.3, all already satisfied

Signed-off-by: yihonglie <[email protected]>
Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants