refactor: drop the archive manifest (#678)

Restore must read v1.1.0's manifest-less archives from the layout, and that path reads every new archive too,
so the manifest only described the layout a second time.
This commit is contained in:
Roger authored and GitHub committed 2026-11-02 11:11:55 +08:00
1 parent 3e9150249c
commit fce4f288df
17 files changed
+39 -266

No files matched your search

+1 -1
View File
@@ -211,7 +211,7 @@ linters:
- path: "masterkey/gcoredump_darwin.go"
linters:
- gocognit
- path-except: "^internal/(record|masterkey|snapshot)/"
- path-except: "^internal/(record|masterkey)/"
linters:
- tagliatelle
+1 -1
View File
@@ -53,7 +53,7 @@ func runRestore(ctx context.Context, stderr io.Writer, flags app.RestoreFlags) e
}
defer closeRestoreData(data)
discovery, keys, err := app.RestoreDiscovery(data, dump, options)
discovery, keys, err := app.RestoreDiscovery(data.Path(), dump, options)
if err != nil {
return err
}
+10 -29
View File
@@ -11,8 +11,7 @@ import (
"github.com/moond4rk/hackbrowserdata/internal/snapshot"
)
// Archive also keeps Local State and each profile's marker, so a reader without the manifest still finds the profiles.
// It returns how many files and directories were captured.
// Archive returns how many files and directories it captured.
func Archive(ctx context.Context, discovery Discovery, options Options, archivePath string) (int, error) {
var dirs []browser.UserDataDir
for _, dir := range discovery.Dirs {
@@ -30,13 +29,10 @@ func Archive(ctx context.Context, discovery Discovery, options Options, archiveP
if err := snapshotDir.Capture(ctx, files); err != nil {
return 0, err
}
manifest, fileCount := manifestOf(snapshotDir, dirs, files)
fileCount := countCaptured(snapshotDir, files)
if fileCount == 0 {
return 0, errors.New("no decryption-relevant files found to archive")
}
if err := snapshotDir.WriteManifest(manifest); err != nil {
return 0, err
}
if err := snapshotDir.Zip(archivePath); err != nil {
return 0, fmt.Errorf("write archive %s: %w", archivePath, err)
}
@@ -67,30 +63,15 @@ func archiveFiles(plan Plan, dirs []browser.UserDataDir) []snapshot.File {
return files
}
// manifestOf lists each dir's files that reached the snapshot; one whose copy failed is reported and left out.
func manifestOf(snapshotDir *snapshot.Dir, dirs []browser.UserDataDir, files []snapshot.File) (snapshot.Manifest, int) {
manifest := snapshot.Manifest{Version: snapshot.ManifestVersion, Dirs: []snapshot.ManifestDir{}}
// countCaptured counts the files that reached the snapshot, reporting each one whose copy failed.
func countCaptured(snapshotDir *snapshot.Dir, files []snapshot.File) int {
fileCount := 0
for _, dir := range dirs {
manifestEntry := snapshot.ManifestDir{ID: string(dir.ID), Browser: dir.Browser.Name, Base: dir.Browser.Base.String()}
for _, profile := range dir.Profiles {
manifestEntry.Profiles = append(manifestEntry.Profiles, snapshot.ManifestProfile{Name: profile.Name, Dir: profile.Dir})
}
captured := snapshotDir.Snapshot(string(dir.ID))
for _, file := range files {
if file.UserDataDirID != string(dir.ID) {
continue
}
if _, err := captured.Path(file.RelativePath); err != nil {
log.Warnf("archive: acquire %s/%s: %v", file.UserDataDirID, file.RelativePath, err)
continue
}
manifestEntry.Files = append(manifestEntry.Files, file.RelativePath)
fileCount++
}
if len(manifestEntry.Files) > 0 {
manifest.Dirs = append(manifest.Dirs, manifestEntry)
for _, file := range files {
if _, err := snapshotDir.Snapshot(file.UserDataDirID).Path(file.RelativePath); err != nil {
log.Warnf("archive: acquire %s/%s: %v", file.UserDataDirID, file.RelativePath, err)
continue
}
fileCount++
}
return manifest, fileCount
return fileCount
}
-5
View File
@@ -104,11 +104,7 @@ func TestArchiveGolden(t *testing.T) {
prefix := archiveLayoutBrowser + "/"
names := archiveLayoutEntryNames(t, out)
assert.Contains(t, names, "manifest.json")
for _, name := range names {
if name == "manifest.json" {
continue
}
assert.Truef(t, strings.HasPrefix(name, prefix), "entry %q lacks the %q prefix", name, prefix)
assert.NotContains(t, name, `\`)
assert.NotEqual(t, "LOCK", path.Base(name))
@@ -135,7 +131,6 @@ func TestArchiveRestoreRoundTrip(t *testing.T) {
archive := filepath.Join(t.TempDir(), "data.zip")
_, err = app.Archive(context.Background(), app.Discover(options), options, archive)
require.NoError(t, err)
require.Contains(t, archiveLayoutEntryNames(t, archive), "manifest.json")
out := restoreGolden(t, app.RestoreFlags{Keys: chromiumFixtureKeysFile(t), DataZip: archive, Dir: t.TempDir()})
assert.Equal(t, golden.Read(t, "extract-json.golden"), golden.Bundle(t, out))
+3 -79
View File
@@ -13,7 +13,6 @@ import (
"github.com/moond4rk/hackbrowserdata/internal/export"
"github.com/moond4rk/hackbrowserdata/internal/log"
"github.com/moond4rk/hackbrowserdata/internal/masterkey"
"github.com/moond4rk/hackbrowserdata/internal/snapshot"
)
// RestoreFlags are restore's command-line values as cobra parsed them.
@@ -96,83 +95,12 @@ func readKeys(path string) (masterkey.Dump, error) {
return dump, nil
}
// RestoreDiscovery rebuilds the user data dirs in data, and their keys from dump: from the manifest when data has one,
// else by today's rules, where the vaults' keys name subdirectories or data is one browser's User Data.
// RestoreDiscovery rebuilds the user data dirs under root, and their keys, from the dump: each vault names a
// subdirectory of root, or root is one browser's User Data.
func RestoreDiscovery(
data *snapshot.Dir, dump masterkey.Dump, options Options,
root string, dump masterkey.Dump, options Options,
) (Discovery, map[browser.UserDataDirID]masterkey.Set, error) {
vaults := vaultsOf(dump, options.Browser)
manifest, ok, err := data.ReadManifest()
if err != nil {
return Discovery{}, nil, err
}
if ok {
discovery, keys := fromManifest(data.Path(), manifest, vaults, options.Browser)
return discovery, keys, nil
}
return fromLayout(data.Path(), vaults)
}
func fromManifest(
root string, manifest snapshot.Manifest, vaults []masterkey.Vault, filter string,
) (Discovery, map[browser.UserDataDirID]masterkey.Set) {
var discovery Discovery
keys := make(map[browser.UserDataDirID]masterkey.Set)
for _, manifestEntry := range manifest.Dirs {
if filter != allBrowsers && manifestEntry.Browser != filter {
continue
}
vault, ok := vaultOf(vaults, manifestEntry)
if !ok {
log.Warnf("restore: %s has no keys, skipping", manifestEntry.ID)
continue
}
dir, err := manifestDir(root, manifestEntry, vault)
if err != nil {
log.Warnf("restore: %s: %v", manifestEntry.ID, err)
continue
}
discovery.Dirs = append(discovery.Dirs, dir)
keys[dir.ID] = vault.Keys
}
return discovery, keys
}
// vaultOf finds an entry's keys: the vault carrying its ID, or for a browser's first dir the vault of that browser.
func vaultOf(vaults []masterkey.Vault, manifestEntry snapshot.ManifestDir) (masterkey.Vault, bool) {
for _, vault := range vaults {
if vaultUserDataDirID(vault) == browser.UserDataDirID(manifestEntry.ID) {
return vault, true
}
}
return masterkey.Vault{}, false
}
// manifestDir trusts no path in the manifest that would leave its own directory of the archive.
func manifestDir(root string, manifestEntry snapshot.ManifestDir, vault masterkey.Vault) (browser.UserDataDir, error) {
if manifestEntry.Base != browser.Chromium.String() {
return browser.UserDataDir{}, fmt.Errorf("base %q is not restorable", manifestEntry.Base)
}
if !isPathElement(manifestEntry.ID) {
return browser.UserDataDir{}, fmt.Errorf("id %q is not a directory name", manifestEntry.ID)
}
restoredBrowser, err := vaultBrowser(vault)
if err != nil {
return browser.UserDataDir{}, err
}
dir := browser.UserDataDir{
ID: browser.UserDataDirID(manifestEntry.ID), Browser: restoredBrowser, Path: filepath.Join(root, manifestEntry.ID),
}
for _, manifestProfile := range manifestEntry.Profiles {
if manifestProfile.Dir != "" && !filepath.IsLocal(filepath.FromSlash(manifestProfile.Dir)) {
return browser.UserDataDir{}, fmt.Errorf("profile dir %q is outside the archive", manifestProfile.Dir)
}
dir.Profiles = append(dir.Profiles, browser.Profile{Name: manifestProfile.Name, Dir: manifestProfile.Dir})
}
return dir, nil
}
func fromLayout(root string, vaults []masterkey.Vault) (Discovery, map[browser.UserDataDirID]masterkey.Set, error) {
archived := false
for _, vault := range vaults {
if dirExists(filepath.Join(root, string(vaultUserDataDirID(vault)))) {
@@ -268,10 +196,6 @@ func vaultKeys(vaults []masterkey.Vault) string {
return strings.Join(keys, ", ")
}
func isPathElement(name string) bool {
return name != "" && name != "." && filepath.IsLocal(name) && !strings.ContainsAny(name, `/\`)
}
func dirExists(path string) bool {
info, err := os.Stat(path)
return err == nil && info.IsDir()
+3 -3
View File
@@ -48,8 +48,8 @@ func TestRestoreGolden(t *testing.T) {
assert.Equal(t, want, golden.Bundle(t, unzipped.Path()))
})
// An archive written before the manifest is the bare <browser-key>/ layout, which the vaults resolve.
t.Run("data-zip without a manifest", func(t *testing.T) {
// An archive v1.1.0 wrote is the same <browser-name>/ layout, which the vaults resolve.
t.Run("data-zip", func(t *testing.T) {
dataZip := filepath.Join(t.TempDir(), "data.zip")
require.NoError(t, snapshot.Open(data).Zip(dataZip))
@@ -105,7 +105,7 @@ func restoreGolden(t *testing.T, flags app.RestoreFlags) string {
}
defer data.Close()
discovery, keys, err := app.RestoreDiscovery(data, dump, options)
discovery, keys, err := app.RestoreDiscovery(data.Path(), dump, options)
require.NoError(t, err)
options.Keys = keys
_, err = app.Execute(context.Background(), app.NewPlan(discovery, options), options)
+14 -24
View File
@@ -11,7 +11,6 @@ import (
"github.com/moond4rk/hackbrowserdata/internal/browser"
"github.com/moond4rk/hackbrowserdata/internal/masterkey"
"github.com/moond4rk/hackbrowserdata/internal/snapshot"
)
func keysFile(t *testing.T, vaults ...masterkey.Vault) string {
@@ -60,30 +59,21 @@ func TestValidateRestore_RejectsBadInput(t *testing.T) {
assert.Len(t, dump.Vaults, 1)
}
func TestRestoreDiscovery_FromManifest(t *testing.T) {
func TestRestoreDiscovery_SecondUserDataDir(t *testing.T) {
root := t.TempDir()
data := snapshot.Open(root)
require.NoError(t, data.WriteManifest(snapshot.Manifest{Version: snapshot.ManifestVersion, Dirs: []snapshot.ManifestDir{
{ID: "chrome", Browser: "chrome", Base: "chromium", Profiles: []snapshot.ManifestProfile{{Name: "Default", Dir: "Default"}}},
{ID: "arc-2", Browser: "arc", Base: "chromium", Profiles: []snapshot.ManifestProfile{{Name: "Work", Dir: "Profile 1"}}},
{ID: "../outside", Browser: "chrome", Base: "chromium"},
{ID: "edge", Browser: "edge", Base: "chromium", Profiles: []snapshot.ManifestProfile{{Name: "Default", Dir: "../../etc"}}},
}}))
arc2 := testVault("arc")
arc2.ID = "arc-2"
dump := masterkey.Dump{Vaults: []masterkey.Vault{testVault("chrome"), testVault("arc"), arc2, testVault("edge")}}
layoutProfile(t, root, "arc")
layoutProfile(t, root, "arc-2")
second := testVault("arc")
second.ID = "arc-2"
second.Keys = masterkey.Set{masterkey.V10: []byte("arc-2")}
dump := masterkey.Dump{Vaults: []masterkey.Vault{testVault("chrome"), testVault("arc"), second}}
discovery, keys, err := RestoreDiscovery(data, dump, Options{Browser: "all"})
discovery, keys, err := RestoreDiscovery(root, dump, Options{Browser: "arc"})
require.NoError(t, err)
assert.Equal(t, []browser.UserDataDirID{"chrome", "arc-2"}, userDataDirIDs(discovery), "a manifest path that leaves its directory is refused")
assert.Equal(t, "Chrome", discovery.Dirs[0].Browser.DisplayName, "restore sets the display name, as dump does")
assert.Equal(t, []browser.UserDataDirID{"arc", "arc-2"}, userDataDirIDs(discovery), "a vault's ID names its directory")
assert.Equal(t, filepath.Join(root, "arc-2"), discovery.Dirs[1].Path)
assert.Equal(t, []browser.Profile{{Name: "Work", Dir: "Profile 1"}}, discovery.Dirs[1].Profiles)
assert.Equal(t, masterkey.Set{masterkey.V10: []byte("arc")}, keys["arc-2"])
discovery, _, err = RestoreDiscovery(data, dump, Options{Browser: "arc"})
require.NoError(t, err)
assert.Equal(t, []browser.UserDataDirID{"arc-2"}, userDataDirIDs(discovery))
assert.Equal(t, "Arc", discovery.Dirs[1].Browser.DisplayName, "restore sets the display name, as dump does")
assert.Equal(t, masterkey.Set{masterkey.V10: []byte("arc-2")}, keys["arc-2"])
}
func TestRestoreDiscovery_FromLayout(t *testing.T) {
@@ -94,7 +84,7 @@ func TestRestoreDiscovery_FromLayout(t *testing.T) {
nightly.Kind = "chromium-yandex"
dump := masterkey.Dump{Vaults: []masterkey.Vault{testVault("chrome"), nightly, testVault("chrome"), testVault("edge")}}
discovery, keys, err := RestoreDiscovery(snapshot.Open(root), dump, Options{Browser: "all"})
discovery, keys, err := RestoreDiscovery(root, dump, Options{Browser: "all"})
require.NoError(t, err)
assert.Equal(t, []browser.UserDataDirID{"chrome", "nightly"}, userDataDirIDs(discovery), "a repeated vault restores once, one without data not at all")
assert.Len(t, keys, 2)
@@ -108,10 +98,10 @@ func TestRestoreDiscovery_OneUserDataNeedsOneVault(t *testing.T) {
touch(t, root, "Default", "History")
dump := masterkey.Dump{Vaults: []masterkey.Vault{testVault("chrome"), testVault("edge")}}
_, _, err := RestoreDiscovery(snapshot.Open(root), dump, Options{Browser: "all"})
_, _, err := RestoreDiscovery(root, dump, Options{Browser: "all"})
require.Error(t, err)
discovery, _, err := RestoreDiscovery(snapshot.Open(root), dump, Options{Browser: "edge"})
discovery, _, err := RestoreDiscovery(root, dump, Options{Browser: "edge"})
require.NoError(t, err)
require.Equal(t, []browser.UserDataDirID{"edge"}, userDataDirIDs(discovery))
assert.Equal(t, root, discovery.Dirs[0].Path)
-1
View File
@@ -29,4 +29,3 @@ chrome/Profile 1/Session Storage/000004.log method=8 modified=1979-11-30T00:00:0
chrome/Profile 1/Session Storage/CURRENT method=8 modified=1979-11-30T00:00:00Z size=33 crc32=6290110a
chrome/Profile 1/Session Storage/MANIFEST-000001 method=8 modified=1979-11-30T00:00:00Z size=41 crc32=8f635ae8
chrome/Profile 1/Web Data method=8 modified=1979-11-30T00:00:00Z size=18 crc32=e0117ed3
manifest.json method=8 modified=1979-11-30T00:00:00Z size=1004 crc32=ed341f82
-1
View File
@@ -6,4 +6,3 @@ chrome/Default/Preferences method=8 modified=1979-11-30T00:00:00Z size=19 crc32=
chrome/Local State method=8 modified=1979-11-30T00:00:00Z size=11 crc32=015c5138
chrome/Profile 1/Network/Cookies method=8 modified=1979-11-30T00:00:00Z size=25 crc32=184f7580
chrome/Profile 1/Preferences method=8 modified=1979-11-30T00:00:00Z size=21 crc32=be2429c4
manifest.json method=8 modified=1979-11-30T00:00:00Z size=492 crc32=09e41450
-14
View File
@@ -28,20 +28,6 @@ const (
Safari
)
// String is the base's name in a snapshot manifest.
func (b Base) String() string {
switch b {
case Chromium:
return "chromium"
case Firefox:
return "firefox"
case Safari:
return "safari"
default:
return "unknown"
}
}
// Platform is one OS's half of a Browser; one without UserDataDirs means the browser is not supported there.
type Platform struct {
UserDataDirs []string // slash-separated, relative to the home directory; globs allowed
+1 -1
View File
@@ -176,7 +176,7 @@ func KeyFileSpecs(_ browser.UserDataDir) []browser.FileSpec {
return []browser.FileSpec{localState}
}
// ArchiveFileSpecs add Local State and each profile's marker, so a reader without the manifest finds every profile.
// ArchiveFileSpecs add each profile's marker, by which restore rediscovers the profiles, and Local State as v1.1.0 did.
func ArchiveFileSpecs(_ browser.UserDataDir) []browser.FileSpec {
fileSpecs := []browser.FileSpec{localState}
for _, marker := range profileMarkers {
-63
View File
@@ -1,63 +0,0 @@
package snapshot
import (
"encoding/json"
"errors"
"fmt"
"io/fs"
"os"
"path/filepath"
)
const ManifestVersion = 1
const manifestName = "manifest.json"
// Manifest records what a snapshot directory holds, so a reader rebuilds its user data dirs without discovering them.
type Manifest struct {
Version int `json:"version"`
Dirs []ManifestDir `json:"dirs"`
}
type ManifestDir struct {
ID string `json:"id"`
Browser string `json:"browser"`
Base string `json:"base"`
Profiles []ManifestProfile `json:"profiles"`
Files []string `json:"files"`
}
type ManifestProfile struct {
Name string `json:"name"`
Dir string `json:"dir"`
}
func (d *Dir) WriteManifest(manifest Manifest) error {
data, err := json.MarshalIndent(manifest, "", " ")
if err != nil {
return fmt.Errorf("encode manifest: %w", err)
}
if err := os.WriteFile(filepath.Join(d.path, manifestName), append(data, '\n'), 0o600); err != nil {
return fmt.Errorf("write manifest: %w", err)
}
return nil
}
// ReadManifest reports false for a snapshot directory without a manifest, such as an archive written before it.
func (d *Dir) ReadManifest() (Manifest, bool, error) {
data, err := os.ReadFile(filepath.Join(d.path, manifestName))
if errors.Is(err, fs.ErrNotExist) {
return Manifest{}, false, nil
}
if err != nil {
return Manifest{}, false, fmt.Errorf("read manifest: %w", err)
}
var manifest Manifest
if err := json.Unmarshal(data, &manifest); err != nil {
return Manifest{}, false, fmt.Errorf("decode manifest: %w", err)
}
if manifest.Version != ManifestVersion {
return Manifest{}, false, fmt.Errorf("unsupported manifest version %d (this build reads %d)", manifest.Version, ManifestVersion)
}
return manifest, true, nil
}
-38
View File
@@ -1,38 +0,0 @@
package snapshot
import (
"os"
"path/filepath"
"testing"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
func TestManifest_RoundTrip(t *testing.T) {
snapshotDir := Open(t.TempDir())
want := Manifest{Version: ManifestVersion, Dirs: []ManifestDir{{
ID: "arc-2", Browser: "arc", Base: "chromium",
Profiles: []ManifestProfile{{Name: "Default", Dir: "Default"}},
Files: []string{"Local State", "Default/Preferences"},
}}}
require.NoError(t, snapshotDir.WriteManifest(want))
got, ok, err := snapshotDir.ReadManifest()
require.NoError(t, err)
assert.True(t, ok)
assert.Equal(t, want, got)
}
func TestManifest_AbsentIsNotAnError(t *testing.T) {
_, ok, err := Open(t.TempDir()).ReadManifest()
require.NoError(t, err)
assert.False(t, ok)
}
func TestManifest_RejectsAnotherVersion(t *testing.T) {
root := t.TempDir()
require.NoError(t, os.WriteFile(filepath.Join(root, manifestName), []byte(`{"version": 2, "dirs": []}`), 0o600))
_, _, err := Open(root).ReadManifest()
assert.Error(t, err)
}
+1 -1
View File
@@ -17,7 +17,7 @@ internal/
record/ record types (Login, Cookie, …) and the Record interface; field names frozen by the output contract
masterkey/ Chromium key Set, Retriever, RetrieveAll, keys.json Dump; OS secret stores by build tag
crypto/ pure decrypt primitives over bytes (AES-CBC/GCM, 3DES, PBKDF2, ASN.1 PBE)
snapshot/ snapshot Dir and Snapshot, Capture, manifest, zip transport, the copier
snapshot/ snapshot Dir and Snapshot, Capture, zip transport, the copier
export/ Writer; csv / json / cookie-editor encoders; --zip packaging
sqlitex/ thin modernc.org/sqlite helpers (open read-only by path, query)
timeconv/ browser epoch conversions (Chromium/WebKit, Unix, Firefox, Core Data)
+1 -1
View File
@@ -121,7 +121,7 @@ Most file specs belong to one profile (cookies, history) and are declared relati
Two Chromium facts concern a whole user data dir rather than one category, and both stay in the Chromium base, so `app` never spells a Chromium file name:
- **Key material.** The extractors that decrypt — passwords, cookies, credit cards — list `Local State` as a `Shared` file spec, so it is captured only when a decrypting category is requested. `KeyLocator` builds the dir's `masterkey.Locator` from the captured `Local State` and the `Platform` fields; on macOS `app` adds the run's login keychain, then wraps retrieval in the dir's call-once, which every `ProfileSnapshot` of the dir shares as its `MasterKeys` ([RFC-006](006-key-retrieval-and-crypto.md)).
- **Layout markers.** `archive` also captures `Local State` and each profile's `Preferences` (or `Preferences_02`) marker, so a reader without the manifest can still find every profile; `ArchiveFileSpecs` names them.
- **Layout markers.** `archive` also captures `Local State` and each profile's `Preferences` (or `Preferences_02`) marker, by which `restore` rediscovers every profile; `ArchiveFileSpecs` names them.
## Adding a browser (the whole motion)
+3 -3
View File
@@ -48,13 +48,13 @@ Because it holds those copies, a temporary snapshot directory is created with mo
A snapshot directory is `<dir>/<user-data-dir-id>/<path relative to the user data dir>`: one subdirectory, one snapshot, per user data dir. For the first user data dir of a browser the ID is its `Browser.Name`, so the layout is exactly v1.1.0's archive layout (`<browser-key>/<User Data layout>`) and v1.1.0's `restore` reads new archives unchanged. A second one of the same browser — the second of Arc's two MSIX packages on Windows — gets `arc-2/`, where v1.1.0's archive keyed every file by browser key alone and silently dropped it.
An archive captures what v1.1.0's did — `Local State` and each profile's `Preferences` marker (both named by the Chromium base, [RFC-005](005-browser-definitions.md)), the requested categories' files, and the account-synced `Login Data For Account` — so a reader without the manifest can still find every profile.
An archive captures what v1.1.0's did — `Local State` and each profile's `Preferences` marker (both named by the Chromium base, [RFC-005](005-browser-definitions.md)), the requested categories' files, and the account-synced `Login Data For Account` — so `restore` rediscovers every profile from the layout alone.
`keys.json` joins to the archive by the vault's `browser` key, as in v1.1.0. A vault for a second user data dir carries an extra optional `id` field (`"arc-2"`) — the `UserDataDirID` on the wire, per the wire-name rule; readers that don't know the field, including v1.1.0, ignore it and restore the first one. The dump version stays `"2"`.
## Manifest
## No manifest
A new snapshot directory carries `manifest.json` at its root: a schema version, and per user data dir its ID, `Browser.Name`, `Base`, profiles, and captured paths. `restore` uses it, when present, to rebuild user data dirs and profiles without re-discovering anything — that is its `Discovery` ([RFC-003](003-core-types.md)) — and then runs Extract → Export → Report exactly as a live run would. Restore trusts no manifest path that would leave its own directory of the archive. Archives without a manifest — every archive v1.1.0 made — still restore through the keys.json vaults plus the directory layout. v1.1.0 ignores the extra file.
An archive holds only the layout. `restore` rebuilds user data dirs and profiles from the keys.json vaults plus that layout, which is the only way v1.1.0's archives can restore, and the same way serves every archive this version writes, so a manifest would only be a second description of the layout to keep in step with it. Restore then runs Extract → Export → Report exactly as a live run would. One thing the layout cannot carry is a flat-layout profile's original name (older Opera keeps its profile at the user data dir root): such a profile restores under its archive directory's name, as it did in v1.1.0.
## Copy semantics
+1 -1
View File
@@ -82,7 +82,7 @@ The `go 1.20` directive constrains more than the standard library:
## Tooling
- **golangci-lint v2** — the project's existing config, extended with `tagliatelle` (`case.use-field-name: true`, `case.rules: {json: snake, csv: snake}`) on the packages that own a wire format — `record`, `masterkey` (`keys.json`), and `snapshot` (`manifest.json`); the Cookie-Editor encoder and any struct that mirrors a browser's own file format stay outside it. `lll` stays at 140.
- **golangci-lint v2** — the project's existing config, extended with `tagliatelle` (`case.use-field-name: true`, `case.rules: {json: snake, csv: snake}`) on the packages that own a wire format — `record` and `masterkey` (`keys.json`); the Cookie-Editor encoder and any struct that mirrors a browser's own file format stay outside it. `lll` stays at 140.
- **gofumpt** + **goimports** with `-local github.com/moond4rk/hackbrowserdata`.
- **CI matrix**: Go pinned to `1.20.x` (not `go-version-file`) on Windows, macOS, and Linux; build + vet + lint + test; a step that fails unless `go.mod` says `go 1.20` with no `toolchain` line. The Windows ABE path is additionally validated on a dedicated Windows host against the current cookie/key baseline, not in hosted CI.