Repository navigation
chore(deps): update flate2 to 1.1.11, which decompresses with miniz_oxide 0.9.1 - #12191
Conversation
…xide 0.9 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
🔵 Needs a closer look
Execution-owner sign-off is needed because miniz_oxide 0.9.1 can reject previously installed Wasm during recompilation, while mainnet coverage is incomplete and the proposed lossless recovery path is untested.
No open issues 🎉
What changed in this PR
Updates flate2 to 1.1.11 across Cargo and Bazel, lifting the dependency hold from #12180. This switches decompression to miniz_oxide 0.9.1; the PR documents the compatibility risk for previously accepted, unusual gzipped canister modules.
Changes:
- Aligns both build systems on flate2 1.1.11.
- Removes miniz_oxide 0.8.9 from the locks and updates dependency features and references.
- Records the optional zlib-rs backend without enabling it.
| File | Description |
|---|---|
| Cargo.toml | Raises the workspace flate2 requirement to 1.1.11. |
| Cargo.lock | Updates Cargo’s resolved compression dependencies. |
| Cargo.Bazel.toml.lock | Updates Bazel’s resolved compression dependencies. |
| Cargo.Bazel.json.lock | Refreshes Bazel dependency references, features, and checksums. |
| bazel/rust.MODULE.bazel | Aligns Bazel’s flate2 requirement with Cargo. |
Review effort: Balanced
There was a problem hiding this comment.
🔵 Needs a closer look
Execution-team sign-off is needed because stricter persisted-Wasm decoding may stop existing canisters from executing, while compatibility for most installed modules and stored snapshots remains unverified.
No open issues 🎉
Review effort: Balanced
…e (RUSTSEC-2026-0258) (dfinity#12193) Removes h2 0.3.27 from both lock files by turning off actix-web's `http2` feature. The daily RustSec job (`.github/workflows/rust-advisories.yml`, e.g. [run 44535761188](https://github.com/dfinity/ic/actions/runs/44535761188)) reports h2 0.3.27 with RUSTSEC-2026-0258: - h2 accepts and queues empty DATA frames without limit. - If a stream is not drained, the peer can make memory grow without bound, or cause a panic once the length overflows. - The advisory rates it low severity. **Why h2 0.3 can't be updated:** - h2 0.3 has no fixed release; the 0.4 line is fixed from 0.4.16. A 0.3 backport (hyperium/h2#948) was closed unmerged. - Our other h2 users (hyper, tonic, reqwest, hickory-net) are on 0.4.20. - h2 0.3 comes only from actix-http's optional `http2` feature, and actix-http has no release on h2 0.4. actix/actix-web#4199 asks for one, and moving to h2 0.4 also means moving actix-http from http 0.2 to http 1. **Who uses actix-web:** - ICP Rosetta uses it directly. - rosetta-core, which ICRC Rosetta also uses, pulls it in through actix-web-prom, which enables only actix-web's `macros` feature. - Only ICP Rosetta runs an actix-web server. ICRC Rosetta serves with axum. # Behaviour change: ICP Rosetta serves HTTP/1.x only - ICP Rosetta's server listens on plain TCP (`HttpServer::bind`), without TLS. - Since actix-web 4.19, a plaintext listener also accepts cleartext HTTP/2 (h2c) by default when the `http2` feature is on. - dfinity#12177 moved actix-web from 4.13 (Cargo) and 4.9 (Bazel) to 4.20. So ICP Rosetta built from master since then accepts h2c, and with it reaches h2 0.3. - Without the feature it accepts HTTP/1.x only, as every released ICP Rosetta did. A client that starts with the HTTP/2 preface now gets a 400 from the HTTP/1 parser. - The last release, 2.1.10 (2026-07-01), predates dfinity#12177, and Rosetta images are only published by the manual Rosetta Release workflow. So no published image ever accepted h2c, and the CHANGELOG needs no entry. - Released images do link h2 0.3.27, but can't reach it. Image scanners will keep flagging it until the next ICP Rosetta release. - No client in the repo talks to ICP Rosetta over HTTP/2. Its clients use plain reqwest over `http://`, which speaks HTTP/1.1. FYI @dfinity/defi, who own `rs/rosetta-api`. # Changes - `Cargo.toml` and `bazel/rust.MODULE.bazel`: remove `http2` from actix-web's features. - **Locks:** - In both lock sets only h2 0.3.27 goes, and the only dependency edge removed is actix-http's edge to it. - hyper, tonic, reqwest and hickory-net now list plain `h2` instead of `h2 0.4.20`, since only one h2 is left. # Verification - **Advisories:** I ran the workflow's pinned tools on this branch, cargo-deny 0.21.0 on `Cargo.lock` and cargo-audit 0.23.0 on `Cargo.Bazel.toml.lock`. Neither reports RUSTSEC-2026-0258 any more; three vulnerabilities remain: - libsqlite3-sys, fixed in dfinity#12194; - rsa 0.9 and crypto-bigint 0.5, which need upstream releases first. - **Locks:** in the dev container, `cargo update --workspace` reports "Locking 0 packages". A second `./bin/bazel-pin.sh` reports "Nothing to repin.", and `bazel mod deps` leaves `MODULE.bazel.lock` unchanged. - **Build:** `cargo check --all-targets --all-features -p ic-rosetta-api -p rosetta-core` passes, and the ICP Rosetta binaries build with Bazel. The Bazel-built binaries contain no h2 0.3 code. - **Tests:** these pass locally. They exercise HTTP/1.1; nothing tests that h2c is refused. - `//rs/rosetta-api/common/rosetta_core:rosetta_core_unit_tests`; - `//rs/rosetta-api/icp:rosetta-api_test`; - `//rs/rosetta-api/icp:icp_rosetta_system_tests`, which serves the Rosetta API over HTTP; - `//rs/rosetta-api/icp/tests/integration_tests:rosetta-integration_tests/tests_test`. - **Lint:** CI's Cargo Lint job, which runs `./ci/scripts/rust-lint.sh`, passes. - **CI:** before this PR was stacked on dfinity#12191, CI ran every Bazel target, long tests included, on 419d088 (the same change on top of 375a6af). All 1,163 tests pass, including `icp_rosetta_system_tests` and the `rosetta_test_local` and `rosetta_neuron_follow_test_local` system tests. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Updates flate2 from 1.1.9 (Cargo) and 1.1.5 (Bazel) to 1.1.11 in both builds. Since 1.1.10, flate2's default backend is miniz_oxide 0.9 instead of 0.8, and the locks resolve it to miniz_oxide 0.9.1.
#12180 held flate2 back for this reason:
This description sets out how far that risk goes. Whether to take it is for the Execution team to decide (@dfinity/core-protocol, which owns
rs/embedders).Recommendation: take it. A hit is very unlikely (see below). If one happens, it is limited to that canister, it shows in the replica's metrics, and a replica release that restores the old rule undoes it.
What changes for gzipped canister modules
One stream shape is newly rejected.
inflate_tablerule for rule.decode_wasmpath changes which modules are accepted.No common compressor produces that shape:
At least two codes:
A 1-bit code: miniz, miniz_oxide, zopfli, libflate and Go's compress/flate give a lone symbol a 1-bit code, which both versions accept.
dfx compresses with flate2 when
"gzip": trueis set and whenever it rewrites a gzipped module. It has used miniz_oxide since 0.24.2 (fix(sdk): Asset evidence computation reproducibility fix sdk#3958), and zlib-ng before that.IC tooling:
gzip --best --no-name.gzip --no-name.Experiments: none of the encoders that could be run here produced such a table. They were GNU gzip, pigz, busybox, 7-Zip, zlib via Python, Node and Java, zlib-rs, libdeflate, zopfli, libflate, the deflate crate, and miniz_oxide 0.8.9 and 0.9.1, directly and through flate2. The runs covered:
Go, ISA-L, pako and zlib-ng were checked in source only.
None of the real modules we could obtain has it. All 2,290 distinct canister modules we found decode to identical bytes with flate2 1.1.5, 1.1.9 and 1.1.11. None of their 79,097 dynamic blocks has an incomplete or single-symbol table. The modules came from:
mainnet-canister-revisions.jsonsince 2024-10 (581 module hashes);Most installed modules are not among them. A sample of 3,000 mainnet canisters from the public dashboard API had 843 with a module. Only 252 of those run one of the modules above, and 241 of the 252 are asset canisters. Checking the rest needs the installed modules themselves. Someone with access to a recent checkpoint could scan the canisters' and snapshots'
software.wasmfiles for the shape; this is the check #12180 asked for.If an installed module has the shape, for example because it was hand-crafted or fuzzed:
CanisterInvalidWasm) on every node, and so do heartbeats and timers.canister_heartbeatpays it every round until it freezes, and a global timer that fires is used up.canister_pre_upgrade, because the upgrade runs that hook from the old module. The options:skip_pre_upgrade: this works and keeps stable memory. It loses whatevercanister_pre_upgradewould have saved, which for canisters that serialize their heap in that hook is all heap state. With enhanced orthogonal persistence, addingwasm_memory_persistence = keeploses nothing.sandboxed_execution_replica_cache_lookupswithlookup_resultembedder_cache_hit_compilation_errororcompilation_cache_hit_compilation_errorcounts executions that hit a cached compilation error. A broken canister would make it rise after the rollout.Alternatives, if execution wants no change in what is accepted:
=0.9.0. flate2 1.1.11 accepts it, and it still has 0.8.9's rule; 0.9.1's only other changes affect wasm32. The costs:Cargo.tomland acrate.specinbazel/rust.MODULE.bazel.decode_wasmthat counts decoded modules with the rejected shape in a metric, and switch once mainnet reports none for a release. The costs:decode_wasmruns in the compiler sandbox, so the count has to come back with the compilation result.Other changes
Content-Encoding: deflatethat are truncated or lack the trailer are now rejected instead of parsed. Truncated gzip bodies only get a different error. Bodies with the newly rejected table shape are rejected too. ICRC Rosetta doesn't decompress requests.DeflateDecoder, for v1-certifieddeflateresponses. It runs in PocketIC's HTTP gateway and in the ic-gateway binary that GuestOS ships for cloud engine nodes..tar.gzbranch ofic-http-utils' archive extraction, which only the orchestrator calls, to fetch the registry store during subnet recovery;08 1D→78 01);read::GzEncoderandbufread::GzEncoderat level 1./metricsresponses, through tower-http at the default level. Nothing stores, hashes or certifies those bytes. No production canister links flate2, so all 44 canisters in//publish/canistersare byte-identical with and without this change (PR base 4b4fc5d).1.0.31to1.1.11inCargo.tomlandbazel/rust.MODULE.bazel.default,simdandwith-allocfeatures, which backtrace's copy now also gets.runtime_detectiononly enables crc32fast'sstdfeature, which was already on.Verification
Locks: in the dev container,
cargo update --workspacereports "Locking 0 packages"../bin/bazel-pin.shreports "Nothing to repin.", andMODULE.bazel.lockdoesn't change.Lint:
./ci/scripts/rust-lint.shpasses.Tests: these pass on the rebased head:
//rs/embedders:embedders_test;//rs/embedders:embedders_integration_tests/misc_tests;//rs/execution_environment:execution_environment_misc_integration_tests/execution_test_test, which installs gzipped modules;//rs/http_utilstests.Evidence: the figures above come from:
//publish/canisterswith and without this change.For each part except the dashboard sample, a second AI agent re-checked the first one's findings with its own code and runs. The figures above include its corrections. The scripts and raw results are not in the repo.
This PR carries the
CI_ALL_BAZEL_TARGETSlabel.🤖 Generated with Claude Code