Any graphical application running under X Windows System (X11) can see what any user is typing in any other application for any user. [1] For example, if user user running X11 would run lxsudo -u limited-user some-application that application if compromised could sniff anything that user user is writing. Including but not limited to any sudo password prompts.
See the footnote on that page too.
Can apparmor prevent that?
Related:
AppArmor prevent access to the the API that xinput is using for global keyboard sniffing?
No, I’m not familiar with the syntax. SELinux is far more complicated than apparmor and harder to learn. I only have a basic understanding of what can be done with it.
Worth asking AppArmor upstream about this or was already discussed?
SELinux: not looking forward to research / debate NSA/SELinux. Best discussed in separate thread. Perhaps even one for technology and one for trustworthiness.