Skip to content

Studio and Core: certifi 2026.10.19 and pip 26.2.2 floors (drop the compromised emSign root) - #14887

Merged
danielhanchen merged 1 commit into
mainfrom
studio-certifi-pip-floor-emsign
Oct 23, 2026
Merged

danielhanchen merged 1 commit into
mainfrom
studio-certifi-pip-floor-emsign

Conversation

@danielhanchen

Copy link
Copy Markdown
Member

The eMudhra/emSign intermediates were issued with trivially weak private keys (https://discuss.python.org/t/information-for-python-users-regarding-emudhra-emsign-ca-certificate-security-incident/109576, https://emudhra.we-have-a-problem.com/), so anyone can mint a certificate that chains to the emSign ECC Root CA - G3. certifi 2026.10.19 drops that root, and pip 26.2.2 ships it as its vendored bundle (pip always verifies with its own copy, whatever the environment's certifi or REQUESTS_CA_BUNDLE say).

Studio's torch installs leave certifi to the resolver, and the update path skips a pip it considers usable (major 23 or newer), so an existing install keeps whatever certifi and pip it had. Core (pip install unsloth) declares no certifi floor at all. truststore, which Studio injects on macOS, Windows and the Linux desktop, adds the OS anchors to certifi's rather than replacing them, so an old certifi stays exploitable there too.

Change.

  • studio/install_python_stack.py: one trust-floor step right after the pip bootstrap, outside every skip path, so it runs on setup, update and repair in torch and no-torch mode. It installs only the floors the venv does not meet (certifi>=2026.10.19, plus pip>=26.2.2 on Python 3.10+), through the existing installer helper. A satisfied venv runs nothing; nothing is ever downgraded; offline it warns and carries on. No new step line (the helper prints its label only in verbose mode). _venv_pip_is_usable treats a pip below 26.2.2 as stale on 3.10+, so the existing bootstrap upgrades it.
  • pyproject.toml: certifi>=2026.10.19 in the base dependencies, so pip install -U unsloth (Colab, Kaggle, notebooks) upgrades certifi in place.
  • docker/Dockerfile, docker/Dockerfile.rocm: pip>=26.2.2, uv>=0.13.4, certifi>=2026.10.19 floors on the venv bootstrap lines (takes effect on the next image build).
  • no-torch-runtime.txt: comment only; its certifi==2026.10.19 pin is unchanged.

Before / after.

requests against the disclosure's test hosts:

host certifi 2026.7.22 certifi 2026.10.19
pypi.org HTTP 200 HTTP 200
dv-g3b-emudhra.we-have-a-problem.com HTTP 200 (accepted) rejected
dv-g3b-noct-emudhra.we-have-a-problem.com HTTP 200 (accepted) rejected

pip against --index-url https://dv-g3b-emudhra.we-have-a-problem.com/simple/: pip 24.0 gets past TLS to the page, pip 26.2.2 with its vendored bundle fails with CERTIFICATE_VERIFY_FAILED.

The new step on a real venv (Python 3.12, against the live index):

point certifi pip installs
before 2026.7.22 24.3.1
base run 2026.7.22 24.3.1 step absent
head run 1 2026.10.19 26.2.2 1
head run 2 2026.10.19 26.2.2 0, no subprocess

Testing. New tests/studio/install/test_ca_trust_floor.py (spec selection per installed version and Python, satisfied venv runs nothing, offline warns, a full install_python_stack() run in torch / no-torch and with / without an installer handoff issues the floor install before the first -r install, the pyproject and no-torch floors). test_dependency_pass_skips.py updated for the 26.2.2 pip floor. 186 passed. Removing the _ensure_trust_floor() call fails the four full-pass cases.

Not in this PR: the vLLM/SGLang engine locks still pin certifi==2026.7.22. Changing a lock changes its digest, and Studio then refuses to launch an installed engine until the user presses Update in Settings, so that bump is left for the next engine refresh.

…v and Core

certifi 2026.10.19 removes the distrusted emSign ECC Root CA - G3. pip
before 26.2.2 verifies TLS with its own vendored certifi, so on Python
3.10+ pip is raised too.

- install_python_stack: an idempotent trust floor step after the pip
  bootstrap on every setup, update and repair, torch and no-torch. It
  installs only the floors the venv does not meet, never downgrades, and
  warns and continues offline. The pip usability floor is 26.2.2 on 3.10+.
- pyproject: certifi>=2026.10.19 in the base dependencies.
- Docker: pip, uv and certifi floors on the venv bootstrap lines.
- Tests for the pyproject floor and the installer step.
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

1 similar comment
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-23T03:25:23.185895Z e251510 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Hooray!

Reviewed commit: e251510d37

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@danielhanchen
danielhanchen merged commit a47bcbb into main Oct 23, 2026
18 of 101 checks passed
@danielhanchen
danielhanchen deleted the studio-certifi-pip-floor-emsign branch October 23, 2026 03:42
danielhanchen added a commit that referenced this pull request Oct 27, 2026
#14887 floored certifi at 2026.10.19 (and pip at 26.2.2) in the Studio
venv and Core, because certifi 2026.7.22 still trusts the distrusted
emSign ECC Root CA - G3. The isolated engine environments did not get
the same floor. All five locks under
`studio/backend/requirements/engines/` still pinned
`certifi==2026.7.22`:

- vLLM: cu130, cu130 torch 2.13, ROCm 7.2.3
- SGLang: cu130, cu130 torch 2.13

`engine_install.py` syncs those locks with hashes into a separate
environment, so a fresh vLLM or SGLang install kept the old CA bundle
even with the Studio venv patched. I checked the `cacert.pem` of each
wheel: emSign ECC Root CA - G3 is in 2026.7.22 and not in 2026.10.19.

For each engine:

- the `.in` gets the same `certifi>=2026.10.19` floor as
`no-torch-runtime.txt`;
- the `.txt` lock pins `certifi==2026.10.19` with the PyPI hashes;
- the `.compat.json` `lock_sha256` and certifi size are updated to match
the new lock.

The PyPI hashes:

- wheel
`42d35340cc5b9ba78e818ddbff0c5b1c2b779de448a340fd1b989f5fa8670e1b`
- sdist
`035c1e85572b141bf1c3a3eff0e33a8eb74917522f2559075ff8d2fea780a1ae`

Only the certifi entry changes; nothing else is re-resolved. Every
`lock_sha256` equals the SHA-256 of its lock file.

`tests/studio/install/test_ca_trust_floor.py` now also checks every
engine `.in` and `.txt` lock against the floor. With the extended file,
main gives 10 failed and this PR gives all passed.
`test_managed_engines.py` passes (245 passed together with the floor
test).

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
shimmyshimmer pushed a commit to shimmyshimmer/unsloth-staging-4 that referenced this pull request Oct 27, 2026
…#15509)

## What

The vLLM / SGLang engine locks
(`studio/backend/requirements/engines/*.txt`) are hash-pinned and still
carry `certifi==2026.7.22`, which trusts the revoked eMudhra / emSign
roots. Changing the locks would make every installed engine refuse to
launch until the user clicks Update in Settings, so the trust is fixed
at launch instead.

## Change

`managed_engine.py`: a locally launched engine gets `SSL_CERT_FILE` and
`REQUESTS_CA_BUNDLE` pointing at Studio's own certifi bundle (Studio's
venv is floored at `certifi>=2026.10.19` since unslothai#14887). If the user
already set `SSL_CERT_FILE`, `SSL_CERT_DIR` or `REQUESTS_CA_BUNDLE`
(corporate CA), nothing is changed. No lock, install flow or UI changes.

## Evidence

A venv with the engine locks' exact HTTP stack (certifi 2026.7.22, httpx
0.28.1, requests 2.34.2, huggingface-hub 1.31.0, aiohttp 3.14.3),
against the public emSign test host:

| client | as launched today | with this change |
|---|---|---|
| httpx | accepts the revoked chain | rejects |
| requests | accepts | rejects |
| huggingface_hub session | accepts | rejects |
| urllib, aiohttp | reject | reject |

huggingface.co still answers normally with the variables set.

## Tests

`tests/test_managed_engine_ca_bundle.py`: the bundle is set when none
was chosen (and setting it twice changes nothing), a user's own bundle
is left alone, a missing bundle file sets nothing, and the local launch
applies it. Fails on main (6), passes here. Managed-engine suites: 385
passed; the 3 failures in `test_managed_engines_rocm.py` fail
identically on main.

Not covered: the WSL guest engine (its own Linux venv, no access to
Studio's bundle path).
danielhanchen added a commit that referenced this pull request Nov 18, 2026
… and pip (#18358)

## Summary

On a runner whose own `certifi` or `pip` is below the CA trust floor and
has no `uv` on PATH, 59 cases in
`tests/studio/install/test_mlx_install.py` fail:

```
studio/install_python_stack.py:8272: in _ensure_trust_floor
studio/install_python_stack.py:9653: in pip_install_try
FileNotFoundError: [Errno 2] No such file or directory: 'uv'
```

This showed up on the macOS leg of the cross-platform staging run for
#16799 (runner certifi 2026.7.22, below the `certifi>=2026.10.19`
floor).

## Cause

`install_python_stack()` calls `_ensure_trust_floor()` on every setup
and update (#14887). That raises certifi, and pip on 3.10+, through
`pip_install_try` whenever the running interpreter does not already meet
the floor. The `_run_to_extras` helper stubs `pip_install`, `run`,
`_bootstrap_uv` and the torch steps, but not this path. So whether these
tests spawn a real installer depended on the runner image's certifi and
pip versions. On hosts that already meet the floor, nothing runs and the
tests pass.

The installer behaviour is correct. The test was not hermetic.

## Fix

Stub `_trust_floor_specs` to return `[]` in the helper, next to the
`_no_torch_pair` stub from #18354. The floor logic keeps its own
coverage in `tests/studio/install/test_ca_trust_floor.py`.

## Verification

Reproduced by raising the certifi floor above any installed version and
running with `uv` removed from PATH:

| Tree | floor unmet, no `uv` | normal |
|---|---|---|
| main | 59 failed, 15 passed | 74 passed |
| this branch | 74 passed | 74 passed |

`test_ca_trust_floor.py` passes unchanged, and ruff is clean.
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.

1 participant