I am creating a module for a CMS. I found a PHP code in github that does some work for me. The author has not clearly stated the license for the code. Since it is in github and is publicly available, can I use the code in my module or should I get the author's written permission? I am planning to sell my module for a small price.

  • 1
    If it doesn't include a license, it's not open source. Maybe it's on Github in violation of their TOS.
    – user7043
    Commented Aug 12, 2013 at 9:41
  • 1
    "Open source" can mean either "has source code publicly available" or "complies with the OSI's Open Source Definition, allowing redistribution, modifications, use for any purpose, etc." If there is no license, the second definition does not apply here. Publicly-available source alone (in the first definition) grants you zero rights. As Jon says below, the absence of a license implies that author reserves all rights under copyright and grants you none (in all 166 nations that are signatories to the Berne Convention).
    – apsillers
    Commented Aug 12, 2013 at 12:54
  • When you say "use the code in my module" do you mean you actually want to include the code in your module? Do you want to distribute the code you found or merely use it? Commented Nov 1, 2018 at 11:15

5 Answers 5


Since it is in github and is publicly available, can I use the code in my module...


...or should I get the author's written permission?


In all 166 nations that are signatories to the Berne Convention, copyright is granted to an author when the work is created. The author holds a monopoly on all copyright rights (creating modifications, creating and distributing copies, etc.). You -- as someone who is not the author -- have been granted none of those rights.

A license is a mechanism by which the rights-holder (here, the author) grants some set of rights to a recipient (here, you). You say that the author has not offered any license, which means by default that the author has reserved all of his rights. The fact that the author has made his code publicly viewable does not mean that you have been granted any rights beyond the right to view the code. The right to make derivative works and the right to redistribute the code are not rights that you currently have.

Since you mention that code is on Github, it's worth mentioning that the Github TOS have this to say about material hosted on their site:

By setting your repositories to be viewed publicly, you agree to allow others to view and fork your repositories.

Hosting on Github means that the author grants others the right to "view" and to "fork" the repository. Here, "fork" probably just means "use Github's fork feature", which creates a repository clone, hosted on Github. I admit the Github's use of the term "fork" here is ambiguous, but if my reading is correct, then in no way does this appear to grant you any right to:

  • copy the code outside the context of a Github fork
  • make any modifications to the forked code
  • incorporate the author's code into your own

The bottom line is: you don't have the right to distribute this code. It's possible that the author wants people to use his code freely, but neglected to include a license. Tell the author that the lack of a license has blocked your use of the code, and encourage the author to add a some mainstream OSI- or FSF-approved license to the repository.


Not all open-source software is free software.

In the absence of any specific license, under U.S. law the work is the copyright of its author, who reserves all rights. Especially if commercial use is involved, you must contact the author and ask them to provide you a written license; otherwise you are infringing on their copyright. That license may be a general free software license such as BSD or MIT, or it may be an individual license for your use only.

  • They can only reserve the right given to them under US law (17 USC 106), which does not include the ordinary use of the work) and they cannot claim mere use is infringing (17 USC 107). Commented Nov 1, 2018 at 9:48
  • @DavidSchwartz: From the phrasing in the question, I took “use the code in my module” to mean “copy parts of their code into my code”, which counts as derivative work and/or redistribution; you’re absolutely right that merely using the code (say, by invoking it as a separate self-contained library) is not infringing.
    – Jon Purdy
    Commented Nov 2, 2018 at 1:05
  • "Think free as in free speech, not free beer."
    – Marco
    Commented Apr 8 at 10:55

Just because it's on the Internet and/or is open source, does not mean it's free to use!

You need to find out what license the code is written under.

  • It might be prohibited from commercial use (maybe unless you pay for it...).
  • It may be an "copy-left" license which forces you to share that code, or all your code, with your customers.
  • It might simply be something that requires you to give credits to the original author/project.

  • .. or it might be public domain, which means DWTHYWWI (Do What The Hell You Want With It).

  • 1
    For future readers: DWTHYWWI = Do What The Hell You Want With It. Commented Aug 12, 2013 at 8:54
  • This is the absolute opposite of the truth. Yes, giving people copies of a work grants them the freedom to use that work. Were that not so, how could you possibly browse the web? All you have are copies of the pages on the Internet, how can you use those web pages without a license? Commented Nov 1, 2018 at 9:46
  • @DavidSchwartz Well, you can look at a photo but you don't own the rights to use it in your own ads. Therein lies the difference.
    – Macke
    Commented Nov 1, 2018 at 16:07
  • @Macke What you have is the right to use the work in the ordinary, expected way. In other words, it is free to use. If you make copies of your poem and drop them from an airplane (analogous to putting code on the Internet for anyone to download) you absolutely can't go around charging people who read your poem or use your code with copyright infringement. In the United States, use is a right of possession. This is why you don't need a license to read the books in your library. Commented Nov 1, 2018 at 18:46

A license doesn't tell you what you can't do - a license tells you what you can do beyond what copyright law allows you to do. Since you can't find a license, you are allowed what copyright law allows, nothing more, nothing less.

Copyright law doesn't allow you to create "derived works", like downloading this code and changing it, or creating a larger work containing this code.

What you should do - which is both perfectly legal, and much better for you: Read the code. Learn how it works. When you have learned it, write your own code.

Of course, offering money for a license is Ok as well. Your offer may or may not be accepted.

  • "Copyright law doesn't allow you to create "derived works", like downloading this code and changing it, or creating a larger work containing this code." In some jurisdictions (such as the US) it does if this is reasonably necessary to use the work in the ordinary fashion. For example, if the work is a coloring book, you can create derived works by coloring it in. If the work is a library and the ordinary use is creating derived works, you can do so. (Don't distribute them though!) Commented Nov 1, 2018 at 18:54

Under US law, you do not need a license to use a work if you lawfully acquired a lawfully-made copy of that work.

It is amazing to me how many people get this wrong. But if you think about it, it has to be this way. Otherwise, you couldn't even read a book without a license. Most books don't include licenses.

17 USC 106 sets out the particular rights that can be reserved to copyright holders. It does not include ordinary use. Note that you may not make further copies of the work or modify it unless that is reasonably required for the ordinary, expected use of the work.

  • 3
    That presumes the OP's downloaded copy is legally-acquired, which would not be the case in the absence of a license. The OP intends to sell copies of the work incorporated into his own product, which is reproduction (forbidden without a license allowing it) and not ordinary use (okay if the acquisition was legal).
    – Blrfl
    Commented Nov 1, 2018 at 11:08
  • @Blrfl The OP's copy would be legally acquired if someone authorized to distribute it placed it on Github. He would have this same issue even if there were a license because he would not be sure the license was granted by someone authorized to license the work. Someone could randomly place code they had no right to distribute on github, but they could equally well attach a license file to that code and it wouldn't change anything. The OP is ambiguous about what he wants to do with the work (he says use it). I asked a qualifying question. Commented Nov 1, 2018 at 11:17
  • 2
    Your answer is technically correct, but very misleading in the context of the question. (1) As Blrfl points out, OP was not trying to merely use the software, but to sell a product including that software. (2) The question is not US-specific, but your answer is. (3) Your analogy with the book is flawed because executing a program usually involves temporary copies. Many copyright laws specifically exempt these temporary copies or cached copies.
    – amon
    Commented Nov 1, 2018 at 12:19
  • 2
    @DavidSchwartz The first sentence in your last comment is incorrect. Part D of GitHub's terms of service disclaims rights to distribute uploaded content outside of what they need to provide the service. If I don't grant a license to distribute, I've still granted GitHub a license to show my work to others for purposes of looking at it, but anyone cloning or otherwise downloading it will have made an unauthorized copy. The ToS makes clear who's responsible for content uploaded without authorization.
    – Blrfl
    Commented Nov 1, 2018 at 13:06
  • 1
    You keep rebutting the assertion that a legally-acquired work can't be consumed (or, in the case of software, run), which isn't one I've made. You also keep ignoring the parts of the question where the OP says he wants to incorporate the code into another work ("...can I use the code in my module...?") and sell copies ("I am planning to sell my module for a small price."). That would involve reproduction, which the OP has been given no license to do.
    – Blrfl
    Commented Nov 1, 2018 at 22:19

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.