Ethics in Street Photography
It is not uncommon for new photographers to the street photography genre to express fear of shooting strangers in public as well as question whether it is right or wrong to do so. There is the additional fear of being confronted when spotted taking photos of someone without their permission.

Typically if you have eye contact in your shot, the subject will continue walking past you.
Overcoming Fear
The short answer to overcoming fear of taking photos of strangers is to get out there and do it more often. It will help if you go out with a small group of 2-4 more experienced and confident photographers. You can also read my article on 7 Tips for Overcoming your Fear of Street Photography.
Everything you’ve ever wanted is on the other side of fear.
Legality
Legality will depend on where you are shooting. In Canada, most of the United States, and the U.K. it is 100% legal to take shots of people, including children, in public. Other countries, will have stricter privacy laws about publishing photos of strangers - I'm aware of both Germany and France having laws related to this.
When in countries with stricter laws you will need to adjust your photography to be more of the high contrast shadows and silhouettes seen in fine art street photography. Typically, as I understand it, as long as the main subject of your shot is not identifiable then you are good to go. But you should 100% check the laws where you are shooting as things will change over time and location.
Ethics
Is street photography right or wrong? Only you can decide for yourself whether it is and what types are acceptable. Some people will not take photos of children, more on that later. Others, myself included, do not photograph homeless or other vulnerable people.
I do not take photos of homeless people specifically because they do not have anywhere they can go to have privacy unlike everyone else. One counter argument to that is you are raising awareness of the plight of the unhoused. Sharing photos of homeless people on social media does not raise awareness, it is poverty porn and exploitive for likes. Unless you are an investigative journalist or on paid assignment, I do not see any value in shooting homeless people.
The Public
The general public, however does not have expectations of privacy when out in the street in most countries. A broad definition of street photography is candid photographs of strangers in public locations. This can be anywhere from the stereotypical walking down the street, to people on the beach, or people in indoor locations such as shopping malls or train stations.
Indoor spaces open to the public are technically privately owned and may have their own rules about photography or may have security guards that are bored and want to exercise their authority. For example I have taken many street photos in The Eaton Centre shopping mall in Toronto without an issue. But one of my photographer friends was asked to leave when using his Fuji XT5 inside. However other people next to him taking photos with a phone were not asked to leave.

An indoor street photography shot, taken at Sheppard West subway station in Toronto.
Children
Taking photos of children in public can be risky in todays climate of fear. No one wants to be seen as a creep or potential predator.

I took this shot with her mother watching just off screen. I then showed her the photo and gave my card so she could get a copy of the shot.

Shot from the hip as I walked by. I liked how the jacket matched the colors of the cheese shop behind him.
I don't recommend seeking out shots of children, but when a great moment presents itself I typically take the shot. This is more common at public events such as street festivals, amusement parks, and beaches. However it's important to read the 'room' and decide on a case by case situation whether it is worth the shot.
Below is a shot at a water park that it took many visits for me to get one that I was satisfied with. Lots of children and parents off screen watching. Not one person said anything as it was clear that I was taking a photo more of the mist than the children. Additionally I took a few frames and moved on within a couple of minutes.

Confrontation
Confrontation in public is probably the street photographers greatest fear outside of missing focus. In my experience, and that of photographer friends, this happens much less than novice photographers think. I've been shooting in public for over ten years and I have only been confronted three times.
The best approach, in my opinion, is to de-escalate. Explain what you are doing and why you took a photo of that person. Each time I said something complimentary about the person such as I like your sense of fashion or The hat you are wearing drew my attention and I love your smile. This will usually work. If they insist, I will delete the photo.
The quality of our lives depends not on whether or not we have conflicts, but on how we respond to them.
Deleting the photo, even though I have the legal right to take it, is the quickest way to de-escalate and prevent a physical confrontation. You do not know what is going on in the confronters life at the moment. They could be having the worst day of their life and getting into it because you are legally right could make it even worse. Additionally, to me, it's not worth the stress of a confrontation. I'd rather delete, move on, and take more photos.
Conclusion
Street photography is not inherently right or wrong. Different aspects of street photography may be received differently depending on context and each persons moral compass. Take the photos that you are comfortable taking and be respectful to vulnerable people such as the unhoused.
And finally when confronted it's best to de-escalate if possible.