Phase 0 of the refactor: settle the design record and pin the CLI flag surface and wire names before any code moves.
9.1 KiB
RFC-010: Dependencies
Every dependency is justified or dropped. The bar: a dependency earns its place only if replacing it with stdlib would cost materially more than the dependency costs us (in audit surface, license, and Go-1.20 compatibility). The tool runs on evidence machines and goes on stage — the dependency list is part of the audit story.
Direct dependencies — keep / drop / pin
| Module | Decision | Rationale |
|---|---|---|
modernc.org/sqlite v1.31.1 |
KEEP, pinned | Pure-Go SQLite; no cgo, so cross-compilation stays trivial. v1.32+ needs Go 1.21. Wrapped by internal/sqlitex. |
github.com/spf13/cobra + pflag |
KEEP | Command tree and flags; the frozen CLI surface is defined with them. Confined to cmd/. |
github.com/inconshreveable/mousetrap |
KEEP | Detects a launch from Explorer (double-click) so cmd/ can hide the console and skip cobra's double-click guard; already required by cobra. |
github.com/tidwall/gjson v1.18.0 |
KEEP, pinned | Read-only JSON probing of browser files (Local State, Bookmarks, Secure Preferences) without full unmarshal. v1.19+ needs Go 1.23. |
github.com/syndtr/goleveldb |
KEEP | LevelDB reader for Local/Session Storage. No stdlib equivalent. |
github.com/moond4rk/binarycookies |
KEEP | First-party; Safari cookie format. MIT. |
github.com/moond4rk/plist |
KEEP | First-party fork of howett.net/plist; Safari plists. BSD-3 — keep Howett's notice. |
github.com/moond4rk/keychainbreaker |
KEEP | First-party; macOS keychain files. Apache-2.0. Behind keychain and masterkey (darwin); the Safari extractor uses only its record type. |
github.com/godbus/dbus/v5 + ppacher/go-dbus-keyring |
KEEP | Linux Secret Service access. BSD. Behind masterkey (linux). |
golang.org/x/sys v0.30.0 |
KEEP, pinned | Windows syscalls for DPAPI, locked-file copy, and the ABE bridge. Behind winapi and abe. Later releases raise the go directive above 1.20. |
golang.org/x/term v0.29.0 |
KEEP, pinned | No-echo password prompt (RFC-009). v0.30+ needs Go 1.23. |
github.com/otiai10/copy |
DROP | It links golang.org/x/sync into every binary, and its Windows build imports testing and the github.com/otiai10/mint assertion library from non-test code, so both ship in the release exe. Every call already goes through one wrapper; a ~50-line copier in internal/snapshot (files, directories, skip list) replaces it. |
github.com/stretchr/testify |
KEEP (test-only) | Assertions in tests; never linked into the binary. |
golang.org/x/text needs no action: HBD does not import it and it is not linked into the binary. It stays in go.mod as // indirect only because goleveldb's test dependencies require it (go mod why -m golang.org/x/text), so dropping it is not something HBD code can do — and the project CLAUDE.md's "x/text will be removed" note is already moot.
Indirect dependencies
The modernc.org/* set (libc, memory, mathutil, …) comes in through modernc.org/sqlite and rides its pin. go-humanize, golang-lru/v2, uuid, go-isatty, go-strftime, bigfft, snappy, tidwall/match + pretty, go.yaml.in/yaml/v3, x/sync, x/tools, x/text are transitive. After dropping otiai10/copy, run go mod tidy under the Go 1.20 toolchain and confirm that otiai10/mint leaves the module graph and the go directive does not move.
The Go 1.20 discipline
go mod tidyandgo mod verifymust be run with the go@1.20 toolchain (per project CLAUDE.md), or a transitive dependency silently bumps thegodirective and breaks the Windows 7 build.- Any candidate dependency is checked for its own
godirective before adoption. A library requiring 1.21+ is disqualified regardless of merit. - Dependabot's ignore rules (
.github/dependabot.yml) hold every pin above; a new pin gets its rule in the same PR. - CI must not follow
go.mod. Today every workflow runsactions/setup-gowithgo-version-file: go.mod, so if a bump raises thegodirective, CI installs the newer Go and passes. CI pinsgo-version: '1.20.x'instead and fails whengo.modsays anything butgo 1.20or gains atoolchainline (RFC-011).
License hygiene
The project is MIT; the shipped binary links only permissively licensed modules. The policy is an allowlist — MIT, BSD-2-Clause, BSD-3-Clause, Apache-2.0, ISC — checked against the modules actually linked into each release binary (go list -deps per GOOS), and a release that links anything else fails. Today's linked set is MIT (gjson, binarycookies), BSD (modernc, goleveldb, godbus, go-dbus-keyring, plist, the x/ modules), and Apache-2.0 (cobra, keychainbreaker). golang-lru/v2 (MPL-2.0) is in the module graph but not linked; the check keeps it that way.
BSD and Apache-2.0 require their notices in binary distributions, so each release archive ships a THIRD_PARTY_NOTICES file generated from the linked modules' license files.
Net effect
Drop otiai10/copy (and with it x/sync from every binary and testing + mint from the Windows exe); make every Go-1.20 pin explicit; keep everything else. The result is a dependency list short enough to read aloud and defend — which is the goal for a showcased tool.