From d8c25c670e36fb3b0f0ba85caeec7a773001b0ba Mon Sep 17 00:00:00 2001 From: limagoog Date: Wed, 21 Oct 2026 17:16:21 +0000 Subject: [PATCH] Require certifi >= 2026.10.19 for the emSign/eMudhra CA compromise certifi releases before 2026.10.19 trust the compromised emSign/eMudhra roots (GHSA-6q48-6c7w-9gw2), so a MITM could forge a kaggle.com cert and steal API tokens. #1223 pinned certifi only in requirements.lock and tools/releases/requirements.txt, which pip ignores for `pip install kaggle`. kaggle pulled certifi only via requests, which sets no floor, so existing installs could keep a vulnerable bundle. This adds the floor to the published dependencies, and refreshes the OS ca-certificates and pip in the CI image, mirroring Kaggle/kagglehub#318 and Kaggle/kaggle-sdk-python#75. Co-authored-by: kaggle-agent --- CHANGELOG.md | 1 + pyproject.toml | 2 ++ requirements.lock | 4 +++- tools/cicd/Dockerfile | 5 +++-- 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4e546274..4c87a7e3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ Changelog ### Next +* Require `certifi >= 2026.10.19`, which drops the compromised emSign/eMudhra root CAs ([GHSA-6q48-6c7w-9gw2](https://github.com/certifi/python-certifi/security/advisories/GHSA-6q48-6c7w-9gw2)). `kaggle` only pulled in certifi through `requests`, which sets no minimum, so an existing install could keep a certifi that would accept a forged kaggle.com certificate and leak the user's API token to a man-in-the-middle * Report a 404 from `kaggle competitions submit` with a competition-specific hint on stderr, naming the notebook and version for code submissions. The check never matched a 404, so users got the generic `/` hint instead * Exit non-zero from `kaggle competitions submit` when the submission file upload fails. It printed "Could not submit to competition" and exited 0, so scripts treated the failed submission as a success * Stream `kaggle kernels output` files to disk through the same download path as datasets and competitions, with a read timeout, a size check, and resume after a dropped connection. Each file used to be read into memory whole, so a 512 MiB output took about 1.2 GB of RAM, and a dropped connection failed the command and left an empty file behind diff --git a/pyproject.toml b/pyproject.toml index fca755af..b9901768 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -27,6 +27,8 @@ dependencies = [ "kagglesdk >= 0.1.37, < 1.0", # sync with kagglehub "python-slugify", "requests", + # requests sets no certifi floor; older bundles trust the compromised emSign/eMudhra roots (GHSA-6q48-6c7w-9gw2). + "certifi >= 2026.10.19", "python-dateutil", "tqdm", "urllib3 >= 1.15.1", diff --git a/requirements.lock b/requirements.lock index 2fbb2395..8bde8828 100644 --- a/requirements.lock +++ b/requirements.lock @@ -11,7 +11,9 @@ attrs==26.1.0 bleach==6.3.0 # via kaggle (pyproject.toml) certifi==2026.10.19 - # via requests + # via + # kaggle (pyproject.toml) + # requests charset-normalizer==3.4.6 # via requests fastjsonschema==2.21.2 diff --git a/tools/cicd/Dockerfile b/tools/cicd/Dockerfile index ca6b6b0e..dd01bc67 100644 --- a/tools/cicd/Dockerfile +++ b/tools/cicd/Dockerfile @@ -5,8 +5,9 @@ ARG PYTHON_VERSION FROM python:${PYTHON_VERSION} -RUN python -m pip install --upgrade pip +# Pick up the emSign/eMudhra CA removal (GHSA-6q48-6c7w-9gw2) in the OS trust store and Python tooling. +RUN apt-get update && apt-get install -y --only-upgrade ca-certificates && rm -rf /var/lib/apt/lists/* -RUN python -m pip install hatch==1.16.5 +RUN python -m pip install --upgrade "pip>=26.2.2" "certifi>=2026.10.19" hatch==1.16.5 ENTRYPOINT ["hatch"] \ No newline at end of file