Skip to content

deps: bump rand to 0.9.4 in gen-datasets (GHSA-cq8v-f236-94qc)#98

Merged
iainmcgin merged 1 commit intomainfrom
deps/rand-0.9.3
May 6, 2026
Merged

deps: bump rand to 0.9.4 in gen-datasets (GHSA-cq8v-f236-94qc)#98
iainmcgin merged 1 commit intomainfrom
deps/rand-0.9.3

Conversation

@iainmcgin
Copy link
Copy Markdown
Collaborator

Resolves Dependabot alert #2GHSA-cq8v-f236-94qc, rand 0.9.0–0.9.2 unsound (low severity).

What the advisory is

rand's RngCore methods on ThreadRng use unsafe to cast *mut BlockRng<ReseedingCore> to &mut. If a custom log::Log implementation re-enters rand::rng() while the inner RNG is mid-reseed (which happens every 64 KiB of output), an aliased &mut is constructed — UB. Patched in rand 0.9.3.

Why the risk is ~zero for buffa

  • rand only appears in benchmarks/gen-datasets/Cargo.lock — a one-shot dataset-generator CLI. It is not a dependency of any of the 7 published crates, the workspace Cargo.lock, the examples, or the other benchmark crates.
  • The trigger requires a custom logger that calls rand::rng() from inside a log message, with the log and thread_rng features enabled, at trace-level logging, during a reseed event. The dataset generator has no logger.

This is hygiene, not a fix for an exploitable issue. No release needed.

What changed

  • cargo update -p rand in benchmarks/gen-datasets/rand 0.9.2 → 0.9.4 (latest 0.9.x, ≥ the 0.9.3 floor). No Cargo.toml change — already pinned to "0.9".
  • Verified the deterministic fixtures are byte-identical under 0.9.4 by running task gen-datasets and md5-comparing: api_response.pb, analytics_event.pb, google_message1_proto3.pb all unchanged. log_record.pb and media_frame.pb differ on every regen run regardless of rand version (their map<...> fields encode in HashMap iteration order), so they were not regenerated.
  • Drive-by Taskfile doc fix: the gen-datasets task description only listed log_record.pb as process-nondeterministic, but media_frame.pb (added in benchmarks: add prost bytes-feature variant + MediaFrame for zero-copy comparison #61) has the same property via its map<string, bytes> attachments field. Updated the doc to list both nondeterministic fixtures and all three reproducible ones.

rand 0.9.0-0.9.2 has a soundness bug (aliased &mut in ThreadRng's
RngCore methods when a custom logger re-enters rand::rng() during a
reseed). Patched in 0.9.3; cargo update picked 0.9.4. The trigger
conditions (custom log::Log impl + thread_rng feature + trace-level
logging + reseed mid-call) don't apply to the dataset generator, which
is a one-shot CLI with no logger, so this is hygiene only.

The only Cargo.lock with rand is benchmarks/gen-datasets/ (a dev tool,
not a published crate). The deterministic fixtures (api_response.pb,
analytics_event.pb, google_message1_proto3.pb) are byte-identical
under 0.9.4 - verified with task gen-datasets - so no fixture churn.

Drive-by Taskfile doc fix: media_frame.pb is also process-
nondeterministic (map<string, bytes> attachments field encodes in
HashMap iteration order), same as log_record.pb. The doc only mentioned
log_record.pb because media_frame.pb was added later in PR #61.
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 6, 2026

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@iainmcgin iainmcgin marked this pull request as ready for review May 6, 2026 01:00
@iainmcgin iainmcgin requested a review from asacamano May 6, 2026 01:00
@iainmcgin iainmcgin enabled auto-merge (squash) May 6, 2026 17:30
@iainmcgin iainmcgin merged commit 90c3db1 into main May 6, 2026
7 checks passed
@iainmcgin iainmcgin deleted the deps/rand-0.9.3 branch May 6, 2026 17:31
@github-actions github-actions Bot locked and limited conversation to collaborators May 6, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants