bitwarden-desktop: fix browser biometrics#374068
bitwarden-desktop: fix browser biometrics#374068nyawox wants to merge 2 commits intoNixOS:masterfrom
Conversation
|
+1 would be great if this could get merged soon. |
| mkdir -p $out/bin | ||
| cp -r apps/desktop/desktop_native/target/release/desktop_proxy $out/bin |
There was a problem hiding this comment.
| mkdir -p $out/bin | |
| cp -r apps/desktop/desktop_native/target/release/desktop_proxy $out/bin | |
| install -Dm755 -t $out/bin apps/desktop/desktop_native/target/release/desktop_proxy |
| { | ||
| "name": "com.8bit.bitwarden", | ||
| "description": "Bitwarden desktop <-> browser bridge", | ||
| "path": "@out@/bin/desktop_proxy", |
There was a problem hiding this comment.
If it is only consumed by firefox in this way, we might put it in paths like $out/libexec/bitwarden to avoid messing up with PATH.
There was a problem hiding this comment.
When you run current Bitwarden Desktop app in NixOS 24.11 and click on the option to enable browser fingerprint auth, you'll get this error log:
07:38:16.900 › Error generating manifests: Error: Unable to find binary: /nix/store/sbas438bk37a1hm2v46s9kw2i70g0ncm-bitwarden-desktop-2025.1.1/bin/desktop_proxy
07:38:16.909 › Error in browser integration: Error: Unable to find binary: /nix/store/sbas438bk37a1hm2v46s9kw2i70g0ncm-bitwarden-desktop-2025.1.1/bin/desktop_proxy
So, I'd prefer to move it to libexec as you noted. However in that case, somehow we have to tell the app that there's where it'll be. Do you know how to do it?
There was a problem hiding this comment.
You would have to patch the source code here to return the absolute path
|
Besides these, I hope someone else can test it. |
|
I can confirm the native messaging works with this PR. I was able unlock the browser extension using fingerprint. |
|
I have also tested this and fingerprint unlock is working. Instructions on how to test for those who use flake.nix: {
inputs = {
nixpkgs-bitwarden.url = "github:nixos/nixpkgs/6fd0382c80e18f0883709fb5a6bf9f40bc671a62";
...
}
}configuration.nix: system.environmentPackages = [
inputs.nixpkgs-bitwarden.legacyPackages.x86_64-linux.bitwarden-desktop
]; |
|
Is this blocked on anything, or are you just waiting for a reviewer? |
amarshall
left a comment
There was a problem hiding this comment.
Previous review comments should also be addressed. I haven’t tested this, as I don’t use this functionality.
| popd | ||
|
|
||
| pushd apps/desktop/desktop_native/proxy | ||
| cargo build --bin desktop_proxy --release |
There was a problem hiding this comment.
As far as I can tell there is only one other pkg in nixpkgs that calls cargo build directly like this. We probably at least want to take a few things from cargoBuildHook if it can’t be used. E.g. -j, --offline, and perhaps --target (though this drv is likely broken for cross-compilation, it would be nice to at least not make it worse).
|
Following dshatz's instructions, it yields the following error (on both commits). |
yajo
left a comment
There was a problem hiding this comment.
Please could you fix merge conflicts?
| { | ||
| "name": "com.8bit.bitwarden", | ||
| "description": "Bitwarden desktop <-> browser bridge", | ||
| "path": "@out@/bin/desktop_proxy", |
There was a problem hiding this comment.
When you run current Bitwarden Desktop app in NixOS 24.11 and click on the option to enable browser fingerprint auth, you'll get this error log:
07:38:16.900 › Error generating manifests: Error: Unable to find binary: /nix/store/sbas438bk37a1hm2v46s9kw2i70g0ncm-bitwarden-desktop-2025.1.1/bin/desktop_proxy
07:38:16.909 › Error in browser integration: Error: Unable to find binary: /nix/store/sbas438bk37a1hm2v46s9kw2i70g0ncm-bitwarden-desktop-2025.1.1/bin/desktop_proxy
So, I'd prefer to move it to libexec as you noted. However in that case, somehow we have to tell the app that there's where it'll be. Do you know how to do it?
| cp -r apps/desktop/desktop_native/target/release/desktop_proxy $out/bin | ||
|
|
||
| mkdir -p $out/lib/mozilla/native-messaging-hosts | ||
| substituteAll ${./firefox-native-messaging-host.json} $out/lib/mozilla/native-messaging-hosts/com.8bit.bitwarden.json |
There was a problem hiding this comment.
suggestion: Please could you also add native messaging host support for Chromium-based browsers?
| substituteAll ${./firefox-native-messaging-host.json} $out/lib/mozilla/native-messaging-hosts/com.8bit.bitwarden.json | |
| substituteAll ${./chromium-messaging-host.json} $out/etc/chromium/native-messaging-hosts/com.8bit.bitwarden.json |
The file ./chromium-messaging-host.json should be something like this:
{
"name": "com.8bit.bitwarden",
"description": "Bitwarden desktop <-> browser bridge",
"path": "@out@/bin/desktop_proxy",
"type": "stdio",
"allowed_origins": [
"chrome-extension://nngceckbapebfimnlniiiahkandclblb/",
"chrome-extension://hccnnhgbibccigepcmlgppchkpfdophk/",
"chrome-extension://jbkfoedolllekgbhcbcoahefnbanhhlh/",
"chrome-extension://ccnckbpmaceehanjmeomladnmlffdjgn/"
]
}Why do this? It would enable home-manager users to add this package to programs.brave.nativeMessagingHosts (or any other supported browser. In contrast, the equivalent files created by the bitwarden desktop app when ticking the host auth and browser integration boxes are only for a limited set of browsers.
Add
desktop_proxyto$out/binand expose
com.8bit.bitwarden.jsonto$out/lib/mozilla/native-messaging-hosts/com.8bit.bitwarden.jsonso the user can symlink to their home directory (in the same way as keepassxc)Should fix #347350
note that if you have firefox sandboxed, you must allow access to
~/.cache/com.bitwarden.desktop/app.bitwardensocketThings done
nix.conf? (See Nix manual)sandbox = relaxedsandbox = truenix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/)Add a 👍 reaction to pull requests you find important.