Skip to content

Update Rust crate rand to 0.10.0 [SECURITY]#515

Merged
rye merged 1 commit into
mainfrom
renovate/crate-rand-vulnerability
Jul 15, 2026
Merged

Update Rust crate rand to 0.10.0 [SECURITY]#515
rye merged 1 commit into
mainfrom
renovate/crate-rand-vulnerability

Conversation

@renovate

@renovate renovate Bot commented Apr 14, 2026

Copy link
Copy Markdown
Contributor

This PR contains the following updates:

Package Type Update Change
rand (source) dependencies minor 0.9.00.10.0

Rand is unsound with a custom logger using rand::rng()

GHSA-cq8v-f236-94qc

More information

Details

It has been reported (by @​lopopolo) that the rand library is unsound (i.e. that safe code using the public API can cause Undefined Behaviour) when all the following conditions are met:

  • The log and thread_rng features are enabled
  • A custom logger is defined
  • The custom logger accesses rand::rng() (previously rand::thread_rng()) and calls any TryRng (previously RngCore) methods on ThreadRng
  • The ThreadRng (attempts to) reseed while called from the custom logger (this happens every 64 kB of generated data)
  • Trace-level logging is enabled or warn-level logging is enabled and the random source (the getrandom crate) is unable to provide a new seed

TryRng (previously RngCore) methods for ThreadRng use unsafe code to cast *mut BlockRng<ReseedingCore> to &mut BlockRng<ReseedingCore>. When all the above conditions are met this results in an aliased mutable reference, violating the Stacked Borrows rules. Miri is able to detect this violation in sample code. Since construction of aliased mutable references is Undefined Behaviour, the behaviour of optimized builds is hard to predict.

Severity

Low

References

This data is provided by the GitHub Advisory Database (CC-BY 4.0).


Release Notes

rust-random/rand (rand)

v0.10.0

Compare Source

Changes
  • The dependency on rand_chacha has been replaced with a dependency on chacha20. This changes the implementation behind StdRng, but the output remains the same. There may be some API breakage when using the ChaCha-types directly as these are now the ones in chacha20 instead of rand_chacha (#​1642).
  • Rename fns IndexedRandom::choose_multiple -> sample, choose_multiple_array -> sample_array, choose_multiple_weighted -> sample_weighted, struct SliceChooseIter -> IndexedSamples and fns IteratorRandom::choose_multiple -> sample, choose_multiple_fill -> sample_fill (#​1632)
  • Use Edition 2024 and MSRV 1.85 (#​1653)
  • Let Fill be implemented for element types, not sliceable types (#​1652)
  • Fix OsError::raw_os_error on UEFI targets by returning Option<usize> (#​1665)
  • Replace fn TryRngCore::read_adapter(..) -> RngReadAdapter with simpler struct RngReader (#​1669)
  • Remove fns SeedableRng::from_os_rng, try_from_os_rng (#​1674)
  • Remove Clone support for StdRng, ReseedingRng (#​1677)
  • Use postcard instead of bincode to test the serde feature (#​1693)
  • Avoid excessive allocation in IteratorRandom::sample when amount is much larger than iterator size (#​1695)
  • Rename os_rng -> sys_rng, OsRng -> SysRng, OsError -> SysError (#​1697)
  • Rename Rng -> RngExt as upstream rand_core has renamed RngCore -> Rng (#​1717)
Additions
  • Add fns IndexedRandom::choose_iter, choose_weighted_iter (#​1632)
  • Pub export Xoshiro128PlusPlus, Xoshiro256PlusPlus prngs (#​1649)
  • Pub export ChaCha8Rng, ChaCha12Rng, ChaCha20Rng behind chacha feature (#​1659)
  • Fn rand::make_rng() -> R where R: SeedableRng (#​1734)
Removals

Configuration

📅 Schedule: (UTC)

  • Branch creation
    • At any time (no schedule defined)
  • Automerge
    • At any time (no schedule defined)

🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 Ignore: Close this PR and you won't be reminded about this update again.


  • If you want to rebase/retry this PR, check this box

This PR was generated by Mend Renovate. View the repository job log.

@renovate
renovate Bot requested a review from rye as a code owner April 14, 2026 04:31
@codecov

codecov Bot commented Apr 14, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 77.87%. Comparing base (a81c703) to head (22d6570).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #515   +/-   ##
=======================================
  Coverage   77.87%   77.87%           
=======================================
  Files           4        4           
  Lines         226      226           
=======================================
  Hits          176      176           
  Misses         50       50           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@renovate renovate Bot changed the title Update Rust crate rand to v0.9.3 [SECURITY] Update Rust crate rand to v0.9.3 [SECURITY] - autoclosed Apr 27, 2026
@renovate renovate Bot closed this Apr 27, 2026
@renovate
renovate Bot deleted the renovate/crate-rand-vulnerability branch April 27, 2026 18:34
@renovate renovate Bot changed the title Update Rust crate rand to v0.9.3 [SECURITY] - autoclosed Update Rust crate rand to v0.9.3 [SECURITY] Apr 27, 2026
@renovate renovate Bot reopened this Apr 27, 2026
@renovate
renovate Bot force-pushed the renovate/crate-rand-vulnerability branch 2 times, most recently from 056bb28 to b07674b Compare April 27, 2026 23:47
@renovate renovate Bot changed the title Update Rust crate rand to v0.9.3 [SECURITY] Update Rust crate rand to 0.10.0 [SECURITY] Jul 15, 2026
@renovate
renovate Bot force-pushed the renovate/crate-rand-vulnerability branch from b07674b to 22d6570 Compare July 15, 2026 15:30
@rye
rye merged commit 6d1362c into main Jul 15, 2026
9 checks passed
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