fix(zksnark): harden sapling param extraction#6880
Open
waynercheung wants to merge 1 commit into
Open
Conversation
Use secure temporary files and restrictive POSIX permissions when extracting packaged Sapling parameters. Handle missing resources explicitly and remove partial files when extraction fails. Add regression tests for the extraction lifecycle.
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.
Summary
Harden how the packaged Sapling parameters (
sapling-spend.paramsandsapling-output.params) are extracted from the classpath during node startup.Motivation
Sapling initialization requires the packaged parameters to be available as local files. The extraction process should use secure temporary-file handling, restrictive permissions where supported, explicit resource validation, and reliable cleanup.
Changes
Files.createTempFile(...).NOFOLLOW_LINKSwhen writing extracted parameters.TronError.deleteOnExit()for successfully extracted files.Successful Sapling initialization behavior remains unchanged. This PR does not modify the packaged parameters or their expected hashes.
Testing
./gradlew :framework:test --tests org.tron.core.zen.ZksnarkInitServiceTest./gradlew :framework:test --tests org.tron.core.exception.TronErrorTest./gradlew :framework:test --tests org.tron.core.zksnark.LibrustzcashTest.testLibsodium./gradlew :framework:checkstyleMain :framework:checkstyleTestImpact