{"record":{"id":"a3bd251a22b7185b","repo":"moonD4rk/HackBrowserData","slug":"dbus-session-w","errorCode":null,"errorMessage":"dbus session: %w","messagePattern":"dbus session: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"masterkey/retriever_linux.go","lineNumber":28,"sourceCode":"\tkeyring \"github.com/ppacher/go-dbus-keyring\"\n)\n\n// https://source.chromium.org/chromium/chromium/src/+/main:components/os_crypt/os_crypt_linux.cc\nvar linuxParams = pbkdf2Params{\n\tsalt:       []byte(\"saltysalt\"),\n\titerations: 1,\n\tkeySize:    16,\n\thashFunc:   sha1.New,\n}\n\n// DBusRetriever queries GNOME Keyring / KDE Wallet via D-Bus Secret Service.\ntype DBusRetriever struct{}\n\nfunc (r *DBusRetriever) RetrieveKey(hints Hints) ([]byte, error) {\n\tstorage := hints.KeychainLabel\n\tconn, err := dbus.SessionBus()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"dbus session: %w\", err)\n\t}\n\n\tsvc, err := keyring.GetSecretService(conn)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"secret service: %w\", err)\n\t}\n\n\tsession, err := svc.OpenSession()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"open session: %w\", err)\n\t}\n\tdefer session.Close()\n\n\tcollections, err := svc.GetAllCollections()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"get collections: %w\", err)\n\t}\n","sourceCodeStart":10,"sourceCodeEnd":46,"githubUrl":"https://github.com/moonD4rk/HackBrowserData/blob/0503d04d7a8d0379d060268a74f1b149e5a0aad5/masterkey/retriever_linux.go#L10-L46","documentation":"DBusRetriever (Linux V11 tier) needs a D-Bus session bus to talk to GNOME Keyring / KDE Wallet via the Secret Service API. dbus.SessionBus() failed — typically DBUS_SESSION_BUS_ADDRESS is unset or points at a dead socket — so no keyring query can be attempted.","triggerScenarios":"Calling RetrieveKey on Linux when there is no user session bus: SSH without DBUS_SESSION_BUS_ADDRESS exported, systemd user session not running, cron/systemd service, Docker container, or a stale XDG_RUNTIME_DIR.","commonSituations":"Running the tool from an SSH session, CI job, cron job, or container that inherited no desktop session environment; switching users with su without importing the session env.","solutions":["Run inside the desktop session, or export the bus address first: export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$(id -u)/bus","Verify the socket exists: ls /run/user/$(id -u)/bus (start systemd user session if missing)","Use `sudo -u <user> env DBUS_SESSION_BUS_ADDRESS=... ` when querying another user's keyring","If no keyring exists at all, accept the V10 fallback — PosixRetriever derives the key from PBKDF2(\"peanuts\") without D-Bus"],"exampleFix":"# before\ncron: 0 * * * * hack-browser-data\n# after\ncron: 0 * * * * DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus hack-browser-data","handlingStrategy":"validation","validationCode":"if os.Getenv(\"DBUS_SESSION_BUS_ADDRESS\") == \"\" {\n    os.Setenv(\"DBUS_SESSION_BUS_ADDRESS\", \"unix:path=/run/user/\"+strconv.Itoa(os.Getuid())+\"/bus\")\n}","typeGuard":null,"tryCatchPattern":"key, err := dbusRetriever.RetrieveKey(hints)\nif err != nil {\n    if strings.HasPrefix(err.Error(), \"dbus session:\") {\n        key, err = posixRetriever.RetrieveKey(hints) // v10 fallback, no keyring needed\n    }\n}","preventionTips":["Export DBUS_SESSION_BUS_ADDRESS and XDG_RUNTIME_DIR when running over SSH/cron/systemd","Run the tool inside the desktop user session (or with machinectl/sudo -E) rather than a bare service context","Detect headless environments up front and use the v10 PosixRetriever directly","Check the bus socket exists (/run/user/<uid>/bus) before attempting keyring retrieval"],"tags":["linux","dbus","keyring","environment"],"backgroundTag":"missing-env-var","analyzedSha":"0503d04d7a8d0379d060268a74f1b149e5a0aad5","analyzedAt":"2026-09-06T13:38:28.707Z","contentChangedAt":"2026-09-06T13:38:28.707Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}