All contributions to the Stack Exchange Websites are released under the Creative Commons Attribution-ShareAlike License (CC-BY-SA), either version 2.5, 3.0, or 4.0 depending on the post date. This applies to both code and other text in questions and answers. Code released under this license can be used under version 4 of the CC-BY-SA (while the original code remains under the older version if released as such) and can be combined with the General Public License (GPL) version 3.

However, Creative Commons recommends not using any of their licenses with software, because "Patent and trademark rights are not licensed under" them (the CC-BY-SA legal code). This means that a user could post a question or an answer with code to a Stack Exchange site and even if another user uses that code in a project licensed under the GPL version 3 and completely complies with the requirements of both licenses, the first user could sue the second user for patent infringement through a submarine patent.

For those who want to integrate Stack Exchange code in their GPL projects, is there anything they can do to protect themselves from possible patent trolling from the originators of the code on the Stack Exchange sites? I don't think this is likely to happen, but you can never be too careful with software licensing.

  • 3
    Remember that you will equally infringe on a patent even if you independently invent the same thing.
    – jpa
    Commented Sep 7, 2023 at 15:06

2 Answers 2


The simple answer is: Don't worry, there is no patent on software code.

While I agree with Philip's answer, there is another aspect which I think is more relevant:

Code is protected by copyright, not by patents. So-called 'software patents' are in reality 'system and method'-patents, they protect the way things work, not the code itself.

Code snippets on SE (under CC BY-SA license) are usually short and not complete executable programs. They are unlikely to implement a complete functionality that would constitute a patent infringement. The risk of code under CC BY-SA is not different from the risk that comes with any other code under BSD Licenses, Boost Software License, The Unlicense or MIT license.

There is always a small risk that running certain software might infringe a 3rd party patent. But this risk comes from the entire software, not from the snippets it contains. And it depends on many circumstances (where it is run, how it is implemented, and the field of application). 5 components might separately each have no patent risk w.r.t. a certain patented method (and thus a patent license would not be given as each separate component alone does not infringe essential patent claims) , but if you combine them they might be a spot-on implementation of a patented method.

And finally, the author of software cannot be the victim of a patent troll, the risk lies with the person or organization that runs the software.

B.t.w.: The term 'patent troll' has a very specific meaning. It refers to a company which owns patents and tries to monetize them without actually operating in the business fields covered by the patents they own (this is why they are called 'non-practicing entity'). Because they are non-practicing, it is very unlikely that a patent troll would actually be the author of such software. The real (very small) risk actually would come from companies operating in the field.

  • 1
    My understanding is that trolls typically purchase patents from the original authors, with the intent of then demanding license fees from other users (the original author was presumably more interested in operating the business that uses the patent than pursuing infringers).
    – Barmar
    Commented Sep 7, 2023 at 14:58

The simple answer to your question is "no, there's nothing you can do about it".

But then the same applies to any MIT or BSD licensed code you use in your projects so the additional risk you're taking on here is probably minimal, unless someone is deliberately putting up patent-encumbered code on Stack Exchange with the intent of suing people.

  • 3
    I've heard of patent trolls, but that would be the first time I've seen one build his own bridge!
    – MadHatter
    Commented Sep 7, 2023 at 7:26
  • 6
    @MadHatter while I'm not aware of people doing it with software patents, there have been people who deliberately use old versions of CC-BY with images in order to exploit technical breaches of the license and then shake down users for money; see e.g. Cory Doctorow's write up and Flickr's response. Commented Sep 7, 2023 at 7:33
  • 2
    How depressing - but thank you for the information.
    – MadHatter
    Commented Sep 7, 2023 at 7:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.