If I copied some code from Stackoverflow early on in the development process, forgot to take it out, and published the finished website containing the code from Stackoverflow, is my website no longer allowed to be proprietary?

What if I re-wrote or removed the copied code? The thing that worries me is that according to https://creativecommons.org/licenses/by-sa/4.0/ which describes the CC BY-SA 4.0, "If you remix, transform, or build upon the material, you must distribute your contributions under the same license as the original." That would make the entire proprietary code base compromised right? All of the code that I was counting on being proprietary can no longer be proprietary...?

Is there any legal emergency removal procedure where I can re-write or remove the copied code and therefore still be allowed to keep my code proprietary?

  • 1
    Most probably the code that you have copied is just fragments, in which case I don't think the licence applies. If you have copied a whole algorithm, then its a different issue. Jun 1, 2023 at 1:15
  • 1
    I understand. In my example I am just talking about fragments, but let's say for the sake of better understanding the license, I did copy a legally substantial amount of code. Jun 1, 2023 at 2:07
  • 1
    please note that courts do not (or very rarely) force proprietary code to be released. Even if the author of the code would sue you, the more likely outcome from the lawsuit is that you must take down the old versions from the website, pay something to the author of the BY-SA code, and/or recall your software from your customers and refund them.
    – user253751
    Jun 26, 2023 at 23:01
  • 1
    also note that nothing happens unless the author of the code sues you in court. Most of the time, the author is quite understanding of mistakes and doesn't want to waste lawyer's fees to make you stop distributing old versions of your product as that is a waste of everyone's time and money.
    – user253751
    Jun 26, 2023 at 23:02

1 Answer 1


It is always worrying to have code with unknown provenance in the code base. Therefore it is a good idea to plan to remove/replace it.

Alternatively you can search if that same code is from a published project (GitHub or the like) and research if that code is under a permissive license. If that is the case then you can just use that as a reference and comply with these license terms.

Is the copied code actually distributed through the website (e.g. HTML or JS code), or is it part of the back-end and does not reach the visitors? The copyleft implications of CC BY-SA only apply when you are sharing the code with 3rd parties, and use on a back-end server is likely not 'sharing'.

Please read Section 6 "Term and Termination" of the license. Now that you have discovered the issue you need to act to cure it. I would not call it 'emergency procedure', it is just maintenance you have to complete within a short period of time.

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.