After what happened to Jericho and Ai, all the other leaders of neighboring areas were now concerned about Joshua and the Israelites. They all decided to band together to fight them in common cause. However, the folks at Gibeon were too afraid to fight them. So they sent ambassadors there who pretended to be from a land far, far away. They even took moldy bread with them to prove how far they had come. They offered up their services and Joshua accepted them. But then they found out they were actually from Gibeon. The masses wanted to kill them, but Joshua and his princes had already promised not to kill them. Long story short, they were allowed to become servants to the people of Israel.
To put it another way:
Neighboring kingdoms were afraid, one group made peace with Joshua by lying to him. He forgave them.
Joshua 9:5 “And old shoes and clouted upon their feet, and old garments upon them; and all the bread of their provision was dry and mouldy.” Gibeonites: See, we can’t be from around these parts, our bread is moldy. Joshua: Well gosh – you must be telling the truth.
Lying to a homicidal dictator can save your life. It is therefore not only permissible, it is advisable under these circumstances.