Skip to content

chore!: upgrade RustCrypto elliptic-curve stack to 0.14 for RUSTSEC-2026-0387 - #745

Draft
lwshang wants to merge 2 commits into
mainfrom
chore/rustcrypto-elliptic-curve-0.14
Draft

lwshang wants to merge 2 commits into
mainfrom
chore/rustcrypto-elliptic-curve-0.14

Conversation

@lwshang

@lwshang lwshang commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

RUSTSEC-2026-0387 reports non-constant-time arithmetic in crypto-bigint < 0.7.6. The 0.5 line, which the elliptic-curve 0.13 stack pins, has no fixed release. Downstream cargo deny checks can't clear it until ic-agent moves; dfinity/icp-cli#844 is blocked on this.

Changes

  • Bumps k256/p256 0.14, elliptic-curve 0.14, ecdsa 0.17, pkcs8 0.11, sec1 0.8 and sha2 0.11. crypto-bigint 0.5 is no longer in the graph.
  • pkcs8::PrivateKeyInfo is now generic, so PEM parsing uses PrivateKeyInfoRef.
  • pkcs8::Error::KeyMalformed now carries a KeyError.
  • VerifyingKey::from_encoded_point is replaced by from_sec1_point, used in delegation verification.
  • sha2 0.11 no longer implements io::Write. The request-id serializer's collect_str now hashes through a small fmt::Write adapter, still without an intermediate String.

Breaking

These crates' types appear in the public API, for example Secp256k1Identity::from_private_key, Prime256v1Identity::from_private_key and PemError::ErrorStack. Downstream crates that name them must move to the same versions. The CHANGELOG is updated under Unreleased.

Testing

  • cargo clippy --workspace --all-targets --all-features: clean
  • cargo check -p ic-agent --target wasm32-unknown-unknown --features wasm-bindgen: passes
  • cargo test for ic-agent, ic-transport-types, ic-utils and ref-tests (against PocketIC): all pass
  • icp-cli builds and passes cargo deny check against this branch (chore(deps): fix RUSTSEC-2026-0385/0386/0387 icp-cli#844)

🤖 Generated with Claude Code

…026-0387

k256/p256 0.13 pin crypto-bigint 0.5, which has no fix for the
non-constant-time arithmetic in RUSTSEC-2026-0387. Move to k256/p256
0.14, elliptic-curve 0.14, ecdsa 0.17, pkcs8 0.11, sec1 0.8 and sha2 0.11.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

The security-sensitive cryptographic migration and breaking public types require human confirmation of compatibility and regression coverage.

1 open issue
What changed in this PR

This PR upgrades the RustCrypto dependencies used by agent identities and request hashing to address RUSTSEC-2026-0387, with breaking changes to publicly exposed dependency types.

Changes:

  • Upgrades the elliptic-curve stack and replaces crypto-bigint 0.5 with 0.7.10 in the lockfile.
  • Adapts key parsing and delegation verification to the updated APIs.
  • Preserves allocation-free formatted request-ID hashing and documents downstream migration requirements.
File Description
ic-transport-types/​src/​request_id.rs Adds a formatting adapter for SHA-256 hashing.
ic-agent/​src/​identity/​secp256k1.rs Updates PKCS#8 parsing and key errors.
ic-agent/​src/​identity/​prime256v1.rs Updates PKCS#8 parsing and key errors.
ic-agent/​src/​identity/​mod.rs Adapts shared EC private-key extraction.
ic-agent/​src/​identity/​delegated.rs Uses the updated verification-key constructor.
ic-agent/​src/​identity/​basic.rs Adapts Ed25519 PEM parsing to updated DER types.
CHANGELOG.md Documents the security upgrade and breaking public types.
Cargo.toml Updates workspace cryptographic dependency requirements.
Cargo.lock Records the upgraded cryptographic dependency graph.

Review effort: Balanced

Comment thread ic-transport-types/src/request_id.rs Resolved
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
lwshang added a commit to dfinity/icp-cli that referenced this pull request Oct 26, 2026
…tCrypto 0.14 stack

crypto-bigint 0.5 has no patched release and is pinned by ic-agent's
elliptic-curve 0.13 stack. The fix is in progress in dfinity/agent-rs#745;
the migration that was here moves to its own PR to wait for that release.

Co-Authored-By: Claude Opus 5.5 (1M context) <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.

2 participants