mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2026-11-26 11:56:46 -08:00
Snap: Improve Web-browser Native Messaging host functionality (#10906)
* Snap: Improve Web-browser Native Messaging host functionality This commit allows for the snap distribution of KeepassXC to self-manage native messaging manifests This is done by making the binary aware of the snapd environment changes that currently prevent this. Furthermore, the snap sandbox is expanded to the bare minimum needed to access these privileged files. Please note if running a self-compiled / untrusted KeepassXC snap build (I.E, installed with --dangerous) that you must manually run `sudo snap connect keepassxc:browser-native-messaging` to grant permissions. This will work on all distributions that expose `/snap/bin/` - such as Ubuntu, Debian, etc. For systems which don't provide `/snap/`, such as Fedora, follow instructions for enabling "Classic" snaps. e.g., `sudo ln -s /var/lib/snapd/snap /snap` --------- Co-authored-by: Jonathan White <[email protected]>
This commit is contained in:
1 parent
9972b5f531
commit
5f2ee86d72
4 files changed
+31
-30
No files matched your search
@@ -226,6 +226,16 @@ QString NativeMessageInstaller::getNativeMessagePath(SupportedBrowsers browser)
|
||||
} else {
|
||||
basePath = QDir::homePath() + "/.config";
|
||||
}
|
||||
#elif defined(KEEPASSXC_DIST_SNAP)
|
||||
// Same as Flatpak above, with the exception that Snap also redefines $HOME
|
||||
// Therefore we must explicitly reference $SNAP_REAL_HOME
|
||||
if (browser == SupportedBrowsers::TOR_BROWSER) {
|
||||
basePath = qEnvironmentVariable("SNAP_REAL_HOME") + "/.local/share";
|
||||
} else if (browser == SupportedBrowsers::FIREFOX) {
|
||||
basePath = qEnvironmentVariable("SNAP_REAL_HOME");
|
||||
} else {
|
||||
basePath = qEnvironmentVariable("SNAP_REAL_HOME") + "/.config";
|
||||
}
|
||||
#elif defined(Q_OS_LINUX) || (defined(Q_OS_UNIX) && !defined(Q_OS_MACOS))
|
||||
if (browser == SupportedBrowsers::TOR_BROWSER) {
|
||||
basePath = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation);
|
||||
@@ -296,6 +306,8 @@ QString NativeMessageInstaller::getInstalledProxyPath() const
|
||||
path = QProcessEnvironment::systemEnvironment().value("APPIMAGE");
|
||||
#elif defined(KEEPASSXC_DIST_FLATPAK)
|
||||
path = constructFlatpakPath();
|
||||
#elif defined(KEEPASSXC_DIST_SNAP)
|
||||
path = "/snap/bin/keepassxc.proxy";
|
||||
#else
|
||||
path = QCoreApplication::applicationDirPath() + QStringLiteral("/keepassxc-proxy");
|
||||
#ifdef Q_OS_WIN
|
||||
|
||||
Reference in new issue
Block a user