* refactor(app): export one function per command
Step 2 of #710. A command's logic was split between cmd and stage-shaped app calls; cmd now parses flags, calls one function and prints what it returns. An error means the command never ran, and a run that ended early says so in Summary.Err.
* fix(app): check dumpkeys and archive -o up front
A missing output directory was reported only after the keys were retrieved or the files copied.
* docs(rfcs): move restore's input out of the command layer
Restore now discovers its directories in an archive itself, so the command layer no longer holds the data it reads.
Step 1 of #710. Goldens pin what a run prints before the entry code moves, and the renames follow two naming rules added to RFC-001. No behavior change.
Validate now returns only what each command reads, with -b resolved to browsers or vaults, so no
stage compares against "all"; printing moves to cmd, which already printed the list tables.
Bare dir now always means a user data dir, so the snapshot root, the export listing, and the
keys.json kind get their own words; names used only inside their package are no longer exported.
* refactor(app): per-command flags and per-stage inputs
One Options bag fed every stage and cmd patched restore's keys into it after validation; each stage now takes what it
reads, dir-level failures are their own type, and cmd prints what a run exported.
* refactor(app): group the plan by dir and profile
Execute now walks the plan's own shape instead of filtering a flat list and looking profiles up by name.
* refactor(app): file code by command and stage
Pure moves: each command's flags and validation sit beside its stage, and execute.go keeps only the runner.
* refactor: read the keychain password in cmd
Prompting and reading stdin are terminal work, so app now receives the password func; cobra already rejects both flags.
* refactor(app): plan each user data dir right before it runs
A run-wide Plan had to drop its extractors and rebuild them with the keychain; per-dir planning keeps one extractor.
21 RFCs repeated the code's names, steps, lists, and version history, so one rename touched eleven of them;
eight short ones now keep only what was decided and why, and change only when a decision does.
log.Base had one implementation, the chromium file specs took a dir they never read, and emit was written three times;
varnamelen now lets db, fd, and n stay short as Go readers expect.
snapshot.Zip followed symlinks and kept an existing archive's mode, edge cases export's --zip never needed;
both now write a temp file beside the target and rename it into place.
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.
Def, Request, DirID, and Source said too little, and short variables and doc comments that skip their name hid intent.
varnamelen and staticcheck ST1020-22 now keep both from coming back.
A Stat error other than not-exist was reported as absent, and the --zip archive was readable by other users.
The rest is review follow-up: export no longer prints, one runner type, shared name helpers, a trimmed log API.
Local v2.14 and CI v2.10 disagreed on gofumpt; extra.group-params keeps v2.10's rules exactly.
go test ./... -update failed in the 12 packages that never import golden, so it is HBD_UPDATE_GOLDEN=1 now.
The design RFCs describe the code as it is rather than contrasting it with v1.1.0, the migration
roadmap is gone, and the technique RFCs use the current masterkey.Locator / RetrieveAll / internal/abe
names instead of the deleted types and paths. Docs only; techniques unchanged.
crypto/windows and utils/injector were the last public packages, against the no-library-API rule, and
utils/ named nothing. They move as one unit; only import paths and Makefile variables change, and the
built payload is byte-identical.
The pipeline goldens now live in app, export in export, and keys.json in masterkey, each with its own
testdata; cmd keeps the flag and list goldens. Shared fixtures and golden helpers became the
internal/browser/browsertest and internal/golden packages. The binary is byte-identical.
A signal killed the process mid-run and left the snapshot's copies of browser files in the temp dir.
The run now stops at its next step, removes them, and ends by the same signal, so the exit status and
calling scripts see what they did before. RFC-012 also keeps the list goldens in cmd.
dump, dumpkeys, archive, restore, and list now run on the app stages, so cmd's old path goes away.
archive writes manifest.json and restore reads it, falling back to today's layout for older archives.
Windows and macOS smoke matched today's output apart from the planned changes.
Without the data key the Yandex stores exported nothing, unlike every other store, so a key
failure or a master password lost the rows and list --detail, which reads no key, counted 0.
The pipeline's Validate rejects bad -b/-c/-f/-d/-p before discovery (an unknown -b now exits 1).
-p at a Chromium profile dir uses its parent, so Local State is found; Firefox -p selects only that
profile; the keychain password comes from a flag, stdin, a terminal prompt, or nowhere.
CompressDir deleted each file as it was added and wrote the zip last, so a failure lost the output,
and it packed and deleted every file in -d. The writer now packs only the files it wrote, renames
the zip into place, and only then removes them.
Parsers move with git mv and hand records to a Collector; discovery reads a copy
of SafariTabs.db, and app hands the run's login keychain to the default profile's
password extractor. The old browser/safari runs the new extractors.
Parsers move with git mv and hand records to a Collector; the old browser/firefox
runs them, and app now discovers Firefox. A profile without a usable key exports
its logins instead of panicking, as RFC-008 now lists.
CocCoc and Yandex both ship browser.exe and App Paths names only one, so ABE asked Yandex's program
for CocCoc's key and CocCoc's v20 cookies came out empty. A browser's own install locations now come
first, then App Paths, then a running process.
Validate, Discover, NewPlan, Execute, and Report run beside today's path: one snapshot per user
data dir, each dir's keys retrieved once on first use, every record stamped by the collector.
On the Chromium fixtures it writes the extract goldens byte for byte; the CLI switches over later.
One Def per browser carries every OS's user data dirs, keychain label, and Windows ABE target,
so the per-OS lists and the abeTargets join go away and today's configs derive from it;
a test parsing com_iid.c keeps the payload's table in step with the ABE rows.
One copier and one zip transport serve archive, restore, and every profile copy, so locked-file handling has one home.
Dropping otiai10/copy takes x/sync out of every binary and testing out of the Windows exe.
Crypto stays free of OS calls, so every secret-store read sits behind one masterkey contract.
The macOS v10 retriever reads one run-scoped login keychain handle that Safari will share.
Later layers speak categories and records, and export needs nothing else.
Ordering rows once in the exporter fixes Firefox history, written least visited first.
* fix(windows): harden the ABE payload injection lifecycle
The browser main thread is never resumed, so no window appears and the temp user-data-dir is unnecessary. Payload memory is RW then RX, with an explicit FlushInstructionCache before the remote thread executes it.
* test(windows): use US spelling in offset test
* fix(windows): validate bootstrap parameter encoding
* feat(cli): add archive command for cross-host data transport
* fix(archive): correct flat-layout path and entry-count wording
* refactor(archive): rename BuildArchive to WriteArchive
* refactor(cli): flatten keys export/import into dumpkeys/restore
The keys noun-group clashed with the flat dump/list verbs; unify on flat verbs and drop the keys parent. Pure rename, no behavior change.
* docs(rfc): add RFC-013 CLI redesign & cross-host restore
The accepted design doc for the flat-verb CLI redesign and cross-platform restore.
* refactor(browser): split installation and profile abstractions
A Chromium installation shares one master key across its profiles, but
modeling each profile as its own Browser re-derived the key per profile.
Browser now represents one installation holding its profiles and derives
the key once; new types.Profile/ExtractResult/CountResult carry per-profile
results.
* style: gofumpt safari_test.go
* test(chromium): rename shadowed loop var to path
* feat(safari): localstorage extraction
Extracts Safari 17+ localStorage from WebKit's nested layout —
WebsiteDataStore/<uuid>/Origins/<top-hash>/<frame-hash>/LocalStorage/
localstorage.sqlite3 for named profiles, WebsiteData/Default for the
default profile. Parses the binary SecurityOrigin serialization
(length-prefixed scheme+host plus 0x00 default-port or 0x01 <uint16_le>
explicit-port section) and decodes UTF-16 LE ItemTable value BLOBs,
capping oversized values at 2048 bytes to match the Chromium extractor.
Reports the frame origin URL so partitioned third-party storage is
attributed to the iframe origin JavaScript actually sees.
Closes the remaining LocalStorage checkbox in #565.
* docs(safari): add RFC-011 data storage
Documents Safari's profile structure, per-category file layouts, and
storage formats including the Safari 17+ nested WebKit Origins
localStorage layout and binary SecurityOrigin serialization. Defers
Keychain credential extraction to RFC-006 §7 and notes the cross-browser
differences (plaintext cookies, plist bookmarks/downloads, Core Data
epoch timestamps, partitioned storage).
* fix(safari): latin-1 origin decoding, NULL key skip, count fast-path
- Decode originEncASCII via decodeLatin1 so high-byte records preserve
their ISO-8859-1 meaning instead of being interpreted as UTF-8.
Matches the pattern in chromium/extract_storage.go.
- Skip ItemTable rows where key is NULL — SQLite's UNIQUE constraint
permits multiple NULLs, and silently lowering them to empty strings
would collide with legitimate empty-string keys.
- countLocalStorage now walks origin dirs and runs SELECT COUNT(key)
per localstorage.sqlite3 instead of fully decoding every value.
COUNT(key) naturally excludes NULLs, keeping count and extract
symmetric.
Addresses Copilot review feedback on #582.
* fix(safari): round-2 review — WAL replay, stable ordering, error context
- Drop immutable=1 on temp-copy SQLite opens in readLocalStorageFile /
countLocalStorageFile. Session.Acquire copies the -wal / -shm sidecars,
so mode=ro alone lets SQLite replay WAL on the ephemeral copy and
surface entries Safari committed to WAL but hasn't checkpointed yet.
Live-file reads in profiles.go keep immutable=1 as before.
- Order ItemTable query by (key, rowid) for deterministic exports across
runs and SQLite versions.
- Wrap os.ReadFile / os.ReadDir errors with the offending path so
multi-origin debug logs stay scannable.
- RFC-011 §7 rewritten to explain the live-vs-temp split.
- New regression test asserts ORDER BY surfaces rows in key order.
Addresses round-2 Copilot review on #582.
* feat: add browserdata/datautil helpers (QuerySQLite, QueryRows, DecryptChromiumValue)
Phase 2 of architecture refactoring (RFC-002 Section 3):
- datautil/sqlite.go: QuerySQLite() — shared SQLite open/query/scan helper
with optional journal_mode=off for Firefox databases
- datautil/query.go: QueryRows[T]() — generic helper (Go 1.20) that wraps
QuerySQLite and collects results into a typed slice
- datautil/decrypt.go: DecryptChromiumValue() — unified Chromium decryption
(DPAPI first, then AES-GCM/CBC fallback)
- datautil/sqlite_test.go: tests for all helpers
* refactor: move DecryptChromiumValue from datautil to browser/chromium
- Remove browserdata/datautil/decrypt.go (Chromium-specific, not a generic util)
- Will be added as browser/chromium/decrypt.go (unexported decryptValue)
in the chromium extract methods PR
- Update RFCs to reflect the change
- Remove decrypt test from datautil tests
* refactor: move datautil to utils/sqliteutil for consistency
- Rename browserdata/datautil/ → utils/sqliteutil/
- Aligns with existing utils/ convention (fileutil, typeutil, byteutil)
- QuerySQLite/QueryRows are generic SQLite helpers, not browserdata-specific
- Update package name from datautil to sqliteutil
- Update both RFCs to reflect new location
* fix: apply review suggestions for sqliteutil
- QuerySQLite: validate dbPath exists before sql.Open to prevent
silently creating empty databases
- Tests: check db.Close() errors with require.NoError