Job 1:12 (ESV)

12 And the LORD said to Satan, “Behold, all that he has is in your hand. Only against him do not stretch out your hand.” So Satan went out from the presence of the LORD.

God allows Satan to test Job. God is sovereign over his creatures and can do with them as he pleases. But there is also a great comfort here: God limits the power of Satan. Satan can only go as far as God allows.