Skip to content

feat(restore): cross-platform restore via dump engine rebuild (#606)#611

Merged
moonD4rk merged 3 commits into
mainfrom
feat/606-cross-platform-restore
Jun 12, 2026
Merged

feat(restore): cross-platform restore via dump engine rebuild (#606)#611
moonD4rk merged 3 commits into
mainfrom
feat/606-cross-platform-restore

Conversation

@moonD4rk

@moonD4rk moonD4rk commented Jun 7, 2026

Copy link
Copy Markdown
Owner

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

  • Dump wire format v2: Vault.Kind carries the engine identity
  • BuildFromDump reconstructs engines from vaults (no local platform table)
  • restore CLI: --keys + --data-dir/--data-zip; -b is now an optional filter
  • discoverProfiles tolerates marker-less copied trees
  • Clear errors when --data-dir is missing or not an archive layout

Test

go test ./..., golangci-lint, gofmt green on Go 1.20.

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.
Copilot AI review requested due to automatic review settings June 7, 2026 14:04
@codecov-commenter

codecov-commenter commented Jun 7, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 80.58252% with 20 lines in your changes missing coverage. Please review.
✅ Project coverage is 73.24%. Comparing base (cd0b2da) to head (72a046c).

Files with missing lines Patch % Lines
browser/keydump.go 79.48% 10 Missing and 6 partials ⚠️
browser/chromium/chromium.go 63.63% 4 Missing ⚠️
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     
Flag Coverage Δ
unittests 73.24% <80.58%> (+0.16%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 bumps DumpVersion to "2".
  • Adds browser.BuildFromDump to reconstruct browsers from dump vaults + a provided data root (archive layout or raw User Data).
  • Updates restore CLI to use --keys plus --data-dir/--data-zip, with -b as 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.

Comment on lines +67 to 69
_ = cmd.MarkFlagRequired("keys")
cmd.MarkFlagsMutuallyExclusive("data-dir", "data-zip")

Comment thread browser/keydump.go
Comment on lines +85 to +87
if !dirExists(dataDir) {
return nil, fmt.Errorf("data dir %q does not exist", dataDir)
}
moonD4rk added 2 commits June 10, 2026 10:48
pflag treats backticked words in flag usage as the value placeholder,
so --data-zip rendered as "--data-zip archive" in help output.
@moonD4rk moonD4rk merged commit bf96ba8 into main Jun 12, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants