I'm using Debian/trixie (current stable) and heavily containerised projects / applications via LXC/incus into unprivileged containers; each having their own isolated UID/GID range.
Most of the containers run (wayland-)GUI applications, so I'm passing the host's wayland socket into most of them.
ADDED: I'm running sway as compositor on the (non-containerised) host wayland is also running on.
What I'm now confused about is:
I can easily screenshot all screen(s) from within any unprivileged container, e.g. using grim.
While I'm aware that the socket -- looking at it as a file with its file permissions -- is either all or nothing (read+write or not, hence the protocol is bidirectional), I was still expecting the wayland idea already enforcing some restrictions by default.
As far as I know for UNIX sockets -- and the wayland socket is one -- the other side (in this case the wayland process) can actually determine which UID/GID is opening / performing operations on it and hence restrict read requests of areas it didn't draw by itself.. but now I'm speculating and potentially making the whole issue an A/B-problem.
So: what's my misunderstanding about supposedly restrictions being in place by default and/or how to restrict access from users/groups/processes/containers to only what they themselves were drawing on wayland?