Lib/bytes password#2344
Conversation
Change password APIs to accept byte slices instead of strings only,
enabling use of binary keys and non-UTF-8 encoded passwords.
Changes:
- Password internal type: String → Vec<u8>
- Public API generic bounds: AsRef<str> → AsRef<[u8]>
- Write path (builders): Fully backward compatible
- Read path (direct params): Breaking - requires .as_bytes() or b"" prefix
Breaking changes:
- Archive::entries_with_password(password: &str) → password: &[u8]
- Entries::extract_solid_entries(password: &str) → password: &[u8]
- SolidEntry::entries(password: &str) → password: &[u8]
Migration:
// Before
archive.entries_with_password(Some("password"))
// After
archive.entries_with_password(Some(b"password"))
Builder APIs remain fully compatible:
WriteOptions::builder().password(Some("password")) // Still works
WriteOptions::builder().password(Some(b"key")) // Now works
Summary of ChangesHello @ChanTsune, 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 refactors the password handling mechanism throughout the codebase, transitioning from string-based passwords to byte-slice-based passwords. This change enhances the robustness and security of password management by accommodating non-UTF8 characters and providing a more direct representation of raw password data. The update impacts both the command-line interface and the core library, requiring adjustments to function signatures, data structures, and test utilities to align with the new byte-oriented approach. 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.
Code Review
This pull request correctly refactors password handling from String to Vec<u8> across the library and CLI. This is an important improvement for both security and correctness, as it allows passwords to contain arbitrary bytes, not just valid UTF-8. The changes are consistent and well-implemented, including the use of generics to make the password-setting APIs more flexible. I've suggested one minor refactoring to improve code clarity in cli/src/command.rs, but overall this is a solid contribution.
No description provided.