** Description changed:
+ [ Impact ]
+
+ * Snap applications (such as Firefox when PipeWire camera support is
+ enabled) cannot access webcams through the Camera portal on Ubuntu
+ 24.04. Instead of showing the system permission prompt, the request
+ is denied and the application reports that camera access is not
+ allowed.
+
+ * This prevents confined snap browsers and other snap applications
+ from using PipeWire-mediated camera access, which is required to
+ safely grant per-application camera permissions without giving
+ snaps direct access to /dev/video* devices.
+
+ [ Test Plan ]
+
+ * On an Ubuntu 24.04 Wayland session with a webcam:
+ 1. Disconnect direct camera access from the Firefox snap if
+ connected:
+ sudo snap disconnect firefox:camera
+ 2. Reset any existing camera permission for Firefox:
+ gdbus call --session \
+ --dest org.freedesktop.impl.portal.PermissionStore \
+ --object-path /org/freedesktop/impl/portal/PermissionStore \
+ --method org.freedesktop.impl.portal.PermissionStore.DeletePermission
\
+ devices camera snap.firefox
+ (Ignore if the permission entry does not exist yet.)
+ 3. In Firefox about:config, set
+ media.webrtc.camera.allow-pipewire to true and restart Firefox.
+ 4. Open a page requesting camera access via
+ navigator.mediaDevices.getUserMedia({ video: true }).
+ 5. Confirm that before the update, no camera prompt appears and
+ journalctl --user -u xdg-desktop-portal logs
+ "Only the focused app is allowed to show a system access dialog".
+
+ * Install the updated xdg-desktop-portal package from -proposed,
+ restart the user service (systemctl --user restart xdg-desktop-portal),
+ and repeat step 4:
+ - Verify the system camera access dialog appears with the proper
+ application name ("Firefox wants to use your camera.").
+ - Grant access and verify Firefox can stream video from the camera
+ via PipeWire.
+ - Repeat the camera request in a new tab/session and verify the
+ saved permission in the permission store (snap.firefox) is
+ respected without re-prompting.
+
+ * Regression-test with a Flatpak application using camera/device access
+ (e.g. a Flatpak browser or GNOME Snapshot) to confirm the access
+ dialog, app name display, and permission storage continue to work
+ normally.
+
+ [ Where problems could occur ]
+
+ * device_query_permission_sync() is shared by the Camera and
+ Device portals (camera, microphone, speakers), so a bug in
+ resolving XdpAppInfo or GAppInfo would affect device access
+ prompts for all application types (snaps, Flatpaks, and host apps).
+
+ * For Flatpak applications, xdp_app_info_load_app_info() loads
+ <app_id>.desktop and xdp_get_app_id_from_desktop_id() strips the
+ .desktop suffix to pass to AccessDialog. While this should
+ produce the exact same app_id as before, if a Flatpak's GAppInfo
+ ID were to differ from <app_id>.desktop or fail to load, the
+ AccessDialog app_id could mismatch the focused window (causing
+ AccessDenied) or fall back to app_id without a display name in
+ the prompt.
+
+ * handle_access_device() now attaches "app-info" to the Request
+ object for the async worker thread; an incorrect reference count or
+ lifetime mismatch could cause a use-after-free or leak on Device
+ portal calls.
+
+ * If a snap's .desktop file is not present in XDG_DATA_DIRS,
+ xdp_app_info_load_app_info() returns NULL and falls back to
+ snap.<name>, leaving that snap with the pre-existing failure.
+
+ [ Other Info ]
+
+ * The root cause is that device_query_permission_sync() in
+ src/device.c passed snap.<name> (the permission-store ID) to
+ xdg-desktop-portal-gnome's AccessDialog and tried to load
+ <app_id>.desktop, whereas the backend expects the focused window's
+ desktop ID (e.g. firefox_firefox).
+
+ * In Ubuntu 26.04 (Resolute) / xdg-desktop-portal 1.21+, this issue is
+ addressed across all portals by separating app-id (desktop ID) from
+ permissions-id (snap.<name>). Backporting that full
+ permissions-id infrastructure to 1.18.4 in 24.04 is too invasive
+ for an SRU, so this upload applies a minimal, targeted fix in
+ src/device.c matching the pattern already used by background.c,
+ location.c, and wallpaper.c in 1.18.4.
+
+ ----
+
I have found that Firefox (Snap) on Ubuntu 24.04 is unable to access
cameras when PipeWire is enabled, due to policy rules that PipeWire
enforces. It seems that Snap packaging would have to change in order for
Firefox's Pipewire support to be utilised effectively. It looks like an
issue between Firefox Snap confinement, Wayland focus tracking and xdg-
desktop-portal policy enforcement. If we want to be able to move beyond
v4l2, this issue will need to be resolved somehow... not sure how
though!
john@ovo:~$ which firefox
/usr/bin/firefox
john@ovo:~$ snap list | grep -i firefox || true
firefox 146.0-2 7477
latest/stable mozilla** -
john@ovo:~$ apt-cache policy firefox | sed -n '1,20p'
firefox:
Installed: 1:1snap1-0ubuntu5
Candidate: 1:1snap1-0ubuntu5
Version table:
*** 1:1snap1-0ubuntu5 500
500 http://au.archive.ubuntu.com/ubuntu noble/main amd64 Packages
100 /var/lib/dpkg/status
john@ovo:~$
In Firefox, set media.webrtc.camera.allow-pipewire to true and open this
HTML:
<!doctype html>
<html>
<body>
<button onclick="go()">List cameras</button>
<script>
async function go() {
await navigator.mediaDevices.getUserMedia({ video: true });
const devices = await navigator.mediaDevices.enumerateDevices();
console.table(devices.filter(d => d.kind === "videoinput"));
}
</script>
</body>
</html>
This page raises an error:
Uncaught (in promise) DOMException: The request is not allowed by the user
agent or the platform in the current context. 127.0.0.1:8000:7:32
go http://127.0.0.1:8000/:7
AsyncFunctionThrow self-hosted:804
(Async: async)
onclick http://127.0.0.1:8000/:1
And this is what xdg-desktop-portal is reporting:
john@ovo:~$ journalctl --user -f -u xdg-desktop-portal
[...]
Dec 17 12:35:31 ovo xdg-desktop-por[735598]: A backend call failed:
GDBus.Error:org.freedesktop.DBus.Error.AccessDenied:
GDBus.Error:org.freedesktop.DBus.Error.AccessDenied: Only the focused app is
allowed to show a system access dialog
[...]
Meanwhile, to confirm that the camera exists in PipeWire:
john@ovo:~$ pw-cli list-objects Node | grep -A4 -i camera
node.description = "Integrated Camera (V4L2)"
node.name = "v4l2_input.pci-0000_00_14.0-usb-0_8_1.0"
node.nick = "Integrated Camera"
media.class = "Video/Source"
media.role = "Camera"
id 66, type PipeWire:Interface:Node/3
object.serial = "66"
object.path = "v4l2:/dev/video2"
factory.id = "10"
--
node.description = "Integrated Camera (V4L2)"
node.name = "v4l2_input.pci-0000_00_14.0-usb-0_8_1.2"
node.nick = "Integrated Camera"
media.class = "Video/Source"
media.role = "Camera"
id 72, type PipeWire:Interface:Node/3
object.serial = "72"
object.path = "alsa:pcm:0:hw:sofhdadsp,5:playback"
factory.id = "18"
john@ovo:~$
And also
john@ovo:~$ pw-cli list-objects Node | grep -E 'node.name|media.class'
node.name = "Dummy-Driver"
node.name = "Freewheel-Driver"
node.name = "Midi-Bridge"
media.class = "Midi/Bridge"
node.name = "v4l2_input.pci-0000_00_14.0-usb-0_8_1.0"
media.class = "Video/Source"
node.name = "v4l2_input.pci-0000_00_14.0-usb-0_8_1.2"
media.class = "Video/Source"
node.name =
"alsa_output.pci-0000_00_1f.3-platform-skl_hda_dsp_generic.HiFi__hw_sofhdadsp_5__sink"
media.class = "Audio/Sink"
node.name =
"alsa_output.pci-0000_00_1f.3-platform-skl_hda_dsp_generic.HiFi__hw_sofhdadsp_4__sink"
media.class = "Audio/Sink"
node.name =
"alsa_output.pci-0000_00_1f.3-platform-skl_hda_dsp_generic.HiFi__hw_sofhdadsp_3__sink"
media.class = "Audio/Sink"
node.name =
"alsa_output.pci-0000_00_1f.3-platform-skl_hda_dsp_generic.HiFi__hw_sofhdadsp__sink"
media.class = "Audio/Sink"
node.name =
"alsa_input.pci-0000_00_1f.3-platform-skl_hda_dsp_generic.HiFi__hw_sofhdadsp__source"
media.class = "Audio/Source"
node.name =
"alsa_input.pci-0000_00_1f.3-platform-skl_hda_dsp_generic.HiFi__hw_sofhdadsp_6__source"
media.class = "Audio/Source"
node.name = "Thunderbird"
media.class = "Stream/Input/Audio"
john@ovo:~$
I can also confirm via 'pw-top' that the camera is connecting via
PipeWire when I use the 'snapshot' program on Ubuntu 24.04:
S ID QUANT RATE WAIT BUSY W/Q B/Q ERR FORMAT NAME
S 29 0 0 --- --- --- --- 0
Dummy-Driver
S 30 0 0 --- --- --- --- 0
Freewheel-Driver
S 55 0 0 --- --- --- --- 0
Midi-Bridge
R 64 1 30 54.6us 4.0us 0.00 0.00 0 MJPG 1280x720
v4l2_input.pci-0000_00_14.0-usb-0_8_1.0
R 103 0 0 41.3us 5.6us 0.00 0.00 0 MJPG 1280x720 +
org.gnome.Snapshot
S 66 0 0 --- --- --- --- 0
v4l2_input.pci-0000_00_14.0-usb-0_8_1.2
S 72 0 0 --- --- --- --- 0
alsa_output.pci-0000_00_1f.3-platform-skl_hda_dsp_generic.HiFi__hw_sofhdadsp
S 73 0 0 --- --- --- --- 0
alsa_output.pci-0000_00_1f.3-platform-skl_hda_dsp_generic.HiFi__hw_sofhdadsp
S 74 0 0 --- --- --- --- 0
alsa_output.pci-0000_00_1f.3-platform-skl_hda_dsp_generic.HiFi__hw_sofhdadsp
S 75 0 0 --- --- --- --- 0
alsa_output.pci-0000_00_1f.3-platform-skl_hda_dsp_generic.HiFi__hw_sofhdadsp
S 76 0 0 --- --- --- --- 0
alsa_input.pci-0000_00_1f.3-platform-skl_hda_dsp_generic.HiFi__hw_sofhdadsp
S 77 0 0 --- --- --- --- 0
alsa_input.pci-0000_00_1f.3-platform-skl_hda_dsp_generic.HiFi__hw_sofhdadsp
S 98 0 0 --- --- --- --- 0
Thunderbird
--
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2136591
Title:
Pipewire cameras inaccessible due to Snap packaging
To manage notifications about this bug go to:
https://bugs.launchpad.net/firefox/+bug/2136591/+subscriptions
--
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs