palant / pfp

A simple and secure browser extension to be used with KeePass databases.
https://pfp.works/
Mozilla Public License 2.0
113 stars 14 forks source link

Native host offers unsupported browsers on initial setup #141

Open charliemb2 opened 8 months ago

charliemb2 commented 8 months ago

Firstly, thanks for providing PfP. I've been following PfP and your writings since 2018. Much appreciated.

I created this failure due to my own desire to only configure PfP once and not mess with it ever again. While not technically a bug, I offer the following as you may be interested in cleaning up this code and it may help others to know not to attempt to configure presently-unsupported browsers.

Potential code clean-up

Knowing that Chrome, Firefox, and Opera browsers are supported at present, I ran the host application (and from a non-Downloads directory). When presented with browsers to configure, after Firefox, I then was offered Edge and knowing that Edge is Chromium based I went ahead an configured Edge. Doing so, and while everything looked okay, I then hit Esc. The host and its terminal exited on its own. Powershell remained open as expected.

This resulted in an error when I tried PfP from Firefox. (I was able to repair the installation by deleting the json files and starting over, and only configuring Firefox.).

Investigating the failure, I then looked at the json files and saw the problem. Namely, pfp-native-host.json didn't include the ... "allowed_extensions"... key:value pair. Instead the pertinent leading text included only this (redacted information is represented by {redacted...}): "allowed_origins": [ "chrome-extension://{redacted}/" ],...

And it was missing this entire leading text : "allowed_extensions": [ "pfp@pfp.works" ], ... which only showed up after the repair / reconfiguration.

Background (in case it matters)

OS: Windows 10 Mozilla Firefox version: 118.0.2 (64-bit) Order of installation: I installed the Firefox extension before I installed the native host app. Other 1: I hadn't yet attempted to install the Edge extension (which I later saw that it wasn't available in the Edge store). Other 2: I instantiated Powershell from a non-standard directory, and executed the host app like this: Start-Process -FilePath "C:\{redacted_path_to_host}\pfp-native-host.exe"

dudeshino commented 7 months ago

I am having the same issue as well. My pfp-native-host.exe says Currently configured browsers: Mozilla Firefox, Google Chrome, Chromium, Opera, Vivaldi. But it only works on the last browser that was set using the EXE. It works for both Firefox and Vivaldi given that I configure the hosting first. But I can't get it to do both at the same time. Is this Intended?

Specs: Edition: Windows 10 Pro Version: 22H2 OS build: 19045.3693 Experience: Windows Feature Experience Pack 1000.19053.1000.0 PFP version: 3.1.0 (From Firefox Store and Vivaldi's Chrome Store Version) Native Host Version: 1.2

charliemb2 commented 7 months ago

I am having the same issue as well. My pfp-native-host.exe says Currently configured browsers: Mozilla Firefox, Google Chrome, Chromium, Opera, Vivaldi. But it only works on the last browser that was set using the EXE. It works for both Firefox and Vivaldi given that I configure the hosting first. But I can't get it to do both at the same time. Is this Intended?

I was able to reproduce this in Windows 10 Pro and Firefox (120) / Edge [latest 119.0.2151.72 (Official build) (64-bit)]. Only the last one configured works.

After getting Firefox to work again, since it is my main browser, attempting to use it on Edge with the Chrome extension installed, I get the following error message.

The operation failed unexpectedly.
TypeError: Cannot read properties of null (reading 'postMessage')
TypeError: Cannot read properties of null (reading 'postMessage')
    at nativeRequest (chrome-extension://dkmnfejkonkiccilfpackimaflcijhbj/ui/shared.js:1216:8)
    at async Promise.all (index 0)
    at async Proxy.created (chrome-extension://dkmnfejkonkiccilfpackimaflcijhbj/ui/panel/main.js:4596:47)

In Linux, both Firefox and Vivaldi work without first having to configure each.