Skip to content

ci: stop trusting the eMudhra (emSign) certificate authorities - #253

Merged
JuroOravec merged 6 commits into
mainfrom
chore/emsign-ca-distrust
Oct 22, 2026
Merged

JuroOravec merged 6 commits into
mainfrom
chore/emsign-ca-distrust

Conversation

@JuroOravec

@JuroOravec JuroOravec commented Oct 22, 2026 •

Copy link
Copy Markdown
Member

On 2026-10-20 the Python security team announced that the private keys of several eMudhra (emSign) certificate authorities can be recovered. They all chain to one root, "emSign ECC Root CA - G3". Any tool that still trusts that root can be fooled into talking to a fake pypi.org. This PR updates every place where Citry's builds use a Python tool to download or upload packages, and adds a blog post for users.

Citry's packages are not affected: none of them depends on certifi or makes HTTPS calls while an app runs. So there's no package release or changelog entry.

What changes

  • PyPI upload. pypa/gh-action-pypi-publish goes to v1.14.3 (7245906f), which fixes GHSA-5xjx-3w67-w9x9. The old pin bundled a certifi that trusted emSign for Trusted Publishing and the upload.
  • uv. uv is pinned to 0.13.5 (it was 0.10.12) in the publish workflows, docs check, docs release, docs deploy (which was on latest), examples tests, and the starter and demo check.yml files. 0.13.4 dropped the root; 0.13.5 also rejects chains that contain the compromised intermediate keys. pyodide-build.json stays the single source for the version.
  • pip. Before the citry-ui wheel tests and the VS Code language-server installs reach PyPI, they install pip 26.2.2 from a URL with a #sha256= checksum. pip checks that checksum itself, and I confirmed it rejects a wrong hash. pip 26.2.2 also trusts the operating system's certificate list, and on Debian 12 and older runner images that list still has the root. So after the upgrade these steps set PIP_USE_DEPRECATED=legacy-certs, and pip uses only its own certifi. Older pip rejects that value, so the one step that makes a fresh, offline venv unsets it.
  • certifi is at 2026.10.19 in the root, benchmark, and agent-usage locks, and in the benchmark constraint pins. The agent-usage image upgrades pip first and uses its own certificate list for the install.
  • Validator. scripts/validators/toolchain.py now reads every workflow and example workflow as YAML, works out which uv version each setup-uv step actually gets (following ${{ env.* }} at workflow, job, and step level), and requires the exact pin in the publish, docs, and examples workflows. It also checks every gh-action-pypi-publish use. Before, the uv env values, the vscode publisher, single pins among several, and the pygments publisher went unchecked. New test: packages/py/citry/tests/test_toolchain_validator.py.
  • docs/codebase.md gives the minimum uv version.
  • Blog post docs_site/content/blog/2026-10-22-emsign-certificate-incident.md: what happened, what users should update, and what we changed.

What this PR leaves open (follow-ups)

Tracked in #255.

  • Node.js-based steps still trust emSign. Node 26.5 bundles all four emSign roots. Affected: the setup-* actions downloading tools, the Playwright browser downloads, and the vsce and ovsx uploads that send the Marketplace and Open VSX tokens. These get fixed when GitHub's runners ship a Node.js release without the root. The blog post says so.
  • setup-uv v7.6.0 has no checksum for any uv after 0.10.10, so it installs uv without checking the download. v10.3.2 knows 0.13.5 but crosses three major versions, including cache behavior changes, so it deserves its own PR.
  • Build backends are not hash-locked. uv build downloads setuptools/maturin without hashes. Pinning them would use --build-constraint with hashes.
  • The publish workflows can only run from main. The first real test of uv 0.13.5 there will be the next qualification run. Run one operation=qualify dispatch soon after merging.

Checks

  • scripts/check.py --profile fast: passed (all 20 phases).
  • scripts/check.py --profile full on 016ef4646: passed (all 21 phases, with coverage).
  • python -m docs_site build-check: 0 errors, 0 warnings.
  • mypy --platform linux scripts/validators/toolchain.py: clean.
  • Validator mutation checks: a stray pin in a starter, an env value, one citry-core setup, a publisher on latest, an omitted version, an old or recased upload action, and an old pnpm action all fail as expected.
  • Error-benchmark validate and its 195 tests pass with the relocked certifi.

Two independent review agents (technical and prose) reviewed the change, and I folded their findings in.

🤖 Generated with Claude Code

JuroOravec and others added 3 commits October 22, 2026 14:41
The emSign certificate authorities' private keys can be recovered, so the
tools that ship their own certificate list need updates (pip 26.2.2,
uv 0.13.4, certifi 2026.10.19).

- Publish with pypa/gh-action-pypi-publish 1.14.3 (GHSA-5xjx-3w67-w9x9),
  whose certifi no longer includes the emSign root.
- Pin uv 0.13.5 in the release, docs, and examples workflows and in the
  starter and demo check.yml files. The toolchain validator now reads the
  pin from pyodide-build.json and also covers the example workflows.
- Install pip 26.2.2 from a hash-checked URL before the citry-ui wheel
  tests and the VS Code language-server installs download from PyPI.
- Raise certifi to 2026.10.19 in the root, benchmark, and agent-usage locks,
  and upgrade pip first in the agent-usage image.
- Add a blog post for users about the incident.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Address review findings on the emSign change:

- pip 26.2.2 also trusts the operating system's list, which on Debian 12
  and older runner images still holds emSign ECC Root CA - G3. After the
  hash-checked upgrade, CI and the agent-usage image set
  PIP_USE_DEPRECATED=legacy-certs so pip uses only its bundled certifi.
- The toolchain validator parses every workflow and the example
  check.yml files, resolves ${{ env.* }} references, requires the reviewed
  uv in publish, docs, and examples workflows, and checks every
  gh-action-pypi-publish use. A new test covers the drift cases.
- docs/codebase.md states the minimum uv.
- The blog post names the one affected root, the operating-system list,
  build-backend downloads, Node.js-based downloads, and corrects the uv
  advice.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
- Move the pnpm pin check back inside its per-workflow loop; the previous
  commit left it checking only the last file.
- The docs deploy workflow now pins the reviewed uv, and the pin checker
  matches action names without regard to case, reads step env, and reads
  .yaml files and every example workflow.
- The agent-usage image sets PIP_USE_DEPRECATED=legacy-certs only for its
  install, so a new virtual environment in the image keeps working.
- Blog post: names the affected root, the pip setting's side effects, the
  Ubuntu 24.04 fix, and the Node.js-based uploads.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
JuroOravec and others added 2 commits October 22, 2026 16:53
#244 raised citry's pin to citry-core==1.9.0 but left the distribution
verifier expecting 1.8.0, so every citry wheel check failed with
"unexpected runtime dependencies". The verifier now reads citry-core's
own [project] version, and a test checks that citry pins that release.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…asses

The Windows test job failed 15 tests:

- The toolchain and published-README validators printed paths with
  backslashes on Windows. They now name files with forward slashes on
  every OS, as the repository does, so messages read the same everywhere.
- test_json_ranges_of_every_rule_family_count_from_zero stripped the
  temporary directory with a hard-coded "/"; it now uses os.sep.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@JuroOravec
JuroOravec added this pull request to stack #257 October 22, 2026 17:06
@JuroOravec
JuroOravec merged commit 3c7f452 into main Oct 22, 2026
28 of 29 checks passed
@JuroOravec
JuroOravec deleted the chore/emsign-ca-distrust branch October 22, 2026 17:07
JuroOravec added a commit that referenced this pull request Oct 22, 2026
#253 landed as a squash commit whose tree equals f336ada, which this
branch already contains, so this branch's tree is kept unchanged.

Co-Authored-By: Claude Opus 5.5 <[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.

1 participant