feat(restore): cross-platform restore via dump engine rebuild (#606)#611
Conversation
Restore previously required the dump's origin OS, overlaying keys onto locally-discovered browsers. It now rebuilds Chromium engines from the dump's vaults (v2 adds engine kind), so copied data or an archive zip decrypts on any OS.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #611 +/- ##
==========================================
+ Coverage 73.07% 73.24% +0.16%
==========================================
Files 69 69
Lines 3112 3184 +72
==========================================
+ Hits 2274 2332 +58
- Misses 619 628 +9
- Partials 219 224 +5
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
This PR updates the restore workflow to be truly cross-platform by rebuilding Chromium-family engines from a keys dump (vaults) rather than depending on locally discovered browser installations, enabling decryption from copied data directories or archived zips on hosts that never had the target browser installed.
Changes:
- Introduces dump wire format v2 by adding
Vault.Kind(engine identity) and bumpsDumpVersionto"2". - Adds
browser.BuildFromDumpto reconstruct browsers from dump vaults + a provided data root (archive layout or raw User Data). - Updates
restoreCLI to use--keysplus--data-dir/--data-zip, with-bas an optional filter; improves profile discovery for marker-less copied trees.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
types/category.go |
Adds BrowserKind.String() with canonical engine names (used as stable wire values). |
types/category_test.go |
Adds unit tests for BrowserKind.String(). |
masterkey/dump.go |
Bumps dump schema version to v2 and adds Vault.Kind to support engine reconstruction. |
masterkey/dump_test.go |
Adds round-trip coverage for the new Vault.Kind field. |
cmd/hack-browser-data/restore.go |
Reworks restore CLI flags/flow to accept keys + data dir/zip and rebuild browsers from dumps. |
browser/keydump.go |
Writes Vault.Kind, adds BuildFromDump, and introduces kind<->wire mapping helpers. |
browser/keydump_test.go |
Replaces ApplyDump tests with BuildFromDump and kind/retriever mapping coverage. |
browser/chromium/chromium.go |
Adds Kind() and improves discoverProfiles to handle marker-less copies and flat-layout precedence. |
browser/chromium/chromium_test.go |
Adds tests for the updated discoverProfiles fallback behavior. |
browser/browser.go |
Extends KeyManager with BrowserKey() and Kind() for dump portability. |
.golangci.yml |
Updates lint config to ignore repeated "chromium" string literal in goconst. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| _ = cmd.MarkFlagRequired("keys") | ||
| cmd.MarkFlagsMutuallyExclusive("data-dir", "data-zip") | ||
|
|
| if !dirExists(dataDir) { | ||
| return nil, fmt.Errorf("data dir %q does not exist", dataDir) | ||
| } |
pflag treats backticked words in flag usage as the value placeholder, so --data-zip rendered as "--data-zip archive" in help output.
Cross-platform
restore: rebuild Chromium engines directly from a keys dump's vaults instead of overlaying keys onto locally-discovered browsers — so a browser the host OS never installs can be decrypted from copied data (--data-dir) or an archive zip (--data-zip).Changes
Vault.Kindcarries the engine identityBuildFromDumpreconstructs engines from vaults (no local platform table)restoreCLI:--keys+--data-dir/--data-zip;-bis now an optional filterdiscoverProfilestolerates marker-less copied trees--data-diris missing or not an archive layoutTest
go test ./...,golangci-lint,gofmtgreen on Go 1.20.