Skip to content

Restrict screenshot D-Bus access to portal - #2940

Merged
leolost2605 merged 2 commits into
elementary:mainfrom
Sean-StarLabs:restrict-screenshot-portal
Oct 3, 2026
Merged

leolost2605 merged 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
Contributor

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.

@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 :)

@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

@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.

LGTM

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.
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.
@leolost2605
leolost2605 force-pushed the restrict-screenshot-portal branch from 82e720c to 7bec605 Compare October 3, 2026 20:45
@leolost2605
leolost2605 enabled auto-merge (squash) October 3, 2026 20:45
@leolost2605
leolost2605 merged commit b2ae079 into elementary:main Oct 3, 2026
7 checks passed
@github-project-automation github-project-automation Bot moved this from Needs Review to Done in OS 9 Oct 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants