fix(crypto): harden cryptographic validation and security in ECKey, SM2, and shielded APIs#6
Closed
Federico2014 wants to merge 5 commits intodevelopfrom
Closed
fix(crypto): harden cryptographic validation and security in ECKey, SM2, and shielded APIs#6Federico2014 wants to merge 5 commits intodevelopfrom
Federico2014 wants to merge 5 commits intodevelopfrom
Conversation
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What does this PR do?
This PR hardens the security and robustness of cryptographic subsystems in java-tron across five areas:
topicsListfrom shielded TRC20 log APIs – eliminates dead parameter fromScanShieldedTRC20NotesByIvk/OvkHTTP endpoints and RPC services.Wallet,ZenTransactionBuilder,ShieldedTRC20ParametersBuilder, and related servlets.ECKey,Rsv, andSignUtilsto reject out-of-range scalars, invalid recovery IDs, and malformed signature encodings.Why are these changes required?
These fixes address signature malleability and input validation vulnerabilities where crafted inputs could bypass cryptographic checks, produce incorrect signatures, or expose internal data through API responses.
This PR has been tested by:
ECKeyTest,SM2KeyTest,ShieldedTRC20BuilderTest,WalletMockTest,ShieldedTransferActuatorTest,RpcApiServicesTest,ArgsTest)Follow up
Consider fuzzing the signature verification path with property-based tests.
Extra details
sprout-verifying.keybinary artifact from the repository root.api.protoupdated to remove deprecatedtopicsListfields from shielded scan responses.Summary by cubic
Strengthens crypto validation and shielded APIs: strict key/signature checks, deterministic
SM2signatures, and safer shielded TRC20 scan endpoints. Shielded transaction APIs are now opt-in by default.Bug Fixes
ECKey/SM2: validate curve points, reject infinity/low-order points, and out‑of‑range scalars; tighten recovery ID and signature encoding checks.SM2Signer: use deterministic nonces (HMacDSAKCalculatorwith SM3) to prevent malleability.SignUtils: addisValidPrivateKey(...)and enforce keystore private key validation inWitnessInitializer.events/topicsList; RPC/HTTP now reject requests that include them;api.protomarks these fields as deprecated.valueBalanceto avoid silent wraparound.Migration
events/topicsListto shielded TRC20 scan endpoints; requests including them will fail. Update clients generated fromapi.protoif needed.node.allowShieldedTransactionApi = true(legacynode.fullNodeAllowShieldedTransactionis supported but deprecated).Written for commit 4f3c68b. Summary will update on new commits.