mirror of
https://github.com/moonD4rk/HackBrowserData.git
synced 2026-12-04 05:43:27 +01:00
refactor: merge the browser tables into internal/browser (#654)
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.
This commit is contained in:
1 parent
0b8cc23216
commit
b655afd054
17 files changed
+432
-424
No files matched your search
@@ -1,60 +0,0 @@
|
||||
//go:build windows
|
||||
|
||||
package browser
|
||||
|
||||
import "github.com/moond4rk/hackbrowserdata/internal/masterkey"
|
||||
|
||||
// abeTarget is a Windows ABE browser's executable and elevation-service dialect, keyed by BrowserConfig.Key.
|
||||
// It stays beside the browser table until browser.Def.Platform absorbs it.
|
||||
type abeTarget struct {
|
||||
exe string
|
||||
fallbacks []string
|
||||
kind masterkey.ABEKind
|
||||
}
|
||||
|
||||
var abeTargets = map[string]abeTarget{
|
||||
"chrome": {
|
||||
exe: "chrome.exe",
|
||||
fallbacks: []string{
|
||||
`%ProgramFiles%\Google\Chrome\Application\chrome.exe`,
|
||||
`%ProgramFiles(x86)%\Google\Chrome\Application\chrome.exe`,
|
||||
`%LocalAppData%\Google\Chrome\Application\chrome.exe`,
|
||||
},
|
||||
kind: masterkey.ABEChromeBase,
|
||||
},
|
||||
"chrome-beta": {
|
||||
exe: "chrome.exe",
|
||||
fallbacks: []string{
|
||||
`%ProgramFiles%\Google\Chrome Beta\Application\chrome.exe`,
|
||||
`%ProgramFiles(x86)%\Google\Chrome Beta\Application\chrome.exe`,
|
||||
`%LocalAppData%\Google\Chrome Beta\Application\chrome.exe`,
|
||||
},
|
||||
kind: masterkey.ABEChromeBase,
|
||||
},
|
||||
"edge": {
|
||||
exe: "msedge.exe",
|
||||
fallbacks: []string{
|
||||
`%ProgramFiles(x86)%\Microsoft\Edge\Application\msedge.exe`,
|
||||
`%ProgramFiles%\Microsoft\Edge\Application\msedge.exe`,
|
||||
},
|
||||
kind: masterkey.ABEEdge,
|
||||
},
|
||||
"brave": {
|
||||
exe: "brave.exe",
|
||||
fallbacks: []string{
|
||||
`%ProgramFiles%\BraveSoftware\Brave-Browser\Application\brave.exe`,
|
||||
`%ProgramFiles(x86)%\BraveSoftware\Brave-Browser\Application\brave.exe`,
|
||||
`%LocalAppData%\BraveSoftware\Brave-Browser\Application\brave.exe`,
|
||||
},
|
||||
kind: masterkey.ABEChromeBase,
|
||||
},
|
||||
"coccoc": {
|
||||
exe: "browser.exe",
|
||||
fallbacks: []string{
|
||||
`%ProgramFiles%\CocCoc\Browser\Application\browser.exe`,
|
||||
`%ProgramFiles(x86)%\CocCoc\Browser\Application\browser.exe`,
|
||||
`%LocalAppData%\CocCoc\Browser\Application\browser.exe`,
|
||||
},
|
||||
kind: masterkey.ABEChromeBase,
|
||||
},
|
||||
}
|
||||
@@ -14,103 +14,8 @@ import (
|
||||
"github.com/moond4rk/hackbrowserdata/internal/keychain"
|
||||
"github.com/moond4rk/hackbrowserdata/internal/log"
|
||||
"github.com/moond4rk/hackbrowserdata/internal/masterkey"
|
||||
"github.com/moond4rk/hackbrowserdata/types"
|
||||
)
|
||||
|
||||
func platformBrowsers() []types.BrowserConfig {
|
||||
return []types.BrowserConfig{
|
||||
{
|
||||
Key: "chrome",
|
||||
Name: chromeName,
|
||||
Kind: types.Chromium,
|
||||
KeychainLabel: "Chrome",
|
||||
UserDataDir: homeDir + "/Library/Application Support/Google/Chrome",
|
||||
},
|
||||
{
|
||||
Key: "edge",
|
||||
Name: edgeName,
|
||||
Kind: types.Chromium,
|
||||
KeychainLabel: "Microsoft Edge",
|
||||
UserDataDir: homeDir + "/Library/Application Support/Microsoft Edge",
|
||||
},
|
||||
{
|
||||
Key: "chromium",
|
||||
Name: chromiumName,
|
||||
Kind: types.Chromium,
|
||||
KeychainLabel: "Chromium",
|
||||
UserDataDir: homeDir + "/Library/Application Support/Chromium",
|
||||
},
|
||||
{
|
||||
Key: "chrome-beta",
|
||||
Name: chromeBetaName,
|
||||
Kind: types.Chromium,
|
||||
KeychainLabel: "Chrome",
|
||||
UserDataDir: homeDir + "/Library/Application Support/Google/Chrome Beta",
|
||||
},
|
||||
{
|
||||
Key: "opera",
|
||||
Name: operaName,
|
||||
Kind: types.ChromiumOpera,
|
||||
KeychainLabel: "Opera",
|
||||
UserDataDir: homeDir + "/Library/Application Support/com.operasoftware.Opera",
|
||||
},
|
||||
{
|
||||
Key: "opera-gx",
|
||||
Name: operaGXName,
|
||||
Kind: types.ChromiumOpera,
|
||||
KeychainLabel: "Opera",
|
||||
UserDataDir: homeDir + "/Library/Application Support/com.operasoftware.OperaGX",
|
||||
},
|
||||
{
|
||||
Key: "vivaldi",
|
||||
Name: vivaldiName,
|
||||
Kind: types.Chromium,
|
||||
KeychainLabel: "Vivaldi",
|
||||
UserDataDir: homeDir + "/Library/Application Support/Vivaldi",
|
||||
},
|
||||
{
|
||||
Key: "coccoc",
|
||||
Name: coccocName,
|
||||
Kind: types.Chromium,
|
||||
KeychainLabel: "CocCoc",
|
||||
UserDataDir: homeDir + "/Library/Application Support/Coccoc",
|
||||
},
|
||||
{
|
||||
Key: "brave",
|
||||
Name: braveName,
|
||||
Kind: types.Chromium,
|
||||
KeychainLabel: "Brave",
|
||||
UserDataDir: homeDir + "/Library/Application Support/BraveSoftware/Brave-Browser",
|
||||
},
|
||||
{
|
||||
Key: "yandex",
|
||||
Name: yandexName,
|
||||
Kind: types.ChromiumYandex,
|
||||
KeychainLabel: "Yandex",
|
||||
UserDataDir: homeDir + "/Library/Application Support/Yandex/YandexBrowser",
|
||||
},
|
||||
{
|
||||
Key: "arc",
|
||||
Name: arcName,
|
||||
Kind: types.Chromium,
|
||||
KeychainLabel: "Arc",
|
||||
UserDataDir: homeDir + "/Library/Application Support/Arc/User Data",
|
||||
},
|
||||
{
|
||||
Key: "firefox",
|
||||
Name: firefoxName,
|
||||
Kind: types.Firefox,
|
||||
UserDataDir: homeDir + "/Library/Application Support/Firefox/Profiles",
|
||||
},
|
||||
{
|
||||
Key: "safari",
|
||||
Name: safariName,
|
||||
Kind: types.Safari,
|
||||
UserDataDir: homeDir + "/Library/Safari",
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
// loginKeychainPath is the per-user login keychain the run reads Chromium v10 secrets from.
|
||||
func loginKeychainPath() string {
|
||||
home, err := os.UserHomeDir()
|
||||
|
||||
@@ -2,70 +2,6 @@
|
||||
|
||||
package browser
|
||||
|
||||
import (
|
||||
"github.com/moond4rk/hackbrowserdata/types"
|
||||
)
|
||||
|
||||
func platformBrowsers() []types.BrowserConfig {
|
||||
return []types.BrowserConfig{
|
||||
{
|
||||
Key: "chrome",
|
||||
Name: chromeName,
|
||||
Kind: types.Chromium,
|
||||
KeychainLabel: "Chrome Safe Storage",
|
||||
UserDataDir: homeDir + "/.config/google-chrome",
|
||||
},
|
||||
{
|
||||
Key: "edge",
|
||||
Name: edgeName,
|
||||
Kind: types.Chromium,
|
||||
KeychainLabel: "Chromium Safe Storage",
|
||||
UserDataDir: homeDir + "/.config/microsoft-edge",
|
||||
},
|
||||
{
|
||||
Key: "chromium",
|
||||
Name: chromiumName,
|
||||
Kind: types.Chromium,
|
||||
KeychainLabel: "Chromium Safe Storage",
|
||||
UserDataDir: homeDir + "/.config/chromium",
|
||||
},
|
||||
{
|
||||
Key: "chrome-beta",
|
||||
Name: chromeBetaName,
|
||||
Kind: types.Chromium,
|
||||
KeychainLabel: "Chrome Safe Storage",
|
||||
UserDataDir: homeDir + "/.config/google-chrome-beta",
|
||||
},
|
||||
{
|
||||
Key: "opera",
|
||||
Name: operaName,
|
||||
Kind: types.ChromiumOpera,
|
||||
KeychainLabel: "Chromium Safe Storage",
|
||||
UserDataDir: homeDir + "/.config/opera",
|
||||
},
|
||||
{
|
||||
Key: "vivaldi",
|
||||
Name: vivaldiName,
|
||||
Kind: types.Chromium,
|
||||
KeychainLabel: "Chrome Safe Storage",
|
||||
UserDataDir: homeDir + "/.config/vivaldi",
|
||||
},
|
||||
{
|
||||
Key: "brave",
|
||||
Name: braveName,
|
||||
Kind: types.Chromium,
|
||||
KeychainLabel: "Brave Safe Storage",
|
||||
UserDataDir: homeDir + "/.config/BraveSoftware/Brave-Browser",
|
||||
},
|
||||
{
|
||||
Key: "firefox",
|
||||
Name: firefoxName,
|
||||
Kind: types.Firefox,
|
||||
UserDataDir: homeDir + "/.mozilla/firefox",
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
// newCredentialInjector is a no-op on Linux: RetrieveAll runs the peanuts (v10) and D-Bus keyring (v11)
|
||||
// retrievers itself, and a Chromium browser builds the rest of its Locator from its own config.
|
||||
func newCredentialInjector(_ DiscoverOptions) browserInjector {
|
||||
|
||||
+7
-127
@@ -3,134 +3,10 @@
|
||||
package browser
|
||||
|
||||
import (
|
||||
ibrowser "github.com/moond4rk/hackbrowserdata/internal/browser"
|
||||
"github.com/moond4rk/hackbrowserdata/internal/masterkey"
|
||||
"github.com/moond4rk/hackbrowserdata/types"
|
||||
)
|
||||
|
||||
func platformBrowsers() []types.BrowserConfig {
|
||||
return []types.BrowserConfig{
|
||||
{
|
||||
Key: "chrome",
|
||||
Name: chromeName,
|
||||
Kind: types.Chromium,
|
||||
WindowsABE: true,
|
||||
UserDataDir: homeDir + "/AppData/Local/Google/Chrome/User Data",
|
||||
},
|
||||
{
|
||||
Key: "edge",
|
||||
Name: edgeName,
|
||||
Kind: types.Chromium,
|
||||
WindowsABE: true,
|
||||
UserDataDir: homeDir + "/AppData/Local/Microsoft/Edge/User Data",
|
||||
},
|
||||
{
|
||||
Key: "chromium",
|
||||
Name: chromiumName,
|
||||
Kind: types.Chromium,
|
||||
UserDataDir: homeDir + "/AppData/Local/Chromium/User Data",
|
||||
},
|
||||
{
|
||||
Key: "chrome-beta",
|
||||
Name: chromeBetaName,
|
||||
Kind: types.Chromium,
|
||||
WindowsABE: true,
|
||||
UserDataDir: homeDir + "/AppData/Local/Google/Chrome Beta/User Data",
|
||||
},
|
||||
{
|
||||
Key: "opera",
|
||||
Name: operaName,
|
||||
Kind: types.ChromiumOpera,
|
||||
UserDataDir: homeDir + "/AppData/Roaming/Opera Software/Opera Stable",
|
||||
},
|
||||
{
|
||||
Key: "opera-gx",
|
||||
Name: operaGXName,
|
||||
Kind: types.ChromiumOpera,
|
||||
UserDataDir: homeDir + "/AppData/Roaming/Opera Software/Opera GX Stable",
|
||||
},
|
||||
{
|
||||
Key: "vought",
|
||||
Name: voughtName,
|
||||
Kind: types.ChromiumOpera,
|
||||
UserDataDir: homeDir + "/AppData/Roaming/Browser from Vought",
|
||||
},
|
||||
{
|
||||
Key: "vivaldi",
|
||||
Name: vivaldiName,
|
||||
Kind: types.Chromium,
|
||||
UserDataDir: homeDir + "/AppData/Local/Vivaldi/User Data",
|
||||
},
|
||||
{
|
||||
Key: "coccoc",
|
||||
Name: coccocName,
|
||||
Kind: types.Chromium,
|
||||
WindowsABE: true,
|
||||
UserDataDir: homeDir + "/AppData/Local/CocCoc/Browser/User Data",
|
||||
},
|
||||
{
|
||||
Key: "brave",
|
||||
Name: braveName,
|
||||
Kind: types.Chromium,
|
||||
WindowsABE: true,
|
||||
UserDataDir: homeDir + "/AppData/Local/BraveSoftware/Brave-Browser/User Data",
|
||||
},
|
||||
{
|
||||
Key: "yandex",
|
||||
Name: yandexName,
|
||||
Kind: types.ChromiumYandex,
|
||||
UserDataDir: homeDir + "/AppData/Local/Yandex/YandexBrowser/User Data",
|
||||
},
|
||||
{
|
||||
Key: "360x",
|
||||
Name: speed360XName,
|
||||
Kind: types.Chromium,
|
||||
UserDataDir: homeDir + "/AppData/Local/360ChromeX/Chrome/User Data",
|
||||
},
|
||||
{
|
||||
Key: "360",
|
||||
Name: speed360Name,
|
||||
Kind: types.Chromium,
|
||||
UserDataDir: homeDir + "/AppData/Local/360chrome/Chrome/User Data",
|
||||
},
|
||||
{
|
||||
Key: "qq",
|
||||
Name: qqName,
|
||||
Kind: types.Chromium,
|
||||
UserDataDir: homeDir + "/AppData/Local/Tencent/QQBrowser/User Data",
|
||||
},
|
||||
{
|
||||
Key: "dc",
|
||||
Name: dcName,
|
||||
Kind: types.Chromium,
|
||||
UserDataDir: homeDir + "/AppData/Local/DCBrowser/User Data",
|
||||
},
|
||||
{
|
||||
Key: "sogou",
|
||||
Name: sogouName,
|
||||
Kind: types.Chromium,
|
||||
UserDataDir: homeDir + "/AppData/Local/Sogou/SogouExplorer/User Data",
|
||||
},
|
||||
{
|
||||
Key: "arc",
|
||||
Name: arcName,
|
||||
Kind: types.Chromium,
|
||||
UserDataDir: homeDir + "/AppData/Local/Packages/TheBrowserCompany.Arc_*/LocalCache/Local/Arc/User Data",
|
||||
},
|
||||
{
|
||||
Key: "duckduckgo",
|
||||
Name: duckduckgoName,
|
||||
Kind: types.Chromium,
|
||||
UserDataDir: homeDir + "/AppData/Local/Packages/DuckDuckGo.DesktopBrowser_*/LocalState/EBWebView",
|
||||
},
|
||||
{
|
||||
Key: "firefox",
|
||||
Name: firefoxName,
|
||||
Kind: types.Firefox,
|
||||
UserDataDir: homeDir + "/AppData/Roaming/Mozilla/Firefox/Profiles",
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
// newCredentialInjector hands each ABE browser its executable and dialect; RetrieveAll runs v10 (DPAPI) and,
|
||||
// when the Locator carries an ABE kind, v20 (reflective injection) — both, since an upgraded profile mixes them.
|
||||
func newCredentialInjector(_ DiscoverOptions) browserInjector {
|
||||
@@ -139,8 +15,12 @@ func newCredentialInjector(_ DiscoverOptions) browserInjector {
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
if target, ok := abeTargets[km.BrowserKey()]; ok {
|
||||
km.SetLocator(masterkey.Locator{Exe: target.exe, ExeFallbacks: target.fallbacks, ABE: target.kind})
|
||||
def, ok := ibrowser.Lookup(km.BrowserKey())
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
if p := def.Platform(); p.ABE != masterkey.ABENone {
|
||||
km.SetLocator(masterkey.Locator{Exe: p.Exe, ExeFallbacks: p.ExeFallbacks, ABE: p.ABE})
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,38 +5,10 @@ package browser
|
||||
import (
|
||||
"testing"
|
||||
|
||||
ibrowser "github.com/moond4rk/hackbrowserdata/internal/browser"
|
||||
"github.com/moond4rk/hackbrowserdata/internal/masterkey"
|
||||
)
|
||||
|
||||
// TestABETargetsCoverABEBrowsers verifies that the browsers with WindowsABE: true in platformBrowsers()
|
||||
// are exactly the keys in abeTargets. A mismatch means adding a Chromium fork was incomplete: either a
|
||||
// BrowserConfig row is missing WindowsABE: true, or abeTargets has a stale or missing entry.
|
||||
func TestABETargetsCoverABEBrowsers(t *testing.T) {
|
||||
abeConfigs := make(map[string]struct{})
|
||||
for _, b := range platformBrowsers() {
|
||||
if b.WindowsABE {
|
||||
abeConfigs[b.Key] = struct{}{}
|
||||
}
|
||||
}
|
||||
|
||||
for key, target := range abeTargets {
|
||||
if target.exe == "" {
|
||||
t.Errorf("abeTargets[%q] has no executable name", key)
|
||||
}
|
||||
if target.kind == masterkey.ABENone {
|
||||
t.Errorf("abeTargets[%q] declares no ABE kind", key)
|
||||
}
|
||||
if _, ok := abeConfigs[key]; !ok {
|
||||
t.Errorf("abeTargets[%q] has an entry but no BrowserConfig with Key %q sets WindowsABE: true", key, key)
|
||||
}
|
||||
}
|
||||
for key := range abeConfigs {
|
||||
if _, ok := abeTargets[key]; !ok {
|
||||
t.Errorf("BrowserConfig with Key %q sets WindowsABE: true but abeTargets[%q] is missing", key, key)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
type locatorRecorder struct {
|
||||
mockChromiumBrowser
|
||||
got *masterkey.Locator
|
||||
@@ -53,9 +25,13 @@ func TestCredentialInjector_HandsABEBrowsersTheirTarget(t *testing.T) {
|
||||
if chrome.got == nil {
|
||||
t.Fatal("chrome got no Locator")
|
||||
}
|
||||
want := abeTargets["chrome"]
|
||||
if chrome.got.Exe != want.exe || chrome.got.ABE != want.kind || len(chrome.got.ExeFallbacks) != len(want.fallbacks) {
|
||||
t.Errorf("chrome Locator = %+v, want exe %q, kind %v, %d fallbacks", *chrome.got, want.exe, want.kind, len(want.fallbacks))
|
||||
def, ok := ibrowser.Lookup("chrome")
|
||||
if !ok {
|
||||
t.Fatal("chrome is not in the browser table")
|
||||
}
|
||||
want := def.Platform()
|
||||
if chrome.got.Exe != want.Exe || chrome.got.ABE != want.ABE || len(chrome.got.ExeFallbacks) != len(want.ExeFallbacks) {
|
||||
t.Errorf("chrome Locator = %+v, want exe %q, kind %v, %d fallbacks", *chrome.got, want.Exe, want.ABE, len(want.ExeFallbacks))
|
||||
}
|
||||
|
||||
opera := &locatorRecorder{mockChromiumBrowser: mockChromiumBrowser{key: "opera"}}
|
||||
|
||||
@@ -1,31 +0,0 @@
|
||||
package browser
|
||||
|
||||
import (
|
||||
"os"
|
||||
)
|
||||
|
||||
// home dir path for all platforms
|
||||
var homeDir, _ = os.UserHomeDir()
|
||||
|
||||
const (
|
||||
chromeName = "Chrome"
|
||||
chromeBetaName = "Chrome Beta"
|
||||
chromiumName = "Chromium"
|
||||
edgeName = "Microsoft Edge"
|
||||
braveName = "Brave"
|
||||
operaName = "Opera"
|
||||
operaGXName = "OperaGX"
|
||||
voughtName = "Browser from Vought"
|
||||
vivaldiName = "Vivaldi"
|
||||
coccocName = "CocCoc"
|
||||
yandexName = "Yandex"
|
||||
firefoxName = "Firefox"
|
||||
speed360Name = "360 Speed"
|
||||
speed360XName = "360 Speed X"
|
||||
qqName = "QQ"
|
||||
dcName = "DC"
|
||||
sogouName = "Sogou"
|
||||
arcName = "Arc"
|
||||
duckduckgoName = "DuckDuckGo"
|
||||
safariName = "Safari"
|
||||
)
|
||||
@@ -0,0 +1,46 @@
|
||||
package browser
|
||||
|
||||
import (
|
||||
"os"
|
||||
|
||||
ibrowser "github.com/moond4rk/hackbrowserdata/internal/browser"
|
||||
"github.com/moond4rk/hackbrowserdata/internal/masterkey"
|
||||
"github.com/moond4rk/hackbrowserdata/types"
|
||||
)
|
||||
|
||||
var homeDir, _ = os.UserHomeDir()
|
||||
|
||||
// platformBrowsers adapts this OS's rows of the browser table; joining with "/" keeps today's user data dir strings.
|
||||
func platformBrowsers() []types.BrowserConfig {
|
||||
var configs []types.BrowserConfig
|
||||
for _, d := range ibrowser.Supported() {
|
||||
p := d.Platform()
|
||||
for _, dir := range p.UserDataDirs {
|
||||
configs = append(configs, types.BrowserConfig{
|
||||
Key: d.ID,
|
||||
Name: d.Name,
|
||||
Kind: kindOf(d),
|
||||
KeychainLabel: p.KeychainLabel,
|
||||
WindowsABE: p.ABE != masterkey.ABENone,
|
||||
UserDataDir: homeDir + "/" + dir,
|
||||
})
|
||||
}
|
||||
}
|
||||
return configs
|
||||
}
|
||||
|
||||
// kindOf derives today's engine kind; Yandex and the Opera family are the forks with their own on-disk format.
|
||||
func kindOf(d ibrowser.Def) types.BrowserKind {
|
||||
switch {
|
||||
case d.Base == ibrowser.Firefox:
|
||||
return types.Firefox
|
||||
case d.Base == ibrowser.Safari:
|
||||
return types.Safari
|
||||
case d.ID == "yandex":
|
||||
return types.ChromiumYandex
|
||||
case d.ID == "opera", d.ID == "opera-gx", d.ID == "vought":
|
||||
return types.ChromiumOpera
|
||||
default:
|
||||
return types.Chromium
|
||||
}
|
||||
}
|
||||
+14
-12
@@ -19,6 +19,8 @@ const (
|
||||
testProfile1 = "Profile 1"
|
||||
testUDD = "/p"
|
||||
testEdgeName = "Edge"
|
||||
testChromeName = "Chrome"
|
||||
testFirefoxName = "Firefox"
|
||||
)
|
||||
|
||||
// mockBrowser is one installation holding zero or more profile names.
|
||||
@@ -89,7 +91,7 @@ func TestBuildDump_Empty(t *testing.T) {
|
||||
|
||||
func TestBuildDump_SingleChromium(t *testing.T) {
|
||||
b := &mockChromiumBrowser{
|
||||
mockBrowser: mockBrowser{name: chromeName, userDataDir: testUDD, profiles: []string{testProfileDefault}},
|
||||
mockBrowser: mockBrowser{name: testChromeName, userDataDir: testUDD, profiles: []string{testProfileDefault}},
|
||||
keys: masterkey.Set{masterkey.V10: []byte("v10-key")},
|
||||
}
|
||||
|
||||
@@ -99,7 +101,7 @@ func TestBuildDump_SingleChromium(t *testing.T) {
|
||||
t.Fatalf("Vaults len = %d, want 1", len(dump.Vaults))
|
||||
}
|
||||
inst := dump.Vaults[0]
|
||||
if !strings.EqualFold(inst.Browser, chromeName) || inst.UserDataDir != testUDD {
|
||||
if !strings.EqualFold(inst.Browser, testChromeName) || inst.UserDataDir != testUDD {
|
||||
t.Errorf("inst metadata = %+v", inst)
|
||||
}
|
||||
if inst.Kind != "chromium" {
|
||||
@@ -118,7 +120,7 @@ func TestBuildDump_SingleChromium(t *testing.T) {
|
||||
// key exactly once.
|
||||
func TestBuildDump_MultipleProfilesOneVault(t *testing.T) {
|
||||
b := &mockChromiumBrowser{
|
||||
mockBrowser: mockBrowser{name: chromeName, userDataDir: testUDD, profiles: []string{testProfileDefault, testProfile1}},
|
||||
mockBrowser: mockBrowser{name: testChromeName, userDataDir: testUDD, profiles: []string{testProfileDefault, testProfile1}},
|
||||
keys: masterkey.Set{masterkey.V10: []byte("v10")},
|
||||
}
|
||||
|
||||
@@ -137,24 +139,24 @@ func TestBuildDump_MultipleProfilesOneVault(t *testing.T) {
|
||||
|
||||
func TestBuildDump_SkipsNonKeyManager(t *testing.T) {
|
||||
chrome := &mockChromiumBrowser{
|
||||
mockBrowser: mockBrowser{name: chromeName, userDataDir: "/chrome", profiles: []string{testProfileDefault}},
|
||||
mockBrowser: mockBrowser{name: testChromeName, userDataDir: "/chrome", profiles: []string{testProfileDefault}},
|
||||
keys: masterkey.Set{masterkey.V10: []byte("v10")},
|
||||
}
|
||||
firefox := &mockBrowser{name: firefoxName, userDataDir: "/ff", profiles: []string{"default-release"}}
|
||||
firefox := &mockBrowser{name: testFirefoxName, userDataDir: "/ff", profiles: []string{"default-release"}}
|
||||
|
||||
dump := BuildDump([]Browser{chrome, firefox})
|
||||
|
||||
if len(dump.Vaults) != 1 {
|
||||
t.Fatalf("Vaults len = %d, want 1 (firefox skipped)", len(dump.Vaults))
|
||||
}
|
||||
if !strings.EqualFold(dump.Vaults[0].Browser, chromeName) {
|
||||
t.Errorf("Browser = %q, want %q", dump.Vaults[0].Browser, strings.ToLower(chromeName))
|
||||
if !strings.EqualFold(dump.Vaults[0].Browser, testChromeName) {
|
||||
t.Errorf("Browser = %q, want %q", dump.Vaults[0].Browser, strings.ToLower(testChromeName))
|
||||
}
|
||||
}
|
||||
|
||||
func TestBuildDump_SkipsExportError(t *testing.T) {
|
||||
good := &mockChromiumBrowser{
|
||||
mockBrowser: mockBrowser{name: chromeName, userDataDir: "/chrome", profiles: []string{testProfileDefault}},
|
||||
mockBrowser: mockBrowser{name: testChromeName, userDataDir: "/chrome", profiles: []string{testProfileDefault}},
|
||||
keys: masterkey.Set{masterkey.V10: []byte("v10")},
|
||||
}
|
||||
failing := &mockChromiumBrowser{
|
||||
@@ -167,14 +169,14 @@ func TestBuildDump_SkipsExportError(t *testing.T) {
|
||||
if len(dump.Vaults) != 1 {
|
||||
t.Fatalf("Vaults len = %d, want 1 (failing browser skipped)", len(dump.Vaults))
|
||||
}
|
||||
if !strings.EqualFold(dump.Vaults[0].Browser, chromeName) {
|
||||
t.Errorf("Browser = %q, want %q", dump.Vaults[0].Browser, strings.ToLower(chromeName))
|
||||
if !strings.EqualFold(dump.Vaults[0].Browser, testChromeName) {
|
||||
t.Errorf("Browser = %q, want %q", dump.Vaults[0].Browser, strings.ToLower(testChromeName))
|
||||
}
|
||||
}
|
||||
|
||||
func TestBuildDump_JSONRoundTrip(t *testing.T) {
|
||||
b := &mockChromiumBrowser{
|
||||
mockBrowser: mockBrowser{name: chromeName, userDataDir: testUDD, profiles: []string{testProfileDefault}},
|
||||
mockBrowser: mockBrowser{name: testChromeName, userDataDir: testUDD, profiles: []string{testProfileDefault}},
|
||||
keys: masterkey.Set{masterkey.V10: []byte{0x01, 0x02, 0x03}, masterkey.V20: []byte{0xff, 0xee}},
|
||||
}
|
||||
|
||||
@@ -212,7 +214,7 @@ func TestBuildDump_JSONRoundTrip(t *testing.T) {
|
||||
|
||||
func TestBuildDump_PartialKeys(t *testing.T) {
|
||||
b := &mockChromiumBrowser{
|
||||
mockBrowser: mockBrowser{name: chromeName, userDataDir: testUDD, profiles: []string{testProfileDefault}},
|
||||
mockBrowser: mockBrowser{name: testChromeName, userDataDir: testUDD, profiles: []string{testProfileDefault}},
|
||||
keys: masterkey.Set{masterkey.V10: []byte("v10")},
|
||||
exportErr: errors.New("v20: ABE failed"),
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user