Conversation
Summary of ChangesHello @Its-Just-Nans, 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 introduces the capability to specify a custom salt when performing AES encryption within ZIP archives. This feature addresses the need for reproducible encryption, which can be valuable for testing and specific scenarios where a fixed salt is desired. While generally not recommended for security-sensitive applications due to reduced randomness, it provides flexibility for advanced use cases. The changes involve adding a new Highlights
Changelog
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.
This PR adds support for custom salts in AES encryption, which is useful for testing and reproducible encryption. The implementation correctly:
- Validates custom salt length against AES mode requirements
- Preserves the existing random salt generation as default behavior
- Properly gates the feature behind
aes-cryptofeature flag - Includes appropriate warnings in documentation about not reusing custom salts
I've identified one minor cleanup opportunity with a redundant .as_ref() call. Otherwise, the implementation looks sound and ready for merge once that's addressed.
You can now have the agent implement changes and create commits directly on your pull request's source branch. Simply comment with /q followed by your request in natural language to ask the agent to make changes.
src/read.rs
Outdated
| if let Some(aes) = self.get_metadata().aes_mode { | ||
| // Preserve AES metadata in options for downstream writers. | ||
| // This is metadata-only and does not trigger encryption. | ||
| let aes = (aes.0, aes.1, aes.2, None); |
There was a problem hiding this comment.
Here we don't retreive the custom salt when we want the "options for this file"
There was a problem hiding this comment.
Code Review
The pull request introduces the ability to provide a custom salt for AES encryption, which is a valuable feature for scenarios requiring reproducible encryption results. The implementation correctly integrates this into the FileOptions builder and the internal AesWriter. However, there are some concerns regarding the security of the API (potential mode mismatch leading to weak salts), the use of non-idiomatic error types (String) in public methods, and the increasing complexity of internal metadata tuples which impacts maintainability, as highlighted by the recommendation to encapsulate related options into structs for better API design.
|
Things to do/check
|
|
@Pr0methean @Its-Just-Nans Please read this comment |
|
Even if the CI pass, I think we should maybe wait for #223 (comment) |
|
Yes I thought about that but if we do it like that the function will return an
And this way feel more difficult to handle the error as a lib user. If the lib user want to handle the error easily I think it's better to this way. That why, with the current method there is two steps:
|
a34c582 to
8d6cbb6
Compare
|
Note that I think it would be better to merge #686 first Than edit this pull request to have the password as |
Signed-off-by: Chris Hennick <4961925+Pr0methean@users.noreply.github.com>
Signed-off-by: n4n5 <its.just.n4n5@gmail.com>

fix: #223