-
Notifications
You must be signed in to change notification settings - Fork 86
feat: Add by_index_with_options() for ignoring encryption #439
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
feat: Add by_index_with_options() for ignoring encryption #439
Conversation
Summary of ChangesHello @b-spencer, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request enhances the zip archive reading capabilities by introducing a flexible options-based approach for retrieving individual entries. The primary motivation is to enable robust handling of archives that intentionally misrepresent their content, such as malware archives marking unencrypted files as encrypted. By allowing users to explicitly ignore the encryption flag, the library becomes a more powerful tool for analysis, while also providing a cleaner, more extensible API for future reading options. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
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.
Code Review
This pull request introduces a valuable feature to ignore the encryption flag on zip entries, which is particularly useful for malware analysis. The implementation is solid, replacing an internal function with a more extensible public API using the ZipReadOptions
builder pattern. The new logic correctly handles the ignore_encryption_flag
and the accompanying tests provide good coverage for the new functionality and ensure no regressions.
I have a couple of suggestions to improve the ergonomics of the new ZipReadOptions
builder API.
e48df06
to
8448795
Compare
Signed-off-by: Chris Hennick <[email protected]>
* chore: release v5.2.0 * Clarify description of #439 in CHANGELOG Signed-off-by: Chris Hennick <[email protected]> * Remove deprecated static feature flags * Update CHANGELOG for this being the 6.0.0 release --------- Signed-off-by: Chris Hennick <[email protected]>
This PR adds support for completely ignoring the
encrypted
flag on a zip file entry. When ignored, the entry is treated as if it were plaintext.Zip archives sometimes intentionally misrepresent their content. Some malware archives do this by marking a file entry as encrypted when it actually isn't. Since some real-world zip readers ignore the encryption flag, those applications will read, and possibly be harmed by, such archives. This feature allows malware analysis tools using this crate to read such archives.
This PR replaces the private
by_index_with_optional_password()
with an extensible publicby_index_with_options()
to allow multiple indepedent optional arguments to the operation. The newZipReadOptions
builder struct allows specifying an optionalpassword
and setting theignore_encryption_flag
option, which, of course, defaults tofalse
.