To add to Ghost Towns post..
A goal scored through a handball, accidental or not, should not stand. However, i would add the handball must be by the goal scorer or as a direct assist by the attacking team to eliminate the Firmino type decision.
As for an accidental handball by a defender inside the box not being a penalty, this is equitable as it stands. As an explanation the attacking team still has a chance to score from open play after the deflection. And many times they still get shot off which results in no goal. Hard luck that but no second chance through a penalty, imho.
To me though that looks like the "hand ball" is one-directional. And not only that, but it benefits the defender, not the attacker, whereas the spirit of the law is to benefit the attacker (e.g., the pre-VAR offside rule if in line).
Again, I'm not talking about "hand of God", Thierry Henry's goal against Scotland and such blatant use of the hand, but even a settle motion to make yourself bigger if you can't properly judge the ball path, or if you put your arm close to the body to trap the ball "at the chest", etc., goals from all such incidents should be ruled out. Even unintentional events that helped the attacker score should be ruled out if it would not have been a goal if the arm was not there (like a deflection). But when the arm is tucked in and it's position does not change the outcome, I think it's wrong to penalize the attacker. The disallowed goal against us was such an example - if the arm was behind his back and the ball hit his chest, he would have still scored. If the arm deflected the ball unintentionally, e.g., away from the keeper, then the goal shouldn't be counted.
There is always going to be grey area in such definitions, I just don't like the current ones. They were made to help a bunch of incompetent referees make better decision on paper, and the game isn't getting any better and the referees aren't getting any smarter.