33

I want to know the code license on Stack Overflow. Sometimes I copy the original code pieces, or make some changes; sometimes I used the idea and code by myself.

I really want to know the license or copyright of that code. How should I state the declaimers when I use these in my program which will be published as a non-commercial software, but not open source?

2

3 Answers 3

24

According to Stack Overflow TOS section 6 code posted on Stack Overflow falls under CC-BY-SA, now CC BY-SA 4.0 (International) (was CC BY-SA 3.0 Unported according to this related question and this post by Sebastian Baltes).

There was discussion in this question and this question about migrating to MIT license which was evidently stalled, on an indefinite basis as of this writing in July 2018. There are some more details in the post by Sebastian Baltes).

I would like to give credit to this answer for pointing to the legal link at the bottom of this page, despite the outdated section number.

1
  • Note, that this code may not be used in the Linux kernel source tree, for example.
    – 0andriy
    Commented Sep 22, 2022 at 17:53
4

TL;DR: Do not ever copy anything at all from SE if you are working on something important. There might be legal issues that I mention here. And for sure there are technical reasons, which I don't mention, for never copying from SE at all.


Nobody knows if there is any license for code posted before the "migration" to CC BY-SA 4.0 (International). Only a trial would settle the issue for sure.

SE used CC-BY-SA 3.0 Unported some time ago. And unilaterally changed it to CC BY-SA 4.0 (International). Which is a copyright infringement act in the opinion of some people and thus would void their previous 3.0 licenses.

Actually, it used a different version before 3.0. And also unilaterally changed to 3.0 back then. Another copyright infringement act in the opinion of some people.

It could be argued that SE lost the licenses to code posted before the change to 4.0. If so you'd be copying unlicensed code. Unless you copied it yourself before such change if so you'd had gotten a proper license which would still be valid.

To complicate matters, when you post something here you are granting SE two licenses. The 4.0 one. And this one from Terms of Service

and you grant Stack Overflow the perpetual and irrevocable right and license to access, use, process, copy, distribute, export, display and to commercially exploit such Subscriber Content, even if such Subscriber Content has been contributed and subsequently removed by you as reasonably necessary to, for example (without limitation):

  • Provide, maintain, and update the public Network
  • Process lawful requests from law enforcement agencies and government agencies
  • Prevent and address security incidents and data security features, support features, and to provide technical assistance as it may be required
  • Aggregate data to provide product optimization

But that is a license granted to SE. There is no indication whatsoever that SE is granting us a license based on that. SE seems to be publishing only under CC-BY-SA 4.0 (International).

Since SE has done this more than once it is quite possible they'll do it again. So even code posted under 4.0 is not safe unless you keep tabs on Meta and SE's actions. We can't simply come here, copy code, and expect that everything has been managed properly on the licensing side.

4
  • 1
    Are you aware of this post? Content contributed before 2018-05-02 (UTC) is still distributed under the terms of CC BY-SA 3.0.
    – Ivar
    Commented May 5, 2021 at 13:23
  • 1
    This answer is simply incorrect. Any violation by SE does not revoke the license for anyone else. It’s Section 7a of the 3.0 license: creativecommons.org/licenses/by-sa/3.0/legalcode.
    – Laurel
    Commented May 5, 2021 at 13:40
  • @Laurel No, it is not incorrect. I already state that violations by SE do not invalidate licenses for anyone else who got a valid license. BUT.... violations by SE invalidate SE's license. And if SE's license is invalid then SE cannot publish such code and cannot grant you a license to copy it. So if you copy AFTER SE's violation then you are copying without having been granted a license. Commented May 6, 2021 at 13:20
  • @Ivar Yes, SE rolled back. But that does not change the fact that they published under 4.0 content which they had no license to publish under 4.0 (or so some people thing). That was and is considered as copyright infringement by some people. And nothing done after that can change whether such previous act was or was not copyright infringement. And if indeed it was copyright infringement then SE would have lost their licenses granted by original posters. Has SE lost such licenses? As I say in my answer, only a trial would give a definitive resolution for that. Commented May 6, 2021 at 13:24
1

You can read the legal notice by clicking the legal link at the bottom of this page. The point 3 refer to your question and the answer is yes you can use what ever is on Stack.

6
  • Should I include any statement for these. The license is cc 3.0, how should I include it in released android app? The normal open source code is declaimed like these: gyazo.com/25ac7c56db62d67b00d0f15a3c32352c
    – Jack Lau
    Commented Apr 19, 2016 at 2:47
  • It is now point 6, link is stackoverflow.com/legal/terms-of-service#licensing and a link in the description now indicates CC BY-SA 4.0.
    – brodybits
    Commented Jun 28, 2018 at 15:49
  • P.S. I downvoted the answer since it refers to outdated point number and does not really seem to answer the question in general.
    – brodybits
    Commented Jun 28, 2018 at 15:51
  • @brodybits You could also add an answer with the updated information... Commented Jun 28, 2018 at 23:05
  • @mike-mccaughan it does not seem to let me edit the answer. If I click edit I get the following message: "Suggested edits are not allowed on non-tag-wiki posts on meta sites." (I had to use Chrome Developer Tools to copy the actual message.) Should I raise this in a new meta question?
    – brodybits
    Commented Jun 29, 2018 at 19:32
  • 1
    @brodybits I meant add a new answer with the updated information, not edit. Commented Jun 29, 2018 at 21:47

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .