In the book of Job:

“In the Old Testament, Satan has no latitude to operate outside of what God gives him permission to do. Think of him more like a prosecuting attorney, beholden to God’s judiciary authority. He actually works alongside God instead of against God.”
https://goodmenproject.com/in-good-faith/hell-and-the-love-of-god-pt-2-of-2-exploring-sheol-hades-tartarus-and-gehenna/