Good laws are conservative codifications of consensus morality. A just legal code forbids only what the vast majority would consider wrong regardless of the law.
When the law forbids what people don't consider wrong, it becomes tyranny.
> A just legal code forbids only what the vast majority would consider wrong regardless of the law.
I don't think that's entirely true; legal codes often specify things on which there is a strong preference for uniformity (or benefits which can only be gained by uniformity) but where the details of the uniform rules are not themselves a near-universal consensus independent of the law. I don't think this makes them bad legal codes. (Prohibiting driving on the left-hand side of a public roadway in the direction of travel, for instance.)
When the law forbids what people don't consider wrong, it becomes tyranny.