I went to check if Flatpak would protect against this but it seems although it's a wanted feature it's not so straightforward to implement: https://github.com/flatpak/flatpak/issues/4311
firejail has a setting to protect against it.
firejail has a setting to protect against it.