Where are the "privacy settings"? (Firefox extension native messaging)

Whenever a Firefox extension connects to a particular native application for the first time (var port = browser.runtime.connectNative('application_name');), a dialog opens that looks like this:

If I click “OK”, native messaging works as expected, and my decision is remembered as expected; however, I cannot find the “privacy settings” from where I am supposed to be able to change this decision. Where are they? The only way I know to get the prompt again is to change the name of the native application.

You can find an example for native messaging here, altough it is a bit of a hassle to set up, especially if you’ve never worked with extensions before.
(In addition to the given instructions, you need to make sure that “python” exists on your $PATH, e.g., apt install python-is-python3.)

As a side question, what does Firefox do to even cause this prompt? Certainly not fork/exec…

I am using Kubuntu 22.04.

This is odd, the only mention of this dialog is in this (as of writing) unmerged PR on GitHub: webextensions: add a portal for managing WebExtensions native messaging servers by jhenstridge · Pull Request #705 · flatpak/xdg-desktop-portal · GitHub. What distribution are you using that’s shipping this? :slightly_frowning_face:

As for the actual question, “Privacy Settings” is a GNOME-ism that bleeds through xdg-desktop-portal. It’s not really appliacable to KDE, although we do have our own Flatpak permissions settings now.

The distribution is Kubuntu 22.04. It ships Firefox via Snap by default. You can use e.g. this download and see for yourself in Virtualbox (I tested it).

As I understand the PR you linked, native messaging should currently not be implemented at all for Firefox via Flatpak and Snap? Because it does work…

Is it the same for Snap? How do I access them? (I already tried brute-force grep searches for the program names to find the corresponding files, but no luck, so I have to assume that they are encoded somehow.)

Nothing exists for snap settings in KDE as far as I know :frowning:

I tried this on openSUSE to figure out whether this is Kubuntu-specific (it works, no dialog), but then I realized that it doesn’t install Firefox through snap by default. Do you know of any other OS that does?

Assuming that it is Kubuntu-specific, who is responsible for building Kubuntu? How would I contact them?

I have written a shell script for quickly creating extensions to facilitate testing; I’m posting it here in case it might be of use to someone:

set -ueo pipefail
[ $# -ne 1 ] || ! [[ "$1" =~ ^[a-z_]+$ ]] && exit 1
printf $'%s\n' '{"manifest_version": 3, "name": "'"$1"' Test Extension", "version": "0.1", "description": "'"$1"' Test Extension description", "background": {"scripts": ["background.js"], "type": "classic"}, "browser_specific_settings": {"gecko": {"id": "'"$1"'_test_extension@example.org"}}, "permissions": ["nativeMessaging"]}' > "$EXTENSION_DIR"/manifest.json
printf $'%s\n' "var port = null; function go(){port = browser.runtime.connectNative('$1_test_native_application'); port.onMessage.addListener((msg) => {console.log('got message:', msg);}); port.onDisconnect.addListener((p) => {if(p.error){console.error('disconnected due to error: ' + p.error.message);} else{console.log('native application disconnected itself');}}); port.postMessage('test');}" > "$EXTENSION_DIR"/background.js
printf $'#!/bin/bash\ncat -\n' > "$NATIVE_DIR"/echo_bytes.sh
chmod +x "$NATIVE_DIR"/echo_bytes.sh
printf $'%s\n' '{"name": "'"$1"'_test_native_application", "description": "Description for '"$1"'_test_native_application", "path": "'"$NATIVE_DIR"/echo_bytes.sh'", "type": "stdio", "allowed_extensions": ["'"$1"'_test_extension@example.org"]}' > "$NATIVE_MANIFEST_DIR"/"$1"_test_native_application.json
echo 'go(); // expected output: "got message: test"'

It takes exactly one argument, a name for the extension to use, which must match ^[a-z_]+$. (More precisely, the extension-application-pair will be named $1_test_extension and $1_test_native_application. Creating multiple native applications with different names is useful since the dialog appears only once for each. Note that the script produces output on success, but not on failure.) It places the extensions it creates in test_extensions and their native applications in test_native_applications in the user’s home directory. After running the script, navigate Firefox to about:debugging, click “This Firefox” on the left, then “Load Temporary Add-on…”. In the dialog that opens, select manifest.json in ~/test_extensions/yourname_test_extension. Click “Inspect” and switch to the “Console” tab in the window that opens. Use it to run go();. At this point, the dialog shown in the first post should open if this is the first time (though it does not force itself to the foreground for me). If you choose “OK”, got message: test should appear in the console, which indicates that the test was successful.

Ubuntus are the only ones that do this I’m pretty sure. Canonical are really the only one investing in Snaps, since it’s their product. Maybe KDE Neon?

I believe that though Snaps are an Ubuntu/Canonical service, the Firefox Snap is built by Mozilla themselves. Since it is a containerized “universal” package, the distro itself is sort of irrelevant, much like flatpaks.

Snap have an active forum that might be better able to answer this sort of question since it probably is not be a KDE specific issue.

1 Like