Harden input validation in NEAR serialization and Zcash signing - #4799
Harden input validation in NEAR serialization and Zcash signing#4799nikhil-gupta-tw wants to merge 7 commits into
Conversation
…action confusion via undersized deposit bytes in release builds
…o prevent silent destination spoofing
Summary by OctaneNew ContractsNo new contracts were added. Updated Contracts
🔗 Commit Hash: 16e3584 |
Binary size comparison➡️ aarch64-apple-ios: - 14.31 MB
+ 14.31 MB +5 KB➡️ aarch64-apple-ios-sim: - 14.31 MB
+ 14.32 MB +5 KB➡️ aarch64-linux-android: - 18.73 MB
+ 18.74 MB +8 KB➡️ armv7-linux-androideabi: - 16.17 MB
+ 16.18 MB +6 KB➡️ wasm32-unknown-emscripten: - 13.66 MB
+ 13.67 MB +6 KB |
sergei-boiko-trustwallet
left a comment
There was a problem hiding this comment.
One change please
sergei-boiko-trustwallet
left a comment
There was a problem hiding this comment.
LGTM! Thanks for the fix
BSCSecChef
left a comment
There was a problem hiding this comment.
-
This is never used in the function, check once -
-
Could you help to check on UI end too once. So send_amount is never used on UI end, it iterates on the output list and show each destination
-
Probably add in validation check (length) on these -
wallet-core/src/NEAR/Serialization.cpp
Line 177 in 2657bd3
…ix/sec-issues-5 # Conflicts: # src/NEAR/Serialization.cpp
|
Yes, it's the shared
I have checked and UI doesn't use
Already done in #4812 . |



This pull request introduces a validation step for Zcash PCZT outputs to ensure that, if a
user_addressis provided, it matches the expectedscript_pubkey. It also adds comprehensive unit and integration tests for this behavior, and improves error handling in NEAR serialization. Additionally, it updates dependencies to include the Zcash crate for testing.Zcash PCZT output validation and testing:
OutputPczt::buildto verify that ifuser_addressis present, it matches thescript_pubkeyby converting the address to a script and comparing it. This prevents mismatches and potential security issues.output_pczt.rsto cover cases where the address matches, mismatches, or is invalid, ensuring robust validation logic.zcash_sign.rsto verify end-to-end signing behavior for PCZT transactions with matching and mismatcheduser_addressfields.Dependency and test infrastructure updates:
tw_zcashas a dependency intw_tests/Cargo.tomlto enable Zcash-related tests.Error handling improvement in NEAR serialization:
assertwith an exception inwriteU128to throw a clear error if the input is not exactly 16 bytes, improving robustness and error reporting. [1] [2]