Add bounded deserialization for CircuitVerifyingKey #3084
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
CircuitVerifyingKey::deserializewas vulnerable to unbounded memory allocation when deserializing thecircuit_commitmentsvector, allowing malicious input to exhaust memory.Changes
CanonicalDeserializederive and implemented custom deserializationcircuit_commitmentsto 12 elements (3 matrices × 4 polynomials per Varuna protocol)SerializationError::InvalidDatawhen length exceeds boundValidtrait for validation pipeline compatibilityImplementation
The bound preserves backwards compatibility—all valid keys (≤12 commitments) deserialize successfully.
Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
esm.ubuntu.com/usr/lib/apt/methods/https /usr/lib/apt/methods/https /struct_type/mod-l ep grep -l s d_script_build-ce321e5ae12df09a.build_script_build.b38a6385c61de7f3-cgu.0.rcgu.o d_script_build-ce321e5ae12df09a.at8745crjbij63ropox62r1ix.rcgu.o s .rs -REDACTED-linux-gnu/lib/libstd-8df6be531efb3fd0.rlib -REDACTED-linux-gnu/lib/libpanic_unwind-e6943c8b7850575a.rlib -REDACTED-linux-gnu/lib/libobject-293bc8e42ad97307.rlib -REDACTED-linux-gnu/lib/libmemchr-4ab95264898e2f40.rlib -REDACTED-linux-gnu/lib/libaddr2line-98301de5f7086436.rlib -REDACTED-linux-gnu/lib/libgimli-c04b364b33261ab8.rlib -REDACTED-linux-gnu/lib/librustc_demangle-7ab55e5a1abede85.rlib -REDACTED-linux-gnu/lib/libstd_detect-f9ea2d02cc19f59b.rlib -REDACTED-linux-gnu/lib/libhashbrown-4b2c04502d3e324b.rlib -REDACTED-linux-gnu/lib/librustc_std_workspace_alloc-1aeb559ec68adac8.rlib(dns block)parameters.provable.com/home/REDACTED/work/snarkVM/snarkVM/target/debug/deps/snarkvm_algorithms-fa413e4860477257 /home/REDACTED/work/snarkVM/snarkVM/target/debug/deps/snarkvm_algorithms-fa413e4860477257 snark::varuna cfg(docsrs,test) --check-cfg e-cg�� ons e-cgu.3.rcgu.o e-cgu.4.rcgu.o M/target/debug/bbash e-cgu.6.rcgu.o pointer 8lnh.rcgu.rmeta 1kr1�� ons RL u/13/cc1 nu/lib/librustc_git nu/lib/librustc_add pointer u/13/cc1(dns block)s3.us-west-1.amazonaws.com/home/REDACTED/work/snarkVM/snarkVM/target/debug/deps/snarkvm_algorithms-fa413e4860477257 /home/REDACTED/work/snarkVM/snarkVM/target/debug/deps/snarkvm_algorithms-fa413e4860477257 snark::varuna cfg(docsrs,test) --check-cfg e-cg�� ons e-cgu.3.rcgu.o e-cgu.4.rcgu.o M/target/debug/bbash e-cgu.6.rcgu.o pointer 8lnh.rcgu.rmeta 1kr1�� ons RL u/13/cc1 nu/lib/librustc_git nu/lib/librustc_add pointer u/13/cc1(dns block)If you need me to access, download, or install something from one of these locations, you can either:
Original prompt
CircuitVerifyingKeyunbounded deserialization #3083💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.