Skip to content

bitwarden-desktop: work with firefox.nativeMessagingHosts #347350

Closed

Description

@huantianad

bitwarden-desktop has a native messaging hosst so the firefox extension can communicate with desktop app for biometric authentication.

#339384 fixes the dynamically installed native messaging host file; however, I was wondering if we should actually not be installing that file in the user's home at all, and instead rely on the nativeMessagingHosts argument to the firefox wrapper.

Wanted to ask the firefox maintainers @lovesegfault @mweinelt @jopejoe1 if there's a preferred way to do this.

Activity

  1. added
    0.kind: enhancement
    on Oct 8, 2024
  2. bvngee commented on Oct 8, 2024

    @bvngee
    Contributor

    Quick note also that bitwarden-desktop supports installing native messaging host files for multiple browsers, some of which afaict don't have the equivalent nativeMessagingHosts support in nixpkgs. So it may be worth keeping support for both methods.

  3. dotlambda commented on Oct 10, 2024

    @dotlambda
    Member

    duplicate of #344073

  4. huantianad commented on Oct 10, 2024

    @huantianad
    ContributorAuthor

    @dotlambda hi, should this question not be in a separate issue? Should we switch discussion to #344073 or #339384?

  5. huantianad commented on Oct 12, 2024

    @huantianad
    ContributorAuthor

    @dotlambda sorry to bump

  6. huantianad commented on Nov 20, 2024

    @huantianad
    ContributorAuthor

    @bvngee

    Quick note also that bitwarden-desktop supports installing native messaging host files for multiple browsers, some of which afaict don't have the equivalent nativeMessagingHosts support in nixpkgs. So it may be worth keeping support for both methods.

    The problem with this though is that it doesn't support all browsers either. For example, I use librewolf, which doesn't make a ~/.mozilla folder. This means I have to trick bitwarden into thinking I have firefox and make the folder manually.

  7. bvngee commented on Nov 20, 2024

    @bvngee
    Contributor

    The problem with this though is that it doesn't support all browsers either. For example, I use librewolf, which doesn't make a ~/.mozilla folder. This means I have to trick bitwarden into thinking I have firefox and make the folder manually.

    Isn't the librewolf thing intended/known? I think either way you'd still have to ln -s at the minimum

  8. huantianad commented on Nov 20, 2024

    @huantianad
    ContributorAuthor

    On NixOS, the workaround isn't needed, since we can override the nativeMessagingHosts parameter in the derivation; at least, that is the proper way to install the native messaging host if you want it located at the equivalent of /usr/lib

    PS with my testing, I don't need the symlink. It seems that librewolf has changed it so that they look at .mozilla too.

  9. devurandom commented on Dec 15, 2024

    @devurandom
    Contributor

    Would it be possible to include the lib/mozilla/native-messaging-host/com.8bit.bitwarden.json file in the bitwarden-desktop package, so users could optionally use programs.firefox.nativeMessagingHosts.packages to install it into Firefox?

    Context: Currently I do not have a com.8bit.bitwarden.json file anywhere, not in the Nix store and not in my home directory, cf. #344073 (comment).

  10. M4RC3L05 commented on Dec 19, 2024

    @M4RC3L05

    Would it be possible to include the lib/mozilla/native-messaging-host/com.8bit.bitwarden.json file in the bitwarden-desktop package, so users could optionally use programs.firefox.nativeMessagingHosts.packages to install it into Firefox?

    Context: Currently I do not have a com.8bit.bitwarden.json file anywhere, not in the Nix store and not in my home directory, cf. #344073 (comment).

    Looking into the bitwarden-desktop logs, it seems that we also need desktop_proxy to be present in the bin outputs, currently having this error while staring bitwarden:

    17:51:27.392 › Error while generating manifests Error: Unable to find binary: /nix/store/hs40jamdw7kxvsmx9xrzb1bymgj29vcq-bitwarden-desktop-2024.12.0/bin/desktop_proxy
    

    From what it could observe this binary is what gets referenced in com.8bit.bitwarden.json
    Given this example that is generated using the app image version:

    {
      "name": "com.8bit.bitwarden",
      "description": "Bitwarden desktop <-> browser bridge",
      "path": "/tmp/.mount_bitwarNAdjO4/desktop_proxy",
      "type": "stdio",
      "allowed_extensions": [
        "{446900e4-71c2-419f-a6a7-df9c091e268b}"
      ]
    }
    

    I believe the temp dir stuff is related with app image.

  11. huantianad commented on Dec 19, 2024

    @huantianad
    ContributorAuthor

    @devurandom Have you tried making an empty folder at ~/.mozilla, then enabling the browser integration option inside of the bitwarden desktop app?

    https://github.com/bitwarden/clients/blob/69d42a73e38822d3bed53a08cdd09457b9b7a65d/apps/desktop/src/main/native-messaging.main.ts
    this is where the native messaging file is generated. not sure what the best way to include this in the derivation is, I suppose we can simply generate it and include a copy in the derivation source?

  12. M4RC3L05 commented on Dec 19, 2024

    @M4RC3L05

    Like @devurandom I to do not have any com.8bit.bitwarden.json file.
    Currently if i try to enable browser integration form bitwarden i get the following error:

    Screenshot From 2024-12-19 23-34-37

    With the following logs:

    23:33:51.871 › Error generating manifests: Error: Unable to find binary: /nix/store/hs40jamdw7kxvsmx9xrzb1bymgj29vcq-bitwarden-desktop-2024.12.0/bin/desktop_proxy
    23:33:51.872 › Error in browser integration: Error: Unable to find binary: /nix/store/hs40jamdw7kxvsmx9xrzb1bymgj29vcq-bitwarden-desktop-2024.12.0/bin/desktop_proxy
    

    And still no file is generated:

    ~ ❱ ls -la ~/.mozilla/native-messaging-hosts/
    lrwxrwxrwx - main 19 dez 20:44  .keep -> /nix/store/rnkfx7lhqksij1d2j5lk7dc0w9i2qpa4-home-manager-files/.mozilla/native-messaging-hosts/.keep
    

    On my machine i have both firefox and bitwarden being installed using home-manager on a non nixos distro, not sure if that changes something.

    Also like i pointed out in the comment above, maybe we need to also include this desktop_proxy bin that he tries to reference in the json file.

  13. nyawox commented on Jan 15, 2025

    @nyawox
    Contributor

    i've opened #374068 that adds desktop_proxy to $out/bin
    and exposes com.8bit.bitwarden.json to $out/lib/mozilla/native-messaging-hosts/com.8bit.bitwarden.json so the user can symlink to their home directory

  14. added
    2.status: stale
    on Jul 14, 2025
  15. devurandom commented on Apr 24, 2026

    @devurandom
    Contributor

    This was closed, but actually the title of this issue is not satisfied yet. pkgs.bitwarden-desktop does not appear to include a com.8bit.bitwarden.json file that could be picked up by programs.firefox.nativeMessagingHosts:

    /nix/store/m841pysp6vb7iz6w7qfm4y78z04189yb-bitwarden-desktop-2026.2.1/
    ├── bin
    │   └── bitwarden
    ├── libexec
    │   └── desktop_proxy
    ├── opt
    │   └── Bitwarden
    │       ├── locales
    │       │   ├── [*].pak
    │       ├── resources
    │       │   ├── app-update.yml
    │       │   ├── app.asar
    │       │   └── app.asar.unpacked
    │       │       └── node_modules
    │       │           └── @bitwarden
    │       │               └── desktop-napi
    │       │                   ├── desktop_napi.linux-x64-gnu.node
    │       │                   └── index.js
    │       └── resources.pak
    └── share
        ├── applications
        │   └── bitwarden.desktop
        ├── icons
        │   └── hicolor
        │       ├── [*]
        │       │   └── apps
        │       │       └── bitwarden.png
        └── polkit-1
            └── actions
                └── com.bitwarden.Bitwarden.policy
    
    31 directories, 71 files
    

    #425477 only installed the desktop_proxy executable file that would be necessary for the lib/mozilla/native-messaging-hosts/ integration to work, but does not install the JSON file necessary to use it with programs.firefox.nativeMessagingHosts.

    Should this issue be reopened?

    See-also: #371479 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    0.kind: enhancement2.status: stale

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions