Open Source licenses do not allow discrimination against who uses the software or what they use it for:<p>"5. No Discrimination Against Persons or Groups<p>The license must not discriminate against any person or group of persons.<p>6. No Discrimination Against Fields of Endeavor<p>The license must not restrict anyone from making use of the program in a specific field of endeavor. For example, it may not restrict the program from being used in a business, or from being used for genetic research."<p>Source:
<a href="https://opensource.org/osd" rel="nofollow">https://opensource.org/osd</a><p>Feel free to use some other license if it suits your needs or purposes. It is your software, license it how you want to.<p>Some considerations: <a href="https://geekflare.com/software-license/" rel="nofollow">https://geekflare.com/software-license/</a>
Well, you can always go with the JSON license[1] ("The Software shall be used for Good, not Evil."), though there are 2 things:<p>- This license is only open source in spirit, but technically not really due to this restriction.<p>- who defines what is malicious? The mouse thinks the cat is a monster, but the cat is only playing catch with a self-moving fur ball...<p>Alternatively you can go the Red Hat way: the GPL license says that the source should be distributed along with the binary. If you don't distribute the binary of your application, you don't have to give the source to anyone. Red Hat gives the binary to its subscribers (friends), along with the source. If they see that one of their customer has leaked the source, the contract can be terminated. One might be inclined to ask however how much is it different from a closed source distribution model.<p>[1]: <a href="https://www.json.org/license.html" rel="nofollow">https://www.json.org/license.html</a>
You really can't. You can include conditions of your license that compel the user to not do naughty things with your software, but nobody is going to necessarily arrest them if they do violate your license. For particularly malicious purposes, most people will ignore the license.<p>Most Open Source licenses (famously GPL) can make life pretty miserable on downstream corporate users, if that's your imperative. But if licensing as a whole has taught us anything it's all just data at the end of the day.
It wouldn't be open source if you did, but let's be honest unless you have very deep pockets for lawsuits anything you write in your license or ToS or anything else is just a suggestion for good actors. People are going to do whatever they want and you can't stop them.
Related inspiration for a programmer Hippocratic oath:<p><a href="https://news.ycombinator.com/item?id=5633551">https://news.ycombinator.com/item?id=5633551</a>
Not possible. Sorry.<p>What you can do is write your friends great licenses and hope they do the right things.<p>That is a lot of work, and it is not really open in the sense that has all the value.