Repository navigation
fix(crypto): reject public Sapling encryption shared secrets - #69
Open
Federico2014 wants to merge 1 commit into
Open
Federico2014 wants to merge 1 commit into
Federico2014 wants to merge 1 commit into
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the
|
There was a problem hiding this comment.
No issues found across 2 files
Tip: Get a Slack DM when cubic finishes reviewing your PRs. Connect Slack
View guided diff | Turn on auto-fix | Re-trigger cubic
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?
Reject the canonical identity shared point in NoteEncryption.encryptToRecipient before key derivation or ciphertext creation. Both native shielded transactions and shielded TRC20 builders propagate this failure before output proving. The check covers identity aliases, small-order recipient points and a zero ephemeral secret.
Why are these changes required?
A degenerate recipient key can make the shared point public, exposing the amount and memo after the output is published. Check the canonical result of native key agreement rather than matching a particular recipient encoding. This sender-only change works with the existing SDK 1.0.0 and leaves historical note decryption and consensus verification unchanged.
This PR has been tested by:
Follow up
Companion Rust/SDK changes reject these inputs during output proof generation and add native regressions. The node guard can ship independently without a dependency update.
Extra details
Based on Federico2014/java-tron release_v4.8.3 at 9f53b51. Cherry-picks the recipient fix from tronprotocol#7133 without unrelated upstream commits. No protocol, transaction-validation, SDK dependency, or historical-reading changes.
Companion PRs: tronprotocol/librustzcash#18 and tronprotocol/zksnark-java-sdk#25.
Summary by cubic
Rejects degenerate Sapling recipient keys so the shared encryption secret can never become public.
A recipient key that forces key agreement to the identity point makes the shared secret public, exposing the note amount and memo once the output is published.
NoteEncryption.encryptToRecipientnow returns empty for the canonical identity shared point before key derivation or ciphertext creation, and both native shielded transactions and shielded TRC20 builders fail before output proving.Written for commit d96c293. Summary will update on new commits.