The same place all moral codes come from. The idea that moral codes come from religions is really a false meme. Religions are merely a mechanism to encode and preserve what already exists in a society. Do you think that before The Bible, no one had ever thought of the idea of 'do unto others as you would have them do unto you'? Or 'thou shalt not steal'?
The real source of moral codes is human nature itself. We are social animals, and like all social animals, we have hardwired social 'herd' behaviors that allow us to form viable social constructs. The basic unit is the family. All the larger social units are based off of this model. The next step up is the clan, then the tribe, then the fiefdom or municipality, then the nation. All of these constructs have the same basic concepts; rights and privileges, responsibilities, and authoritarian hierarchies. Look at any society at any point in human history, and you will find them. They will not be all the same, but they will have striking similarities. We are all raised by societies, and they indoctrinate us all with their moral codes. As individuals, we will have our own version of that moral code that we live by, whether we realize it or not, but the foundation comes from the society we were raised by, and/or the one we currently live in
The basic-most right is the right to life. If you and/or your family members can be killed at any moment on the whim of the leader or leadership, you are not going to stick around unless you are held there by force. Even in such harsh authoritarian societies such as feudal Japan or modern North Korea, there are rules that, if followed, allow you to live in some degree of safety. There have been societies where the rulers at the top have such unfettered authority that they can walk around killing innocents at will, but the safety there is in numbers; with so many people and so few rulers, it is very unlikely that you will be a victim. And even as a slave, it is unlikely you will be killed out of hand because your labor is a valuable commodity. Societies must provide the basics; food, shelter, and whatever. That is part of the right to life; the social contract that says, 'I will contribute to society, and you will feed me or protect me while I feed myself and others'. The herd is stronger than the individual, but only if the members of the herd follow the rules and live cooperatively.
The next most common and important right in a human social construct is property rights. If what you produce is stolen from you, you have no incentive to produce anything at all. A non-productive herd soon dies. So there must be rules that allow you to keep at least some of what you produce from your labor, and to keep the tools you use to produce the things you produce. 'Thou shalt not steal' is derived from this fundamental human social reality. When the leadership of a social unit becomes too greedy and steals too much, life becomes so hard that the herd members lose their productive incentive or simply starve. Such dysfunctional societies soon collapse, or rescue themselves by adopting a more workable social model. An incredibly strong authoritarian structure can keep such a society going for a time (like North Korea), but in the long run they will not be competitive with other freer societies that provide greater work incentives and are thus more productive.
There is much more to this whole concept; far, far more than I can cover in one post. The idea is generally referred to as natural law, and it is the social science upon which the American system of governance was built upon by our Founding Fathers and the Framers of our Constitution. Reams of books, essays, pamphlets, treatises and more have been written about this over the last millennia. The fact that modern representative democracies so well conformed to human nature is why this has been the most successful model for such large social constructs to date. The fact that we are moving away from that model towards a more authoritarian cleptocratic model is why they are now starting to fail.