One lesson that can be taken from the story of Ali Baba is that if three people know a secret, it’s going to get out to others. In the original story, Ali Baba has a brother who is doing better than he is, money-wise.
When Ali Baba takes a small bag of gold coins and asks to borrow his brother’s scale, his sister-in-law gets curious and puts some wax on the scale. She finds a coin stuck to it, and this allows Ali Baba’s brother to get in on the secret. He is later killed and quartered by the thieves for attempting to steal from them.
This is probably the most gruesome of the lessons, but it is one of the lessons someone could take from this story.