This is a very good question and I don't believe there can be one definitive answer. As it depends on the age of the child and the society that child lives in.
One thing that is true and applicable across all things with children is the following equation:
- To excessively wrap in cotton wool to protect children is damaging to a child's growth towards a well adjusted, independent adulthood.
- To not provide enough protection for our children, can require far more cotton wool to dress the emotional (or physical) wounds that they may incur from lack of caution.
We need to weigh up the benefits against potential costs for both points.
When 1 = 2, we have a healthy balance, if that makes sense.

Too much freedom, too much caution, balance is the key.
For the purposes of this answer, I will discuss our current situation with my 12 and 13 year old children (my 19 year old, I am confident can handle his interactions with strangers :-) ).
When there is a predator in the neighborhood.
There has been a man trying to abduct children into his car for the past two years in our area. All the schools put out alerts, it gets on the tv from time to time . As a consequence of this we are so extreme about telling the kids to run from strangers and go to a busy shop or the like. Prior to this, I was not so neurotic.
This man has tried to abduct three children last year and this year and has not been caught. We have no way of knowing if he is still on the prowl in this area. Every time he goes off the radar for a while, there will be another incident. So it's not really a case of knowing if we're safe.
He has tried to abduct two girls and one boy of varying ages (9 - 12) from neighboring suburbs. The only thing each child had in common was, they were walking alone along the street and none of the streets were deserted I may add.
We live in a, supposedly, nice neighborhood. The thing about nice neighborhoods is there can be a veneer of safety and goodness that is not realistic.
My 12 year old daughter often walks home from school, last year she and her 13 year old brother would walk together; but he has since started high school, she will join him on that walk in the new year. She hasn't walked home alone for some time, but is under strict instructions, as they both were last year.
The rules.
- To never split up, even if they fight, they wait for each other.
- Never approach a car when an adult is sitting there and wants to speak to you, no matter how nice they may appear.
- If a car pulls over and the person or people want to speak to you, go straight to a busy shop. Explain to the manager of the shop what has happened and ask to call me, if they don't have a phone. In this case they walk along a busy route and past many shops and we have discussed where to go and what to do. The good thing about our neighborhood, is most of the shopkeepers would do this and at this time of the day there is a lot of people about including people my children would know.
- If they see people they know from school, approach them.
- They are never to accept lifts from anyone (except a few set of well designated people we have discussed and identified) without my prior permission.
Trusting in increments.
I have explained to them clearly, that unfortunately we cannot just trust anyone we don't know. That most people are indeed ok, but it's not something that we can discern until we get to know them.
They are old enough and been having safety education at school to have a concept of what a pedophile or similar predator is. My son's friend had taken my son to a neighboring house of an older man living alone, who fixes the local children's bicycles without charge. I explained to my son, the problem is, the type of person who preys on children, will frequently ingratiate themselves to children and put themselves in positions to have contact with and gain the trust of children.
I explained, his friend may trust him, but I have never met this man (neither have his friend's parents who I do trust). I also pointed out that his friend was getting into a bit of trouble lately and his parents weren't too happy about this (a fact his parents would freely discuss in front of my son - I don't believe in sharing confidences of other parent's with my children). Please note I do not assume this man is dodgy, I am cautioning my son, not to enter the houses of strangers.
Given my children's father died when they were babies (1 and 3), they have had no real male figure in their lives for the vast majority of their lives. With all the research about the types of children who are vulnerable to predators, children craving for a father figure can be at risk. So I have had to be extra cautious, as my oldest son (the 19 yo), in particular would form intense attachments to men. I had to be watchful and mindful, without spoiling the relationships or his trust.
The balance between caution and closeting.
So this is a difficult balance. For me I err on the side of being overly cautious, as the dreadful effects of child molestation, I consider, are far worse than being cautious of strangers. I have instilled in my children it is ok to trust people, but it takes time to get to know someone. Moving into a new neighborhood and school a few years back was a great opportunity to show them how to build up trust and new friendships.
My son would always ask "do you like ...". I would always start by saying they "seem" and give my opinion (I may not have had one) as I saw it then, with the conditional statement, it is hard to make a judgement without knowing more. (In this case I refer to judgement, as a commonsense choice). Gradually, as we have gotten to know people, some we remain distant from and others are in our inner circle of trust and there is a continuum, not just based on trust, but compatibility.
I think teaching children to discern things in life as it is not always what it seems, without over analysing it or becoming unduly suspicious, it a good tool to have to cope with life,to have healthy boundaries form healthy relationships.