-
Notifications
You must be signed in to change notification settings - Fork 42
Refactor SecureJar implementation and add package exclusions
#47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Conversation
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
Matyrobbrt
requested changes
Nov 12, 2023
Member
Matyrobbrt
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mostly pendantic documentation complaints.
Co-authored-by: Matyrobbrt <65940752+Matyrobbrt@users.noreply.github.com>
Su5eD
approved these changes
Nov 15, 2023
Matyrobbrt
approved these changes
Nov 16, 2023
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.
Add
SecureJarBuilderIn preparation for the package exclusions and other future additional
SecureJarparameters, deprecate the oldfrommethods for removal, and add a builder instead.Split implementation across new
JarContentsandJarSigningDataThe motivation for this change is that usually we need access to some of the jar's contents when building the
JarMetadata. Before this change, this is done by passing an incompleteSecureJarto the jar metadata factory in the constructor ofSecureJar. This makes it very hard to reason about the code, because we don't know which parts ofSecureJarcan be safely referenced in the metadata construction, and we also don't know when the metadata can be used inside ofSecureJar.To fix this, I moved the methods needed for constructing the metadata to a new interface called
JarContents. The builder was updated accordingly.Add option to exclude some folder from the package scan
Finally, I also added the option to exclude some folders from the package scan. This will be useful to skip the
assetsanddatafolders of some mods. Some mods have a LOT of assets (for example Continuity+), and scanning those can take a few seconds of startup time.Allow instantiating JarContents separately and remove SecureJarBuilder
After a bit of testing in FML I noticed that it is convenient to have a builder for
JarContentsinstead ofSecureJar.Documentation
I tried to document many methods I encountered, to break the tradition of SJH being completely undocumented... :)
Future work
I will make another PR to make the package scan parallel (across different jars)... but for now I think this PR is large enough. :)
TODO
assetsanddatascanning worked. :)