Debian repos are basically guaranteed safe: https://programming.dev/comment/22863237
Flathub is much, much safer than say, the google play store, but it ultimately does follow a model of app developers submitting packages which get reviewed and approved. In theory, someone could sneak malware past that, although there haven't been any incidents (perhaps flathub's review is very effective?). But the snap store, which follows a similar model has had malware. But canonical hasn't been the best steward of that one.
In addition to this, not all stuff on flathub is open source, which is definitely concerning.
Thankfully, flatpak has a built in sandboxing system, which lets you limit what the appps have access to. KDE has a UI for it, and there is also the GUI app flatseal.