Repository navigation
chore(rust): upgrade ed25519-dalek 2.x -> 3.x and rand 0.8 -> 0.10 (fixes #3355) - #3420
Conversation
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
🤖 AI Agent: code-reviewer — View details
TL;DR: 0 blockers, 0 warnings. Safe and clean upgrade.
No issues found. Clean change. |
🤖 AI Agent: contributor-guide — View details
Welcome, and thank you for your contribution! Great job coordinating the Before we can merge, please address the following:
For more details, refer to our CONTRIBUTING.md. Let us know if you need any help! |
🤖 AI Agent: docs-sync-checker — Docs Sync
Docs Sync
Please ensure the |
🤖 AI Agent: security-scanner — View details
No security issues found. |
🤖 AI Agent: test-generator — View details
Test coverage looks good. No gaps identified. |
🤖 AI Agent: breaking-change-detector — API Compatibility
API Compatibility
|
PR Review Summary
Verdict: AI review comments are untrusted advisory output. The summary reports workflow-generated completion status only, not model-authored pass/fail claims. |
|
🔴 Contributor Check: HIGH
Automated check by AGT Contributor Check. |
There was a problem hiding this comment.
Pull request overview
TL;DR: 0 blockers, 0 warnings. No issues found. Clean change.
Changes:
- Upgrade
ed25519-dalekfrom2.2.0to3.0.0andrandfrom0.8.6to0.10.2across theagent-governance-rustworkspace. - Update call sites for
rand0.10 API moves/renames (e.g.,distributions→distr,thread_rng()→rng(),Rng→RngExt,RngCore→Rng).
Reviewed changes
Copilot reviewed 5 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
agent-governance-rust/Cargo.toml |
Pins ed25519-dalek to =3.0.0 and rand to =0.10.2 at the workspace level. |
agent-governance-rust/Cargo.lock |
Updates the resolved dependency graph for the coordinated ed25519-dalek/rand upgrade. |
agent-governance-rust/agentmesh/src/identity.rs |
Switches key generation RNG call from OsRng to rand::rng() for SigningKey::generate. |
agent-governance-rust/agentmesh/src/identity_support.rs |
Updates SigningKey::generate RNG call sites to rand::rng() for credential/key rotation paths. |
agent-governance-rust/agentmesh/src/credential_vault.rs |
Adapts RNG trait usage (RngCore → Rng) and updates thread_rng() → rng() for byte filling. |
agent-governance-rust/agentmesh-mcp/src/mcp/clock.rs |
Updates rand imports (distr, RngExt) and RNG creation (rng()) for nonce generation. |
|
MohammadHaroonAbuomar this is the closest Rust PR to merge: mergeable, CI clean, resolves #3355, and the duplicate #3418 is now closed. Could you give it a code-owner review when you have a moment? Thanks. |
5b3dfd9 to
9d3d088
Compare
MohammadHaroonAbuomar
left a comment
There was a problem hiding this comment.
- Process: real CI has never run on this head (all green checks are pull_request_target bot jobs; build-rust/CodeQL/SBOM stuck action_required) and the PR is CONFLICTING on the exact Cargo.toml/lock block being upgraded. Rebase onto main, get workflow runs approved, require genuinely green CI. (Local compensating run at head: cargo test 514/514 pass; code content verified sound incl. dalek3 signing determinism and no seeded-RNG leaks.)
Minor:
- audit doc omission: OsRng->ThreadRng is not strictly equivalent (thread-local ChaCha12, reseeds per 64KiB, not fork-safe; no fork usage in workspace today). Add a line.
MohammadHaroonAbuomar
left a comment
There was a problem hiding this comment.
- Process: real CI has never run on this head (all green checks are pull_request_target bot jobs; build-rust/CodeQL/SBOM stuck action_required) and the PR is CONFLICTING on the exact Cargo.toml/lock block being upgraded. Rebase onto main, get workflow runs approved, require genuinely green CI. (Local compensating run at head: cargo test 514/514 pass; code content verified sound incl. dalek3 signing determinism and no seeded-RNG leaks.)
Minor:
- audit doc omission: OsRng->ThreadRng is not strictly equivalent (thread-local ChaCha12, reseeds per 64KiB, not fork-safe; no fork usage in workspace today). Add a line.
762a580 to
a6b4604
Compare
5132247 to
b01b308
Compare
MohammadHaroonAbuomar
left a comment
There was a problem hiding this comment.
- .cspell.json:105: the rebase merge dropped
"starlette"relative to main (added there by #3411/#3085). The word is used in agent-mesh (errors.py, http_middleware.py, request_auth.py, CHANGELOG.md), so the next PR touching those lines would fail Spell-check. Please re-add"starlette",to the words list.
|
Correction on the .cspell.json item above: main lists |
|
Thanks for the careful read. I think Happy to relocate it to match main's ordering if you would prefer the list stay positionally aligned to avoid future diff noise, just let me know. |
|
@AlgoVoi can you please rebase, resolve conflicts and push for review again, if its still stale for another week, this will have to come back in as a new PR. --PR-older-than-a-month |
|
AlgoVoi (Christopher Hopley) (@chopmob-cloud), a status note so you have the full picture. The one open item on this PR is the audit table at If you can rebase and fix the audit table in the next few days, this PR is the one that should land, and the OS-entropy hardening from #4104 can follow on top. If you would rather not, say so and #4104 goes in with your credit. Either way, thank you for carrying this since July. |
b01b308 to
8d1d046
Compare
… audit Address review on microsoft#3420: the audit noted the ChaCha12 reseed behaviour of the non-key-material thread-rng path but not its fork-safety. Add a line stating rand::rng() is not fork-safe, that no key material and no forking process uses it today, and that a future fork-using caller must re-check the nonce and identifier paths. No code change. Signed-off-by: AlgoVoi <chopmob@gmail.com>
rand 0.10 pulls chacha20 as its ThreadRng CSPRNG backend. The lockfile resolved chacha20 0.10.1, which crates.io has since yanked for undefined behaviour: an SSE4.1 intrinsic reached from the SSE2-only backend, fixed in 0.10.2. cargo update -p chacha20 --precise 0.10.2 moves the single lock entry to the fixed release; no Cargo.toml change. The dependency-audit table is updated to match. Addresses review feedback on microsoft#3420. Signed-off-by: AlgoVoi <chopmob@gmail.com>
MohammadHaroonAbuomar
left a comment
There was a problem hiding this comment.
- agent-governance-rust/Cargo.lock:1 The rebase carries a downgrade: main has
cedar-policy,cedar-policy-coreandcedar-policy-formatterat 4.13.0, and this lock resolves them at 4.12.0, so a squash merge would move main backwards on those three crates. Please regenerate the lock against current main (for examplecargo update -p cedar-policy -p cedar-policy-core -p cedar-policy-formatter --precise 4.13.0, or re-resolve from main's lock and re-apply only the dalek and rand changes) so the diff touches only the crates this upgrade changes.
Coordinated bump (fixes microsoft#3355). ed25519-dalek 3 rides rand_core 0.9 which rand 0.10 provides, so the two must move together; dependabot's one-at-a-time bumps (microsoft#3269, microsoft#3271) cannot align them. The dalek 2->3 signing/verifying surface used here is source-compatible; the edits are the rand 0.9/0.10 reshuffle: distributions->distr, thread_rng->rng, the Rng extension trait ->RngExt, the RngCore core trait ->Rng, and OsRng (removed) -> rand::rng() (ThreadRng, an infallible CryptoRng, which SigningKey::generate requires and rand 0.10's SysRng -- only TryCryptoRng -- is not). cargo build/test/clippy green: 514 tests pass, unchanged from baseline, including the signature-reject tests (verification still refuses forged and replayed signatures). Signed-off-by: chopmob-cloud <250041792+chopmob-cloud@users.noreply.github.com> Signed-off-by: AlgoVoi <chopmob@gmail.com>
The vendored-patch-audit gate requires a dated audit doc whenever a lockfile changes, and this PR changes agent-governance-rust/Cargo.lock. Records why ed25519-dalek and rand must move together, the full transitive delta, the rand_core/getrandom duplicate collapse, the new digest/sha2 major duplication, and the OsRng -> rand::rng() migration that keeps an infallible CryptoRng for key generation. No CVE is being remediated; this is a compatibility-driven upgrade. Signed-off-by: chopmob-cloud <250041792+chopmob-cloud@users.noreply.github.com> Signed-off-by: AlgoVoi <chopmob@gmail.com>
Signed-off-by: AlgoVoi <chopmob@gmail.com>
Signed-off-by: AlgoVoi <chopmob@gmail.com>
…ence ThreadRng is a thread-local ChaCha12 CSPRNG that reseeds from the OS per 64 KiB of output. Unlike OsRng it is not fork-safe: a child that forks without exec inherits the parent's RNG state. No code in this workspace calls fork directly and neither Tokio nor the test harness uses a forking model, so this is not a current risk. Documenting it so the constraint is visible if a forking process model is introduced later. Signed-off-by: AlgoVoi <chopmob@gmail.com>
Copilot reviewer noted the audit table listed getrandom After as 0.4.2 but the actual lockfile has 0.4.3. On inspection the Before column also omitted the 0.3.4 version that was already present on main before this PR. Corrected changes: - Before: 0.2.17 + 0.3.4 + 0.4.2 (0.3.4 was already present on main) - After: 0.2.17 + 0.3.4 + 0.4.3 (minor patch bump driven by the rand 0.10 upgrade) Prose corrections: - Only rand_core collapses (2->1 version); getrandom stays at 3 versions. - Security bullet updated to match. Signed-off-by: AlgoVoi <chopmob@gmail.com>
…ed pattern Key generation previously used rand's thread RNG (ThreadRng: thread-local ChaCha12, reseeded from the OS per 64 KiB, not fork-safe). ed25519-dalek 3.0.0's SigningKey::generate documentation uses OS entropy directly via the UnwrapErr adapter: UnwrapErr(SysRng). This change adopts that pattern for every key-material path: - AgentIdentity::generate and AgentIdentity::delegate (identity.rs) - Credential::issue and KeyRotationManager::rotate (identity_support.rs) - CredentialVault::generate_key, the AES-256-GCM key (credential_vault.rs) rand::rngs::SysRng (re-export of getrandom 0.4 SysRng, TryCryptoRng with Error = Infallible under UnwrapErr) satisfies the infallible CryptoRng bound of SigningKey::generate via the rand_core blanket impl, so no new dependency is needed and Cargo.lock is unchanged. Thread rng remains only in non-key-material paths: the AES-GCM nonce, generated identifiers (credential, link, chain, incident, violation, report, grant, challenge, sandbox execution ids), the attestation challenge nonce, and the MCP clock nonce. The dependency-audit doc drops the ThreadRng-vs-OsRng caveat and now records the OS-entropy keygen pattern and the surviving thread-rng uses. Adds two tests: distinct usable Ed25519 keys with cross-verification rejection, and distinct non-zero vault keys. Validation: cargo test --workspace --locked green with the GNU host toolchain (378 lib + 101 integration + 36 mcp + 2 doc tests), clippy clean of new warnings. Signed-off-by: AlgoVoi <chopmob@gmail.com>
…cation note Signed-off-by: AlgoVoi <chopmob@gmail.com>
These rand-crate identifiers appear in the dalek-3/rand-0.10 dependency audit docs and were missed in the initial spell commit (017d3c2). Signed-off-by: AlgoVoi <chopmob@gmail.com>
… audit Address review on microsoft#3420: the audit noted the ChaCha12 reseed behaviour of the non-key-material thread-rng path but not its fork-safety. Add a line stating rand::rng() is not fork-safe, that no key material and no forking process uses it today, and that a future fork-using caller must re-check the nonce and identifier paths. No code change. Signed-off-by: AlgoVoi <chopmob@gmail.com>
rand 0.10 pulls chacha20 as its ThreadRng CSPRNG backend. The lockfile resolved chacha20 0.10.1, which crates.io has since yanked for undefined behaviour: an SSE4.1 intrinsic reached from the SSE2-only backend, fixed in 0.10.2. cargo update -p chacha20 --precise 0.10.2 moves the single lock entry to the fixed release; no Cargo.toml change. The dependency-audit table is updated to match. Addresses review feedback on microsoft#3420. Signed-off-by: AlgoVoi <chopmob@gmail.com>
…dit table Rebase the ed25519-dalek 3 / rand 0.10 upgrade onto current upstream/main and regenerate the lockfile from main so the diff touches only the crates this upgrade changes: - Keep opentelemetry at main 0.33.0 and cedar-policy/-core/-formatter at main 4.13.0 (the stale branch would have downgraded both). No unrelated crate is moved. - chacha20 resolves to 0.10.2 (0.10.1 was yanked for UB). Refresh docs/dependency-audits to match the regenerated lock: getrandom, zerocopy and wasi are unchanged by this upgrade (main moved on); digest and sha2 already carry both majors on main; const-oid collapses 0.9.6+0.10.2 to 0.10.2. Verification line updated to the measured 578-test run. Signed-off-by: AlgoVoi <chopmob@gmail.com>
8d1d046 to
51540a6
Compare
|
MohammadHaroonAbuomar Done, this is rebased onto current
Happy to have the OS-entropy hardening from #4104 follow on top once this lands, per your note. Thanks for carrying the review. |
MohammadHaroonAbuomar
left a comment
There was a problem hiding this comment.
Approving at 51540a6. The lock now moves nothing backwards: ed25519-dalek, ed25519, curve25519-dalek, signature, fiat-crypto and rand go up, two duplicate crates collapse to their newer version, chacha20 0.10.2 is new (0.10.1 is yanked), six transitive crates drop out, and cedar-policy and opentelemetry stay at main's versions. Every newly pinned version is past the seven-day rule. The audit document's table and prose match the lock row for row. Key generation at all five sites uses SigningKey::generate(&mut UnwrapErr(SysRng)) or SysRng.fill_bytes, the stateless OS source the dalek 3 documentation prescribes, and it panics rather than degrading if the OS source fails; signing and verification paths are unchanged and the rejection tests still pass; the new tests cover distinct usable keys and cross-verify rejection. 578 workspace tests pass locally, the vendored-patch audit passes, and all 18 checks are green. Twelve signed commits. Thank you for carrying this from #3355 through two rebases.
For the record: cargo fmt --check and clippy -D warnings fail on main in files this PR does not touch, and CI does not gate them; that is a separate cleanup. #4104 carries the same upgrade on an older base and should close as superseded once this lands.
…ixes microsoft#3355) (microsoft#3420) * chore(rust): upgrade ed25519-dalek 2.x -> 3.x and rand 0.8 -> 0.10 Coordinated bump (fixes microsoft#3355). ed25519-dalek 3 rides rand_core 0.9 which rand 0.10 provides, so the two must move together; dependabot's one-at-a-time bumps (microsoft#3269, microsoft#3271) cannot align them. The dalek 2->3 signing/verifying surface used here is source-compatible; the edits are the rand 0.9/0.10 reshuffle: distributions->distr, thread_rng->rng, the Rng extension trait ->RngExt, the RngCore core trait ->Rng, and OsRng (removed) -> rand::rng() (ThreadRng, an infallible CryptoRng, which SigningKey::generate requires and rand 0.10's SysRng -- only TryCryptoRng -- is not). cargo build/test/clippy green: 514 tests pass, unchanged from baseline, including the signature-reject tests (verification still refuses forged and replayed signatures). Signed-off-by: chopmob-cloud <250041792+chopmob-cloud@users.noreply.github.com> Signed-off-by: AlgoVoi <chopmob@gmail.com> * docs(dependency-audits): audit trail for the dalek 3 / rand 0.10 bump The vendored-patch-audit gate requires a dated audit doc whenever a lockfile changes, and this PR changes agent-governance-rust/Cargo.lock. Records why ed25519-dalek and rand must move together, the full transitive delta, the rand_core/getrandom duplicate collapse, the new digest/sha2 major duplication, and the OsRng -> rand::rng() migration that keeps an infallible CryptoRng for key generation. No CVE is being remediated; this is a compatibility-driven upgrade. Signed-off-by: chopmob-cloud <250041792+chopmob-cloud@users.noreply.github.com> Signed-off-by: AlgoVoi <chopmob@gmail.com> * chore(spell): add Rust crate names to cspell word list Signed-off-by: AlgoVoi <chopmob@gmail.com> * chore(docs): remove owner field and fix prose in dep-audit Signed-off-by: AlgoVoi <chopmob@gmail.com> * docs(dependency-audits): document OsRng->ThreadRng fork-safety difference ThreadRng is a thread-local ChaCha12 CSPRNG that reseeds from the OS per 64 KiB of output. Unlike OsRng it is not fork-safe: a child that forks without exec inherits the parent's RNG state. No code in this workspace calls fork directly and neither Tokio nor the test harness uses a forking model, so this is not a current risk. Documenting it so the constraint is visible if a forking process model is introduced later. Signed-off-by: AlgoVoi <chopmob@gmail.com> * docs(dependency-audits): fix getrandom table and collapse prose Copilot reviewer noted the audit table listed getrandom After as 0.4.2 but the actual lockfile has 0.4.3. On inspection the Before column also omitted the 0.3.4 version that was already present on main before this PR. Corrected changes: - Before: 0.2.17 + 0.3.4 + 0.4.2 (0.3.4 was already present on main) - After: 0.2.17 + 0.3.4 + 0.4.3 (minor patch bump driven by the rand 0.10 upgrade) Prose corrections: - Only rand_core collapses (2->1 version); getrandom stays at 3 versions. - Security bullet updated to match. Signed-off-by: AlgoVoi <chopmob@gmail.com> * fix(rust): generate Ed25519 keys from OS entropy per dalek 3 documented pattern Key generation previously used rand's thread RNG (ThreadRng: thread-local ChaCha12, reseeded from the OS per 64 KiB, not fork-safe). ed25519-dalek 3.0.0's SigningKey::generate documentation uses OS entropy directly via the UnwrapErr adapter: UnwrapErr(SysRng). This change adopts that pattern for every key-material path: - AgentIdentity::generate and AgentIdentity::delegate (identity.rs) - Credential::issue and KeyRotationManager::rotate (identity_support.rs) - CredentialVault::generate_key, the AES-256-GCM key (credential_vault.rs) rand::rngs::SysRng (re-export of getrandom 0.4 SysRng, TryCryptoRng with Error = Infallible under UnwrapErr) satisfies the infallible CryptoRng bound of SigningKey::generate via the rand_core blanket impl, so no new dependency is needed and Cargo.lock is unchanged. Thread rng remains only in non-key-material paths: the AES-GCM nonce, generated identifiers (credential, link, chain, incident, violation, report, grant, challenge, sandbox execution ids), the attestation challenge nonce, and the MCP clock nonce. The dependency-audit doc drops the ThreadRng-vs-OsRng caveat and now records the OS-entropy keygen pattern and the surviving thread-rng uses. Adds two tests: distinct usable Ed25519 keys with cross-verification rejection, and distinct non-zero vault keys. Validation: cargo test --workspace --locked green with the GNU host toolchain (378 lib + 101 integration + 36 mcp + 2 doc tests), clippy clean of new warnings. Signed-off-by: AlgoVoi <chopmob@gmail.com> * docs(dependency-audits): drop stale hard-coded test count from verification note Signed-off-by: AlgoVoi <chopmob@gmail.com> * chore(spell): add rngs, keygen, csprng to cspell word list These rand-crate identifiers appear in the dalek-3/rand-0.10 dependency audit docs and were missed in the initial spell commit (017d3c2). Signed-off-by: AlgoVoi <chopmob@gmail.com> * docs(audit): record rand::rng() fork-safety caveat in ed25519-dalek 3 audit Address review on microsoft#3420: the audit noted the ChaCha12 reseed behaviour of the non-key-material thread-rng path but not its fork-safety. Add a line stating rand::rng() is not fork-safe, that no key material and no forking process uses it today, and that a future fork-using caller must re-check the nonce and identifier paths. No code change. Signed-off-by: AlgoVoi <chopmob@gmail.com> * fix(rust): pin chacha20 to 0.10.2 (0.10.1 yanked for UB) rand 0.10 pulls chacha20 as its ThreadRng CSPRNG backend. The lockfile resolved chacha20 0.10.1, which crates.io has since yanked for undefined behaviour: an SSE4.1 intrinsic reached from the SSE2-only backend, fixed in 0.10.2. cargo update -p chacha20 --precise 0.10.2 moves the single lock entry to the fixed release; no Cargo.toml change. The dependency-audit table is updated to match. Addresses review feedback on microsoft#3420. Signed-off-by: AlgoVoi <chopmob@gmail.com> * chore(rust): rebase onto main, keep deps at main versions, refresh audit table Rebase the ed25519-dalek 3 / rand 0.10 upgrade onto current upstream/main and regenerate the lockfile from main so the diff touches only the crates this upgrade changes: - Keep opentelemetry at main 0.33.0 and cedar-policy/-core/-formatter at main 4.13.0 (the stale branch would have downgraded both). No unrelated crate is moved. - chacha20 resolves to 0.10.2 (0.10.1 was yanked for UB). Refresh docs/dependency-audits to match the regenerated lock: getrandom, zerocopy and wasi are unchanged by this upgrade (main moved on); digest and sha2 already carry both majors on main; const-oid collapses 0.9.6+0.10.2 to 0.10.2. Verification line updated to the measured 578-test run. Signed-off-by: AlgoVoi <chopmob@gmail.com> --------- Signed-off-by: chopmob-cloud <250041792+chopmob-cloud@users.noreply.github.com> Signed-off-by: AlgoVoi <chopmob@gmail.com> Signed-off-by: yuvrajsingh2428 <offcyuvi2428@gmail.com>
Summary
Upgrades
ed25519-dalek2.2.0 -> 3.0.0andrand0.8.6 -> 0.10.2across theagent-governance-rustworkspace, as requested in #3355.Dependabot #3269 (dalek 3) and #3271 (rand 0.10) each failed
build-rustbecause they bump one crate at a time. The two must move together:ed25519-dalek3 ridesrand_core0.9, whichrand0.10 provides, so bumping either alone leaves arand_coreversion mismatch. This is a single coordinated PR.What actually changed
Bumping both together showed that the
ed25519-dalek2 -> 3 signing/verifying surface used in this crate is source-compatible (SigningKey::generate,Signature::from_bytes,VerifyingKey::from_bytes,Signer/Verifier). All the real edits are therand0.9/0.10 trait and module reshuffle:rand::distributions->rand::distr(clock.rs)rand::thread_rng()->rand::rng()in non-key-material paths (clock.rs, the AES-GCM nonce incredential_vault.rs)Rngextension trait (providingsample_iter) is nowRngExt(clock.rs)RngCorecore trait (providingfill_bytes) is now namedRng(credential_vault.rs)rand::rngs::OsRngwas removed; key generation now usesUnwrapErr(SysRng)(identity.rs,identity_support.rs,credential_vault.rs), see belowNote on key-generation RNG
SigningKey::generateined25519-dalek3 requires an infallibleCryptoRng(pub fn generate<R: CryptoRng + ?Sized>(csprng: &mut R)). The documented pattern in theed25519-dalek3.0.0SigningKey::generatedocs is OS entropy through theUnwrapErradapter:let mut csprng = UnwrapErr(SysRng); SigningKey::generate(&mut csprng).SysRng(thegetrandom0.4 system source re-exported byrand0.10 asrand::rngs::SysRng) implements the fallibleTryCryptoRng, andrand_core'sUnwrapErrwrapper turns it into an infallibleCryptoRngvia the blanket impl, satisfying the bound directly from OS entropy with no new dependency and no lockfile change.Every key-material path draws from
UnwrapErr(SysRng):AgentIdentity::generate/delegate,Credential::issue,KeyRotationManager::rotate, and the vault's AES-256-GCMCredentialVault::generate_key. Thread RNG (rand::rng()) remains only where key material is not involved (the AES-GCM nonce, generated identifiers, the attestation challenge nonce, and the MCP clock nonce). This draws long-lived key material straight from the OS CSPRNG and removes the thread-local reseed and fork-safety caveats from the keygen path. The dependency-audit doc records the split.Validation
agent-governance-rust, from a green baseline:cargo build --workspacecargo test --workspace --lockedcargo clippy --workspace --all-targetsThe PR adds two keygen tests (distinct usable keys with cross-verification rejection; distinct non-zero vault keys), which is the +4 delta over the 514 baseline together with the branch's earlier additions. The suite still includes the signature-rejection tests (
trust::test_verify_peer_rejects_mismatched_claimed_peer,trust::test_verify_peer_rejects_signature_not_created_by_peer,mcp::signing::tests::rejects_replayed_messages), so verification still refuses forged and replayed signatures, not merely accepts valid ones.Fixes #3355.