If you're looking to share your project with others, you must include an open source license. Without a license, no one can legally use any part of your code, even if it's public. The FSF GPL licenses, such as the GNU GPL, grant different freedoms like the freedom to run the software as desired, to study and change the source code, and to redistribute copies. You can also grant some rights when you publish your source code on a site that requires acceptance of the terms of service.
However, these models may not be ideal and can cause issues for both the owner of the rights and the user. To address this, other permissive licenses have been created with minimal restrictions on how software is modified or redistributed. To make something open source, you must find a license that explicitly states your rights to the software. Open source software is a type of software whose source code is published on the Internet and is easily accessible to everyone. Free software comes with a few risks, such as contamination of closed-source projects, infringement risks, compliance issues, reputational risks, unclear or vague obligations, and overlapping disparities in patents by jurisdiction.
Open Source Stack Exchange is a question and answer site for people who organize, market, or license open source development projects. The EUPL contains provisions on free access to source code, warranty and liability exemptions, competent jurisdiction and applicable legislation. Additionally, if someone gives away software in binary format, they must allow recipients of the source code to access the source code and license any modifications to the source code under the same conditions as the original code. For example, if you publish your source code to a public GitHub repository, you have accepted the Terms of Service which grants some rights to other GitHub users. This would conflict with FSF freedom 0 (the freedom to run the program as desired) and OSI criteria 5 (non-discrimination against individuals or groups) and 6 (non-discrimination against fields of activity), so it is often considered not open source or FOSS (free and open source software).If you mean not using code for things that are morally wrong (for some definition of what is morally wrong), no open source license will be able to help you mainly because of the difficulty of defining what is morally wrong.
The licenses of the Open Source Initiative allow free access and distribution of source code but derivative works must be distributed under the same conditions as the original software.