refactor: replace the archived rookie crate with a native chrome cookie reader#228
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
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.
What
Replaces the archived
rookiecrate with a small native reader for Chrome's cookie store insrc/plugins/chrome.rs. leetcode-cli only needs two cookies (LEETCODE_SESSION,csrftoken) from one browser, so this reuses the SQLite already pulled in by diesel to read the cookie DB and implements Chrome's value decryption directly.Why
rookieis archived and a little rough (its build scriptunwrap()sgit rev-parse, which panics in environments without git). More importantly it pulled a second SQLite client (rusqlite) onto the sharedlibsqlite3-sys, plus dbus (zbus/zvariant) andaes-gcm. Reading the cookie DB through diesel collapses that to a single SQLite stack and drops the dbus linkage.Result
bundledstays active via the explicitlibsqlite3-sysdependency.Cargo.lockshrinks by ~1.5k lines; adds four small crypto crates (aes,cbc,pbkdf2,sha1).zbus/dbus linkage.Platforms
Automatic Chrome cookies work on macOS and Linux (Keychain / Secret Service password -> PBKDF2-SHA1 -> AES-128-CBC). On Windows, Chrome's DPAPI + AES-GCM (and app-bound encryption on Chrome 127+) isn't implemented yet, so Windows falls back to manual
csrf/sessionin the config. README anddocs/cookies.mdare updated accordingly.Testing
cargo build,cargo clippy --all-features, andcargo fmt --checkpass, and a clean Linux build with no systemlibsqlite3still produces a self-contained binary. The decryption follows Chrome's documented scheme but has not been smoke-tested against a live Chrome profile yet — worth a manual check before relying on it.Notes
This came out of the #226 SQLite build investigation and removes the second SQLite stack, but it does not by itself fix the AUR build failure reported there.