Skip to content

Local UI to run and train LLMs and diffusion models. Supports GGUF, MLX, Qwen3.8, DeepSeek-V4.1, MiniMax-H3, Gemma 4, FLUX and more.

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

Daniel Hana47bcbb081b8
diff --git a/docker/Dockerfile b/docker/Dockerfile
index 1ac70d44693..75ee5384e3a 100644
--- a/docker/Dockerfile
+++ b/docker/Dockerfile
@@ -80,7 +80,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
# Isolated prefix; never touch the system Python (PEP 668 externally-managed).
# The venv bootstraps pip via ensurepip and gets uv a few lines below.
ENV VENV=/opt/unsloth-venv
-RUN python -m venv ${VENV} && ${VENV}/bin/pip install -U pip wheel setuptools
+RUN python -m venv ${VENV} && ${VENV}/bin/pip install -U "pip>=26.2.2" wheel setuptools "certifi>=2026.10.19"
# Unified install: torch + triton + bitsandbytes + unsloth + unsloth_zoo in a
# SINGLE uv pass. Mandatory -- splitting it lets bnb's transitive `cuda-toolkit`
@@ -109,7 +109,7 @@ RUN set -eux \
*) echo "ERROR: unsupported TARGETARCH=${TARGETARCH}" >&2; exit 1 ;; \
esac \
&& echo ">> TARGETARCH=${TARGETARCH:-amd64}, unsloth extra=[${UNSLOTH_EXTRA}], xformers=[${XFORMERS_PIN}]" \
- && ${VENV}/bin/pip install uv \
+ && ${VENV}/bin/pip install "uv>=0.13.4" \
&& ${VENV}/bin/uv pip install \
--python ${VENV}/bin/python \
--index-strategy unsafe-best-match \
diff --git a/docker/Dockerfile.rocm b/docker/Dockerfile.rocm
index 86f3db33fbf..f75b6dcdfc5 100644
--- a/docker/Dockerfile.rocm
+++ b/docker/Dockerfile.rocm
@@ -67,7 +67,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
ENV VENV=/opt/unsloth-venv
RUN --mount=type=cache,target=/root/.cache/pip \
python${PYTHON_VERSION} -m venv ${VENV} \
- && ${VENV}/bin/pip install -U pip wheel setuptools uv \
+ && ${VENV}/bin/pip install -U "pip>=26.2.2" wheel setuptools "uv>=0.13.4" "certifi>=2026.10.19" \
&& ${VENV}/bin/python -c "import sys; assert sys.version_info[:2] == tuple(int(x) for x in '${PYTHON_VERSION}'.split('.')), sys.version"
# Where torch comes from, resolved once and read by the later layers:
diff --git a/pyproject.toml b/pyproject.toml
index 45b03913082..f982b6db147 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -42,6 +42,9 @@ dependencies = [
# unsloth_cli/__init__.py reaches click via commands/start.py, so every
# command needs it. typer supplied it until 0.27 dropped the dependency.
"click>=8.0",
+ # CA trust store floor: 2026.10.19 removes the distrusted emSign ECC Root CA - G3, and an
+ # existing older certifi is upgraded in place by pip install unsloth.
+ "certifi>=2026.10.19",
]
[project.scripts]
diff --git a/studio/backend/requirements/no-torch-runtime.txt b/studio/backend/requirements/no-torch-runtime.txt
index d595e2c2efc..e7a424eb4a6 100644
--- a/studio/backend/requirements/no-torch-runtime.txt
+++ b/studio/backend/requirements/no-torch-runtime.txt
@@ -77,6 +77,7 @@ httpcore==1.0.9
# and HTTP request path, so they belong on that schedule too, not on churn.
# 2026.10.19: fastmcp-slim (3.4.11, 4.1.3) requires certifi>=2026.10.19, and an older pin here
# left that unmet after an update, so the next update reinstalled certifi.
+# It is also the CA trust floor (_TRUST_FLOOR_CERTIFI in install_python_stack.py): never below it.
certifi==2026.10.19
idna==3.18
anyio>=3.0,<4.14.0 # 4.14 asyncio cancel-scope RuntimeError on Py3.13 streaming (#6483); 4.13 unaffected
diff --git a/studio/install_python_stack.py b/studio/install_python_stack.py
index 91a53c5ef3f..019354cc9ec 100644
--- a/studio/install_python_stack.py
+++ b/studio/install_python_stack.py
@@ -8910,13 +8910,45 @@ def _bootstrap_uv() -> bool:
return True
+# CA trust floor. certifi 2026.10.19 drops the distrusted emSign ECC Root CA - G3. pip before 26.2.2
+# always verifies TLS with its own vendored certifi (pip dropped Python 3.9 before that release).
+_TRUST_FLOOR_CERTIFI = "certifi>=2026.10.19"
+_TRUST_FLOOR_PIP = "pip>=26.2.2"
+
+
+def _trust_floor_specs() -> list[str]:
+ """The trust-floor requirements this venv does not already satisfy."""
+ wanted = [_TRUST_FLOOR_CERTIFI]
+ if sys.version_info >= (3, 10):
+ wanted.append(_TRUST_FLOOR_PIP)
+ missing = []
+ for spec in wanted:
+ name, specifier = re.match(r"([a-z]+)(.*)", spec).groups()
+ installed = _installed_distribution_version(name)
+ if installed is None or _version_satisfies(installed, specifier) is not True:
+ missing.append(spec)
+ return missing
+
+
+def _ensure_trust_floor() -> None:
+ """Raise certifi (and pip on 3.10+) to the trust floor. Every setup, update and repair, both
+ modes. A lower bound only: a satisfied venv runs nothing, and nothing is ever downgraded.
+ Offline it warns and carries on; the next run with a network retries."""
+ missing = _trust_floor_specs()
+ if not missing:
+ return
+ if not pip_install_try("Raising the CA trust floor (" + ", ".join(missing) + ")", *missing):
+ _note("warning: could not install " + ", ".join(missing) + "; retrying on the next update")
+
+
def _venv_pip_is_usable() -> bool:
"""Whether this interpreter already has a pip new enough for the pass.
Read from metadata rather than by spawning it: the bootstrap below reinstalls pip from the
index on every run, a download and a resolve for a package nothing changed. 23.0 is the
floor because the constraint and override handling the pass relies on predates it
- comfortably; a fresh uv venv has no pip at all and still bootstraps.
+ comfortably; a fresh uv venv has no pip at all and still bootstraps. On Python 3.10+ the
+ floor is the trust floor's pip, since an older pip verifies TLS with its own vendored certifi.
"""
try:
if importlib.util.find_spec("pip") is None:
@@ -8932,6 +8964,11 @@ def _venv_pip_is_usable() -> bool:
return False
if major < 23:
return False
+ if (
+ sys.version_info >= (3, 10)
+ and _version_satisfies(installed, _TRUST_FLOOR_PIP[3:]) is not True
+ ):
+ return False
# Metadata survives a truncated pip, and everything without uv is `python -m pip`: one bounded
# launch settles it.
try:
@@ -12848,6 +12885,10 @@ def install_python_stack() -> int:
[sys.executable, "-m", "pip", "install", "--upgrade", "pip"],
)
+ # 2a. Before the bulk installs and outside every skip path: the bootstrap above only
+ # guarantees an installer, not a current trust store.
+ _ensure_trust_floor()
+
# A superseded dist-info makes version() and every RECORD consumer choose
# an arbitrary package version. Repair it before any fast package operation,
# including installer handoffs that set skip_base after their own upgrade.
diff --git a/tests/studio/install/test_ca_trust_floor.py b/tests/studio/install/test_ca_trust_floor.py
new file mode 100644
index 00000000000..b0524fa8b4b
--- /dev/null
+++ b/tests/studio/install/test_ca_trust_floor.py
@@ -0,0 +1,125 @@
+# SPDX-License-Identifier: AGPL-3.0-only
+# Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0
+
+"""certifi 2026.10.19 (and pip 26.2.2 on 3.10+) in the Studio venv and Core: neither keeps the emSign ECC G3 root."""
+
+from __future__ import annotations
+
+import importlib.util
+import pathlib
+import re
+import sys
+from unittest import mock
+
+import pytest
+
+REPO_ROOT = pathlib.Path(__file__).resolve().parents[3]
+CERTIFI_FLOOR = (2026, 10, 19)
+
+sys.path.insert(0, str(REPO_ROOT / "studio"))
+import install_python_stack as ips # noqa: E402
+
+
+def _release(version: str) -> tuple[int, ...]:
+ return tuple(int(part) for part in re.match(r"\d+(?:\.\d+)*", version).group(0).split("."))
+
+
+def test_the_no_torch_runtime_pin_is_at_or_above_the_floor() -> None:
+ text = (REPO_ROOT / "studio" / "backend" / "requirements" / "no-torch-runtime.txt").read_text()
+ (pin,) = re.findall(r"^certifi==(\S+)", text, re.MULTILINE)
+ assert _release(pin) >= CERTIFI_FLOOR
+
+
+def test_core_declares_the_certifi_floor() -> None:
+ try:
+ import tomllib
+ except ModuleNotFoundError:
+ tomllib = pytest.importorskip("tomli")
+ deps = tomllib.loads((REPO_ROOT / "pyproject.toml").read_text(encoding = "utf-8"))["project"][
+ "dependencies"
+ ]
+ floors = [d for d in deps if re.match(r"certifi\s*>=", d)]
+ assert len(floors) == 1
+ assert _release(floors[0].split(">=", 1)[1]) >= CERTIFI_FLOOR
+
+
+def test_the_installer_floor_matches() -> None:
+ assert ips._TRUST_FLOOR_CERTIFI == "certifi>=2026.10.19"
+ assert ips._TRUST_FLOOR_PIP == "pip>=26.2.2"
+
+
+def _versions(**installed):
+ return lambda name: installed.get(name)
+
+
+ "installed, py, expected",
+ [
+ ({"certifi": "2026.7.22", "pip": "24.2"}, (3, 12), ["certifi>=2026.10.19", "pip>=26.2.2"]),
+ ({"certifi": "2026.10.19", "pip": "26.2.2"}, (3, 12), []),
+ # Newer than the floor is never touched.
+ ({"certifi": "2027.1.1", "pip": "27.0"}, (3, 13), []),
+ ({"certifi": "2026.7.22"}, (3, 12), ["certifi>=2026.10.19", "pip>=26.2.2"]),
+ # pip 26.2.2 does not support 3.9: only certifi.
+ ({"certifi": "2026.7.22", "pip": "24.2"}, (3, 9), ["certifi>=2026.10.19"]),
+ ],
+)
+def test_only_unsatisfied_floors_are_installed(monkeypatch, installed, py, expected) -> None:
+ monkeypatch.setattr(ips, "_installed_distribution_version", _versions(**installed))
+ monkeypatch.setattr(ips.sys, "version_info", py)
+ assert ips._trust_floor_specs() == expected
+
+
+def test_a_satisfied_venv_runs_nothing(monkeypatch) -> None:
+ monkeypatch.setattr(ips, "_trust_floor_specs", lambda: [])
+ install = mock.Mock()
+ monkeypatch.setattr(ips, "pip_install_try", install)
+ ips._ensure_trust_floor()
+ install.assert_not_called()
+
+
+def test_an_offline_failure_warns_and_continues(monkeypatch) -> None:
+ monkeypatch.setattr(ips, "_trust_floor_specs", lambda: ["certifi>=2026.10.19"])
+ monkeypatch.setattr(ips, "pip_install_try", lambda *a, **k: False)
+ notes: list[str] = []
+ monkeypatch.setattr(ips, "_note", lambda message, *a: notes.append(message))
+ ips._ensure_trust_floor()
+ assert notes and "certifi>=2026.10.19" in notes[0]
+
+
+def _load_no_torch_harness():
+ path = REPO_ROOT / "tests" / "python" / "test_no_torch_filtering.py"
+ spec = importlib.util.spec_from_file_location("_trust_floor_no_torch_harness", path)
+ module = importlib.util.module_from_spec(spec)
+ spec.loader.exec_module(module)
+ assert module.ips is ips
+ return module.TestInstallPythonStackSubprocessMock()
+
+
[email protected]("skip_base", [True, False], ids = ["installer-handoff", "update"])
[email protected]("no_torch", [False, True], ids = ["torch", "no-torch"])
+def test_the_full_pass_raises_the_floor_in_both_modes(no_torch, skip_base) -> None:
+ """Reached on every path, before any requirements file is installed, through the uv installer."""
+ harness = _load_no_torch_harness()
+ with (
+ mock.patch.object(
+ ips, "_trust_floor_specs", return_value = ["certifi>=2026.10.19", "pip>=26.2.2"]
+ ),
+ mock.patch.object(ips, "_venv_pip_is_usable", return_value = True),
+ mock.patch.object(ips, "_plan_pass", return_value = None),
+ ):
+ cmds = harness._capture_install(
+ no_torch = no_torch, is_macos = False, is_windows = False, skip_base = skip_base
+ )
+ floor = [
+ i
+ for i, cmd in enumerate(cmds)
+ if cmd.startswith("uv pip install")
+ and "certifi>=2026.10.19" in cmd
+ and "pip>=26.2.2" in cmd
+ ]
+ assert len(floor) == 1, cmds
+ first_requirements_file = next(
+ (i for i, cmd in enumerate(cmds) if " -r " in cmd and "uv pip install" in cmd), len(cmds)
+ )
+ assert floor[0] < first_requirements_file
diff --git a/tests/studio/install/test_dependency_pass_skips.py b/tests/studio/install/test_dependency_pass_skips.py
index 23650053ce1..afd8b0c2e4b 100644
--- a/tests/studio/install/test_dependency_pass_skips.py
+++ b/tests/studio/install/test_dependency_pass_skips.py
@@ -823,8 +823,11 @@ def test_a_venv_that_already_has_pip_does_not_reinstall_it(monkeypatch) -> None:
monkeypatch.setattr(
stack.subprocess, "run", lambda cmd, **_k: types.SimpleNamespace(returncode = 0)
)
- monkeypatch.setattr(stack, "_installed_distribution_version", lambda _n: "24.2")
+ monkeypatch.setattr(stack, "_installed_distribution_version", lambda _n: "26.2.2")
assert stack._venv_pip_is_usable() is True
+ # Below the trust floor's pip on 3.10+, so the bootstrap runs.
+ monkeypatch.setattr(stack, "_installed_distribution_version", lambda _n: "24.2")
+ assert stack._venv_pip_is_usable() is (sys.version_info < (3, 10))
monkeypatch.setattr(stack, "_installed_distribution_version", lambda _n: "22.0.4")
assert stack._venv_pip_is_usable() is False
monkeypatch.setattr(stack, "_installed_distribution_version", lambda _n: None)
@@ -841,7 +844,7 @@ def test_a_fresh_uv_venv_still_bootstraps(monkeypatch) -> None:
def test_a_pip_that_cannot_run_is_bootstrapped_again(monkeypatch) -> None:
"""Metadata survives a pip whose __main__.py is gone; `python -m pip` does not."""
- monkeypatch.setattr(stack, "_installed_distribution_version", lambda _n: "24.2")
+ monkeypatch.setattr(stack, "_installed_distribution_version", lambda _n: "26.2.2")
seen: list[list[str]] = []
def broken(cmd, **_k):