Skip to content

daemon: Treat Debian's Firefox ESR as a privileged client - #271

Open
kpanuragh wants to merge 1 commit into
linux-credentials:mainfrom
kpanuragh:firefox-app-ids
Open

kpanuragh wants to merge 1 commit into
linux-credentials:mainfrom
kpanuragh:firefox-app-ids

Conversation

@kpanuragh

Copy link
Copy Markdown
Contributor

Debian ships Firefox as Firefox ESR, with the desktop file firefox-esr.desktop. The web extension's helper registers with the portal under the stem of GIO_LAUNCHED_DESKTOP_FILE, so on Debian requests arrive with the app ID firefox-esr. That isn't in the daemon's list of privileged clients. So Firefox ESR requests are handled as unprivileged and can't pass a top origin for cross-origin iframes. And once the per-app origin check for unprivileged clients is implemented, they would be refused.

This adds firefox-esr to the list, with tests for it and for an unknown app ID.

Testing

On a Debian sid VM with GNOME 51, Firefox ESR 153 started from the app grid, the patched xdg-desktop-portal (1.22.1 + Credential commits), the credentialsd packages from #268, and a virtual FIDO2 key over USB/IP. I registered on webauthn.io with the extension:

Daemon Daemon log Result
main app_id: AppId("firefox-esr"), request_kind: Unprivileged(Https { host: "webauthn.io", .. }) succeeds, but same-origin only
this PR app_id: AppId("firefox-esr"), request_kind: Privileged { origin: Https { host: "webauthn.io", .. }, .. } succeeds

The portal log showed Adding registered host app 'firefox-esr', and the helper log showed Registering with the portal as firefox-esr.

Firefox snap (Ubuntu): not changed here

I also looked at the Firefox snap on Ubuntu 26.04, since the goal is Ubuntu 27.04. I didn't add anything for it, because I couldn't test it end to end:

  • For a snap, the portal's own app ID is snap.firefox (from snap routine portal-info). But the helper registers the stem of GIO_LAUNCHED_DESKTOP_FILE, and the snap's desktop file is firefox_firefox.desktop. So the app ID that reaches the daemon is probably firefox_firefox.
  • The snap runs native messaging hosts through Ubuntu's WebExtensions portal, which is an Ubuntu patch. The patched Credential portal would need to be built together with it, or native messaging won't work at all.
  • The UI looks up <app id>.desktop for the requesting app's name, and cancels the request when it isn't found. That's fine for firefox_firefox, but not for snap.firefox.

How would you like snap Firefox handled? I can test it once there's a portal build for Ubuntu that has both patches.

Debian's Firefox is Firefox ESR, installed as firefox-esr.desktop. The
web extension's helper registers with the portal under the name of the
desktop file the browser was launched from, so requests from it arrive
with the app ID firefox-esr. That isn't in the list of privileged
clients, so its requests were handled as unprivileged and couldn't
carry a top origin for cross-origin iframes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant