Skip to content

Restrict screenshot D-Bus access to portal - #2940

Open
Sean-StarLabs wants to merge 2 commits into
elementary:mainfrom
Sean-StarLabs:restrict-screenshot-portal
Open

Sean-StarLabs wants to merge 2 commits into
elementary:mainfrom
Sean-StarLabs:restrict-screenshot-portal

Conversation

@Sean-StarLabs

@Sean-StarLabs Sean-StarLabs commented Sep 27, 2026 •

Copy link
Copy Markdown

Any client on the session bus can currently call org.gnome.Shell.Screenshot directly, bypassing the screenshot portal. Restrict the exported methods to the Pantheon portal backend and Screenshot app, while keeping keyboard shortcuts on private paths. Make caller checks asynchronous.

The Screenshot exception preserves its whole-screen, window and area desktop actions.

Testing

The original revision was tested in a Fedora 44 Pantheon Wayland session: unrelated direct calls returned AccessDenied, portal deny/allow worked, and the Print shortcut produced a screenshot.

org.gnome.Shell.Screenshot is currently available to any session bus
client. Check that the caller owns the Pantheon portal backend name,
while keeping keyboard shortcuts on private methods.

Test=Direct D-Bus calls returned AccessDenied; portal and keyboard
shortcut captures still produced PNGs in a Pantheon Wayland session.
@danirabbit danirabbit added this to OS 9 Sep 27, 2026
@danirabbit danirabbit moved this to Needs Review in OS 9 Sep 27, 2026
@danirabbit
danirabbit requested a review from a team September 27, 2026 19:27

@leolost2605 leolost2605 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We also need an exception for the screenshot app https://github.com/elementary/screenshot which usually uses the portal but it does directly call the gala interface for when a non interactive screenshot is taken (which I think is only possible via the desktop actions).

Also this should probably all be async just to be safe

Apart from that LGTM thanks :)

The Screenshot app uses Gala directly for its desktop actions. Allow its
current bus owner alongside the portal backend, including when the other
service is not running.

Make the proxy and name-owner lookups asynchronous, including FlashArea,
so caller checks do not block the compositor.
@Sean-StarLabs
Sean-StarLabs force-pushed the restrict-screenshot-portal branch from ea96c8c to 82e720c Compare October 1, 2026 13:57
@danirabbit
danirabbit requested a review from leolost2605 October 1, 2026 16:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Needs Review

Development

Successfully merging this pull request may close these issues.

3 participants