This is why, despite Picard’s moral objections to having pets, he doesn’t dare broach the subject of Spot with Data.
Just look at Lore. He wiped out a colony, and could do far worse damage if he was both more competent and stable. It eventually escalated to the point where Data had to shut him down, due to the danger he posed to the rest of the Federation.
There’s the episode where he takes over the ship (hardcoded command from Dr. Soong) which really highlights how powerful he is.
I don’t see how star fleet allowed Data to remain onboard after that one. Being in the tech industry I often feel the Federation’s infosec is lacking in often trivial ways (unless the episode calls for better security of course 🙂), but maybe they have just accepted that sort of thing as the cost of doing space business since it happens all the time. So Data’s benefits out weigh his risk.
If all the TV shows are in the same universe, I wonder how they allowed Data to join at all after the debacle that was Control.