Skip to content

fix: restrict D-Bus setCurrentReference to navigation references only#1331

Merged
karlkleinpaste merged 1 commit into
crosswire:masterfrom
hyder365:pr-0005-fix-dbus-access
Jun 19, 2026
Merged

fix: restrict D-Bus setCurrentReference to navigation references only#1331
karlkleinpaste merged 1 commit into
crosswire:masterfrom
hyder365:pr-0005-fix-dbus-access

Conversation

@hyder365

Copy link
Copy Markdown
Contributor

The org.xiphos.remote D-Bus service is registered on the session bus
with G_BUS_NAME_OWNER_FLAGS_NONE, so any peer on the user's session
bus can call setCurrentReference(). The handler passed the untrusted
reference straight to main_url_handler() with clicked=TRUE, which not
only navigates but also honours actions that reach the local
filesystem or spawn external programs:

  • "showStudypad" loads an arbitrary file into the StudyPad editor;
  • "showImage" hands a path to an external viewer (xdg-open, etc.);
  • any URL matching none of the known schemes falls through to
    xiphos_open_default(), opening an arbitrary URI/file.

A D-Bus policy file cannot meaningfully fix this: the session bus is
per-user, so all peers share the caller's UID and a default-deny
policy would simply disable the remote-control feature for everyone.
Instead, validate the reference at the IPC boundary and accept only
navigation references (sword://, bible://, passagestudy.jsp,
xiphos.url) while rejecting the local-file actions and the
open-anything fall-through. clicked=TRUE is preserved so legitimate
navigation still works.

The org.xiphos.remote D-Bus service is registered on the session bus with
G_BUS_NAME_OWNER_FLAGS_NONE, so any peer on the user's session bus can call
setCurrentReference().  The handler passed the untrusted reference straight
to main_url_handler() with clicked=TRUE, which not only navigates but also
honours actions that reach the local filesystem or spawn external programs:

  - "showStudypad" loads an arbitrary file into the StudyPad editor;
  - "showImage" hands a path to an external viewer (xdg-open, etc.);
  - any URL matching none of the known schemes falls through to
    xiphos_open_default(), which opens an arbitrary URI/file in its default
    handler.

A D-Bus policy file cannot meaningfully fix this: the session bus is
per-user, so all peers share the caller's UID and a default-deny policy
would simply disable the remote-control feature for everyone.  Instead,
validate the reference at the IPC boundary and accept only navigation
references (sword://, bible://, passagestudy.jsp, xiphos.url) while
rejecting the local-file actions and the open-anything fall-through.
clicked=TRUE is preserved so legitimate navigation still works.

This supersedes the earlier, non-functional approach of shipping an
org.xiphos.remote.conf whose "mandatory" allow rule overrode its "default"
deny (and which was never installed by the build).
@karlkleinpaste karlkleinpaste merged commit fd0375c into crosswire:master Jun 19, 2026
7 checks passed
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.

2 participants