Skip to content

Distrust emSign ECC Root CA - G3 in the UK Chronicle rebuild's Modal image - #1769

Merged
anth-volk merged 5 commits into
mainfrom
claude/uk-chronicle-rebuild-emudhra
Nov 27, 2026
Merged

anth-volk merged 5 commits into
mainfrom
claude/uk-chronicle-rebuild-emudhra

Conversation

@anth-volk

@anth-volk anth-volk commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Closes #1768. Tracked as task 5d · 3 of the "1. Collector/Emitter" project.

What changes

tools/modal_rebuild_uk_chronicle_artifact.py rebuilds the pinned Chronicle UK consumer artifact in a Modal container. Its image still trusted emSign ECC Root CA - G3, the eMudhra root that certifi and Debian distrust over eMudhra's disclosed intermediate private keys (changelog.d/emudhra-ca-trust.fixed.md). That matters because a run that opts into uploading carries HF_TOKEN, which can write to the private UK build-inputs repository:

  • uv 0.11.7 compiles in a CA list that still holds that root.
  • uv and huggingface_hub were installed without hash pins through the cached debian_slim base's pip 25.3, whose bundled certifi still contains it.
  • ca-certificates was never upgraded; git's clone of Chronicle and the standard library's ssl module read that CA store.
  • Nothing set a certifi floor for the image's own Python, where the upload's huggingface_hub checks the Hub's certificate against certifi.

The image now does what the US Modal image (_image() in tools/modal_us_stage.py) does, before it downloads anything else:

Step Before After
apt_install git, curl, time adds ca-certificates, which upgrades the base's CA store to Debian's current release
new run_commands none pip_bootstrap_command(): pip 26.2.2 from a requirements file with --require-hashes and the wheel's published sha256, so the one download made with the old pip is checked by hash, not by the connection
pip_install uv==0.11.7, huggingface_hub==1.18.0 (old pip) uv==0.13.4, huggingface_hub==1.18.0, certifi>=2026.10.19, through pip 26.2.2
run_commands uv python install 3.14 (uv 0.11.7) unchanged command, now run by uv 0.13.4
env CHRONICLE_PIN, UV_LINK_MODE, PYTHONDONTWRITEBYTECODE unchanged

Anthony decided two points on 2026-11-26:

  • Separate values. The app keeps its own constants, with comments giving the reasons, as Install the emitter in the UK Modal launcher's image #1758 does for tools/modal_uk_cut.py. Modal imports the app module in the container from /root with no checkout, so reading modal_us_stage_plan.py there would need a copy in the image. The test compares the steps with that module's values (IMAGE_UV_VERSION, image_pip_bootstrap_command(), RUNNER_CERTIFI_MINIMUM_VERSION), loaded by path, so the two images can't drift apart unnoticed.
  • Python download kept. uv python install 3.14 stays, rather than UV_PYTHON_DOWNLOADS=never and the image's own Python, so the environment that has to reproduce the pinned digests changes as little as possible. uv 0.13.4 downloads Python over its updated CA list and rejects a file whose sha256 differs from the one it carries for that release (extract_reader returns HashMismatch). It installs Python 3.14.8, where uv 0.11.7 installed 3.14.4; the receipt's environment.python records the one used.

Docs: the module docstring, the "Rebuilding the Chronicle artifact" section of docs/uk-cut-anyone.md, and changelog.d/1768-uk-chronicle-rebuild-emudhra.fixed.md.

Tests

A new file, packages/microcosm-build/tests/engine_free/uk/test_modal_rebuild_uk_chronicle_artifact.py, checks the image definition against the stand-in modal module that the app's existing tests use. test_modal_uk_cut.py, which #1758 also changes, is left untouched.

Test Failure before the change
test_the_rebuild_image_trusts_no_compromised_certificate_authority assertion: the third image step is pip_install, where the pip bootstrap belongs, and the chain has one step fewer

Red commit 67daae06c; change 822341cec. Review round 1: d616d4adc makes the test also require that none of the four steps between debian_slim and env passes options (such as another index or a trusted host), and fad867845 corrects the wording. Review round 2: 8b84e55ff corrects the wording again. The round 1 reviewer ran the test at 67daae06c (fails on the assertion above) and at 822341cec (passes); the round 2 reviewer ran it at fad867845 (passes). CI runs it on the later commits. Ruff check and format pass on both changed Python files. Nothing ran on Modal: the test checks the image definition, not a built image.

Known gaps, not changed

  • Never built. The new image has not been built or run on Modal, so the bootstrap step, the certifi floor and uv python install under uv 0.13.4 are checked only in the definition. The US image runs the same first three steps on the same debian_slim Python 3.14 base. Whether uv 0.13.4's uv sync --locked accepts Chronicle's lock unchanged is unverified.
  • Unhashed build tools. uv sync --locked installs Chronicle's locked packages by hash. But odfpy 1.4.1 has only a source archive and Chronicle installs as an editable hatchling project, so setuptools, hatchling and their dependencies are fetched at sync time without hashes, over uv 0.13.4's CA list. They run as the same user as the function that holds HF_TOKEN.
  • Chronicle's workbook downloads. chronicle.source_package fetches the two DESNZ workbooks with httpx, which checks certificates against the certifi in Chronicle's lock; at the pinned commit that is certifi 2026.10.19. The workbooks are also checked against pinned sha256 values, and those processes get no HF_TOKEN in their environment.

Checked, not changed

  • Debian's CA store. Modal's 3.14 base is Debian bookworm, whose main archive still ships all four emSign roots, so the ca-certificates upgrade comes from bookworm-security. Debian's security tracker lists bookworm-security's 20250419~deb12u2 as the fixed release for DLA-4845-1, and according to that advisory it removes emSign ECC Root CA - G3 and the Comodo AAA Services root. git's clone of Chronicle, the Hub's Xet upload path (hf_xet, which reads the operating system's store) and pip 26.2.2 (through truststore, beside its vendored certifi) all check certificates against that store, so every unhashed package the upload runs with HF_TOKEN, all installed by pip 26.2.2, depends on this step as well as on the newer pip.

Found, not changed

  • Other emSign roots. uv 0.13.4's compiled-in list (webpki-root-certs 1.0.10), pip 26.2.2's vendored certifi and certifi 2026.10.19 still trust emSign Root CA - G1, emSign Root CA - C1 and emSign ECC Root CA - C3. certifi 2026.10.18 left out all four emSign roots; 2026.10.19 restored G1, C1 and C3 in a commit titled "Restore unaffected emSign roots", and Debian's fix removes only G3 among them. certifi 2026.10.23, an automated update from Mozilla's bundle, then removed C1 and C3 without giving a reason; G1 is in every release since 2026.10.19. The US image, Install the emitter in the UK Modal launcher's image #1758 and the rest of the eMudhra work use the 2026.10.19 floor. This PR keeps the US image's values. On 2026-11-26 Anthony decided to record the other roots only, with no change here or in the rest of the eMudhra work.

Deployment

This changes a Modal image definition. Every environment variable and secret the app reads or declares; this PR adds none and changes none:

Variable Provider Wiring
HF_TOKEN The operator's shell at modal run, sent as an ephemeral secret (modal.Secret.from_dict in _secrets()) only when MICROCOSM_UK_CHRONICLE_MODAL_UPLOAD=1; no named Modal secret Ephemeral secret → the rebuild function's environment → _upload() → huggingface_hub.HfApi(token=…). rebuild() removes it from the environment it passes to uv sync, the chronicle commands and python --version (env.pop). The three git calls (clone, checkout, rev-parse) are started without env=, so they inherit it; git sends it nowhere. Unchanged; on Modal with the new image, unverified (never run)
MICROCOSM_UK_CHRONICLE_MODAL_UPLOAD The operator's shell Read on the launching machine by _secrets() and main(); not sent to Modal. Unchanged
CHRONICLE_PIN The image definition (.env), from packages/microcosm-build/src/microcosm/build/uk/chronicle_feed.json in the launching checkout; not a credential Image environment → the container's module import, which reads the pin from it. Unchanged
UV_LINK_MODE, PYTHONDONTWRITEBYTECODE The image definition; fixed values Image environment. Unchanged
LEDGER_SOURCE_ARTIFACT_FETCH, UV_PYTHON, UV_PROJECT_ENVIRONMENT Set by rebuild() in the subprocess environment; fixed values rebuild() → uv sync and the chronicle commands. Unchanged

PIP_BOOTSTRAP_REQUIREMENTS (/tmp/pip-bootstrap.txt) is a file path used inside one image build step, not an environment variable.

Review

  • Round 1 (head 822341cec): three bugs, all fixed in wording; no code behaviour changed.

    • Medium: the comments, docstring, guide paragraph and changelog said the releases drop "the eMudhra roots", but they drop only emSign ECC Root CA - G3. They now name that root (fad867845); the other roots are under "Found, not changed".
    • Low: the environment table said the build's subprocesses get no HF_TOKEN, but the git calls inherit it. The table now says so.
    • Low: the old "same user" gap said uv sync --locked installs every package by hash, which is untrue for build tools. "Unhashed build tools" now says what is fetched without hashes.

    From its code-quality points: the test now checks step options (d616d4adc); the guide, the fragment and this description name Python 3.14.8 and 3.14.4; and the workbook gap now says Chronicle's lock already pins certifi 2026.10.19. The reviewer confirmed the step order, the values' equality with the US module, the test's red and green results, huggingface_hub 1.18.0's use of certifi through httpx, and uv's hash check of Python downloads.

  • Round 2 (head fad867845): two low-priority bugs, both in wording, fixed.

    • The certifi comment said 2026.10.19 is the first release without emSign ECC Root CA - G3, but 2026.10.18 already left it out, and the "removed after the 2026-10-20 disclosure" phrasing contradicted those dates. 8b84e55ff drops the date ordering and says what each certifi release holds. The same sentence is in the US plan module and changelog.d/emudhra-ca-trust.fixed.md, which this PR doesn't change.
    • The Debian CA-store gap left out pip's use of that store and the second root Debian removes. It is now under "Checked, not changed", with the fixed release confirmed.

    The reviewer confirmed the round 1 fixes, the Python releases, and that the new option check would fail on a keyword option such as extra_index_url=. It doesn't cover debian_slim(python_version=…), which is not a download setting.

  • Round 3 (head 8b84e55ff): one low-priority bug, fixed. The PR title said "the eMudhra roots"; it now names emSign ECC Root CA - G3, so the merge commit on main is accurate. Two description points are also corrected (which steps the option check covers; the upload's packages come from pip only). The reviewer confirmed the round 2 fix against certifi's tagged bundles, ran the test at 8b84e55ff (pass) and ran ruff check and format (pass).

    Left, so as not to restart CI for a comment: the test's comment says no step "before the environment" passes options, but the check skips debian_slim(python_version=…), which sets the Python version, not a download source.

What the merge waits for

Nothing in the tracker. Anthony marks it ready and merges it. It doesn't build on #1758 (5d · 2), which applies the same measures to tools/modal_uk_cut.py. This PR leaves test_modal_uk_cut.py alone, and its docs/uk-cut-anyone.md hunk is in a different section from those of #1758, #1743 and #1538, so no text conflict is expected. If Anthony merges 5d's tasks in tracker order, this one follows #1758.

🤖 Generated with Claude Code

anth-volk and others added 5 commits November 26, 2026 21:57
The rebuild's Modal image must drop the compromised eMudhra (emSign)
certificate authorities before it downloads anything, as the US Modal
image does: ca-certificates in apt_install, the hash-pinned pip 26.2.2
in place of the base's pip 25.3, then uv 0.13.4 and certifi 2026.10.19
or later beside huggingface_hub. The test compares those steps with
tools/modal_us_stage_plan.py's values. It fails on an assertion now.

Refs #1768

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
As the US Modal image does, the rebuild's image now drops the
compromised eMudhra (emSign) certificate authorities before it
downloads anything else: apt_install names ca-certificates, a
hash-pinned pip 26.2.2 replaces the cached base's pip 25.3, and uv
0.13.4 (was 0.11.7) and certifi 2026.10.19 or later are installed
beside huggingface_hub. The upload's Hub client, which carries
HF_TOKEN, checks the Hub's certificate against that certifi. The app
keeps its own constants; the test compares them with
tools/modal_us_stage_plan.py's.

Closes #1768

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Review round 1 of #1769: the test compared only each image step's
positional arguments, so an index URL or a trusted-host option on
pip_install would have passed it. It now requires that no step before
the environment passes options, and its docstring names emSign ECC
Root CA - G3, the root the image stops trusting.

Refs #1768

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Review round 1 of #1769: uv 0.13.4, pip 26.2.2's certifi and certifi
2026.10.19 drop only emSign ECC Root CA - G3, the root certifi and
Debian removed after the 2026-10-20 disclosure, so the comments,
docstring, guide paragraph and changelog fragment now name it rather
than "the eMudhra roots". The guide and the fragment also give the
Python release uv 0.13.4 installs (3.14.8; uv 0.11.7 installed 3.14.4).

Refs #1768

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Review round 2 of #1769: certifi 2026.10.18 already left out every
emSign root, and 2026.10.19 restored the three certifi judged
unaffected, so 2026.10.19 is not the first release without emSign ECC
Root CA - G3, and that removal did not follow a 2026-10-20 disclosure.
The comments, docstrings, guide paragraph and changelog fragment no
longer order the events by date; the certifi comment says what each
release holds. The floor stays 2026.10.19, as in the US image.

Refs #1768

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@anth-volk anth-volk changed the title Distrust the eMudhra roots in the UK Chronicle rebuild's Modal image Distrust emSign ECC Root CA - G3 in the UK Chronicle rebuild's Modal image Nov 26, 2026
@anth-volk
anth-volk marked this pull request as ready for review November 27, 2026 13:31
@anth-volk
anth-volk merged commit a50bdee into main Nov 27, 2026
11 checks passed
@anth-volk
anth-volk deleted the claude/uk-chronicle-rebuild-emudhra branch November 27, 2026 13:32
juaristi22 added a commit that referenced this pull request Nov 27, 2026
…mitter, the Chronicle rebuild image's roots and US base changes (#931)

Main took six pull requests since 5589fae: #1743 (UK cuts publish their
build into its own folder through the emitter, and the retired Orrery upload
flag goes), #1747, #1737, #1770 and #1773 (the US base build's hash inputs,
final export carry, memory profile and system-only JCT reform) and #1769 (the
UK Chronicle rebuild's image distrusts the eMudhra roots). The emitter
interface moves to 0.18.0; no feed or engine pin moves.

Two files conflicted.
- tools/run_uk_cut.py: main replaced the staging-branch constant with the
  emitter publisher; this branch's spine inputs, build-inputs repository and
  disk and memory floors for dense-spine stay beside it.
- docs/agent-guide.md: main's account of publishing through the emitter,
  with this branch's dense-spine command and the national step's refusal
  until the atomic-area basis exclusion applies on the national line. The
  sentence on the tagged publisher's arguments goes, since the cut no longer
  builds them.

The gate contract pins, the stage table, the coverage manifest, the US F0
report and the US pins are current on the merged tree.

Checks: with policyengine-uk hidden, as in CI's engine-free job, the tests
main's six pull requests change, the cut and full-build CLI tests, the
spec-engine loader and the UK graph's binding rules (1,556 pass); the US
coverage report and pins, the gate pins, the stage table and the coverage
manifest (--check); CI's test plan verify.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.

The UK Chronicle rebuild's Modal image still trusts the compromised eMudhra certificate authorities

1 participant