Repository navigation
CI: enforce patched Python floor in setup-python and simplify harden-pip #3259
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
40a5fb0
fa74283
4db603e
9a474d5
0734199
0e852e6
cb8baed
dd043cd
680f0dc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,12 +4,13 @@ | |
|
|
||
| name: Harden pip | ||
| description: >- | ||
| Install the security-fixed pip (26.2.2) from a hash-pinned wheel so that later | ||
| pip invocations do not fall back on the vendored certifi bundle that trusts the | ||
| compromised eMudhra/emSign intermediate CAs. The sha256 fragment guarantees the | ||
| bootstrap download's integrity even if the bootstrapping pip's trust store is | ||
| compromised. See https://github.com/NVIDIA/cuda-python/issues/3195 and | ||
| https://discuss.python.org/t/109576. | ||
| Update pip. Call sites must use setup-python with a floor spec that ensures | ||
| the interpreter's ssl module rejects the compromised eMudhra/emSign CA keys | ||
| (CVE-2026-115557; first fixed releases: 3.11.18, 3.12.16, 3.13.18, 3.14.10, | ||
| 3.15.2). With a patched ssl module, pip install -U pip is safe and picks up | ||
| the latest pip, which uses truststore (the OS certificate store) by default. | ||
| See https://github.com/NVIDIA/cuda-python/issues/3195 and | ||
| https://discuss.python.org/t/109678. | ||
|
|
||
| inputs: | ||
| python: | ||
|
|
@@ -19,10 +20,34 @@ inputs: | |
| runs: | ||
| using: composite | ||
| steps: | ||
| - name: Install hash-pinned pip 26.2.2 | ||
| - name: Check Python interpreter is patched (CVE-2026-115557) | ||
| shell: bash --noprofile --norc -euo pipefail {0} | ||
| env: | ||
| HARDEN_PIP_PYTHON: ${{ inputs.python }} | ||
| run: | | ||
| "${HARDEN_PIP_PYTHON}" -c ' | ||
| import sys | ||
| v = sys.version_info | ||
| print("sys.version:", sys.version) | ||
| FIXED = {(3,11):18,(3,12):16,(3,13):18,(3,14):10,(3,15):2} | ||
| s = (v.major, v.minor) | ||
| p = str(v.major)+"."+str(v.minor)+"."+str(v.micro) | ||
| if s in FIXED: | ||
| fl = str(v.major)+"."+str(v.minor)+"."+str(FIXED[s]) | ||
| if v.micro < FIXED[s]: | ||
| print("::error::Python "+p+" is older than "+fl+", the first "+str(v.major)+"."+str(v.minor)+" release that rejects the compromised eMudhra CA keys (CVE-2026-115557).") | ||
| sys.exit(1) | ||
| print("Python "+p+": ssl module carries the fix (first fixed: "+fl+").") | ||
| elif s > max(FIXED): | ||
| print("::warning::Python "+p+": no fixed release known for "+str(v.major)+"."+str(v.minor)+" yet.") | ||
| else: | ||
| print("::error::Python "+str(v.major)+"."+str(v.minor)+" has no release that rejects the compromised eMudhra CA keys (CVE-2026-115557).") | ||
| sys.exit(1) | ||
| ' | ||
|
|
||
| - name: Update pip | ||
| shell: bash --noprofile --norc -xeuo pipefail {0} | ||
| env: | ||
| HARDEN_PIP_PYTHON: ${{ inputs.python }} | ||
| run: | | ||
| "${HARDEN_PIP_PYTHON}" -m pip install \ | ||
| "pip @ https://files.pythonhosted.org/packages/3f/06/3e4420302363fbb71be3c7f35ce042f54bfca330e3e66b3a2e3c4cca579f/pip-26.2.2-py3-none-any.whl#sha256=fd7f4dfa8190e014013b9f08f3e973f4e4c26ffd179a204895533a7254813a70" | ||
| "${HARDEN_PIP_PYTHON}" -m pip install -U pip | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. important: Keep the verified bootstrap for unpatched Python. With an older bundled pip, a network attacker can use a compromised CA key to replace the unpinned download and execute code in CI. Restore the hash-pinned bootstrap and ensure callers use a patched interpreter or fail closed. (discuss.python.org) As per path instructions: “focus on … security boundaries.” Source: Path instructions |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -110,6 +110,9 @@ jobs: | |
| # WAR: setup-python is not relocatable, and cibuildwheel hard-wires to 3.12... | ||
| # see https://github.com/actions/setup-python/issues/871 | ||
| python-version: "3.12" | ||
| # Resolve newest patch from manifest (not stale tool cache); tilde-range | ||
| # (~3.12.16) is not used because the Windows manifest may lag behind Linux. | ||
| check-latest: true | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. important: Keep an explicit patched-version floor in these setup steps. As per path instructions, this CI change must preserve the security boundary before networked package installation. Also applies to: 454-454 Source: Path instructions |
||
| architecture: ${{ ((inputs.host-platform == 'linux-aarch64' || inputs.host-platform == 'win-arm64') && 'arm64') || 'x64' }} | ||
|
|
||
| - name: Harden pip | ||
|
|
@@ -445,6 +448,10 @@ jobs: | |
| with: | ||
| python-version: ${{ matrix.python-version }} | ||
| allow-prereleases: ${{ startsWith(matrix.python-version, '3.16') }} | ||
| # Resolve the newest patch from the manifest rather than a stale tool | ||
| # cache; every matrix series' newest patch carries the eMudhra ssl fix | ||
| # (CVE-2026-115557), which a single floor spec cannot express here. | ||
| check-latest: true | ||
|
|
||
| - name: Harden pip | ||
| if: ${{ env.TEST_BINDINGS == 'true' || env.TEST_CORE == 'true' }} | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Script executed:
Repository: NVIDIA/cuda-python
Length of output: 12178
Script executed:
Repository: NVIDIA/cuda-python
Length of output: 23827
important: Restore the Windows CI path.
Both Windows workflows request Python 3.12 with
check-latest: trueand runharden-pip. The Windows manifest resolves that request to Python 3.12.10, but the guard rejects every 3.12 interpreter below 3.12.16. These jobs therefore fail before their build or test steps. The fail-closed behavior is intentional, but it remains a mergeability problem.Provide patched Windows interpreters for the required minor versions, or retain a secure hash-pinned bootstrap for affected versions.