Contracts and legal
Open source licenses in a codebase sale: can they block it?
Open source licenses in a codebase sale rarely stop it; they limit what the seller can promise about the borrowed parts.
Published · 7 min read

The short answer
Rarely. A company can sell or license the code it wrote, and permissive code (MIT, BSD, Apache-2.0) can go along with its notices. Copyleft code (GPL, AGPL) can be handed over too, but only under its own licence, so it can't be made exclusive. Non-commercial licences are the real blockers: that code needs permission or removal.
Key takeaways
- Black Duck audited 947 codebases for its 2026 report: 98% contained open source and 68% had licence conflicts, a record for the report.
- Under GPL-3.0, giving a buyer a copy is 'conveying', while serving users over a network is not; so licensing a repository to an AI lab can trigger terms a SaaS company never met before.
- BigCode's The Stack keeps only permissively licensed files, and dropped even MPL, EPL and LGPL in version 1.1: a sign of what code buyers prefer.
Do open source licenses in a codebase sale stop the deal?
No: they govern only the parts the company didn't write. The company owns its own code (if staff and contractors assigned their rights) and can sell or license it. Each open-source component keeps its own licence and travels with it.
The Open Source Initiative's FAQ says you can sell open source software, but that commercial is not the same as proprietary.
So the question is what you can promise. An acquirer wants to own the code; an AI lab wants training rights, often with some exclusivity. Borrowed parts limit both.
- Audited codebases containing open source
- 98%
- Codebases with licence conflicts
- 68%
- Components with no detected licence
- 8%
What does each licence say about selling a copy?
Permissive licences allow resale with notices; copyleft licences allow it under their own terms; non-commercial riders forbid it. The table quotes each licence text.
| Licence | What the text says | What it means for a sale |
|---|---|---|
| MIT | Grants the right to 'sell copies'; the notice 'shall be included in all copies or substantial portions' | Can be sold; keep the notice |
| Apache-2.0 §4 | Give recipients a copy of the licence, mark changed files, keep notices and the NOTICE file | Can be sold; keep the paperwork |
| MPL-2.0 §§3.1, 3.3 | Source distribution of covered files 'must be under the terms of this License'; a Larger Work may use 'terms of Your choice' | Partly: your files can be closed, the MPL files stay MPL |
| GPL-3.0 §4 | 'You may charge any price or no price for each copy that you convey' | Yes, a copy can be sold |
| GPL-3.0 §10 | 'You may not impose any further restrictions' on the rights the licence grants | No exclusive or closed terms on GPL parts |
| AGPL-3.0 §13 | A modified version must offer users 'interacting with it remotely through a computer network' its source | Applies even without handing over a copy |
| Commons Clause | The licence 'does not grant to you, the right to Sell the Software' | No: needs the licensor's permission |
| PolyForm Noncommercial | 'Any noncommercial purpose is a permitted purpose' | No: commercial use needs permission |
Why does licensing code to an AI lab change things?
Because the lab gets a copy. GPL-3.0 §0 defines conveying as propagation that 'enables other parties to make or receive copies', and says mere interaction over a network 'is not conveying'.
A SaaS company that only ran GPL code on its servers may never have conveyed it. Handing the repository to a buyer is conveying, so the GPL's conditions now apply to those parts: the buyer gets them under the GPL, and §10 forbids added restrictions such as exclusivity.
Buyers' own datasets show their preference. BigCode's The Stack keeps only files under permissive licences, and version 1.1 removed MPL, EPL and LGPL too. Whether training a model on GPL code makes the model a covered work is not settled by the licence text.
How common are these licences in real codebases?
Very: in Black Duck's 2026 audit of 947 codebases from 197 M&A deals, MIT appeared in 92% and LGPL in 48%.
| Licence | Share of audited codebases |
|---|---|
| MIT | 92% |
| Apache-2.0 | 90% |
| BSD-3-Clause | 85% |
| LGPL-2.1 or later | 48% |
| CC0 | 46% |
| MPL-2.0 | 45% |

The report also found 11% of components under custom or modified licences, and warns that a GPL violation found in due diligence 'can derail an acquisition'.
What did our checker find in a test repository?
Four of six groups needed review. An open source license checker scans a codebase for licence files, package licence fields and per-file licence headers, so you can see which licences cover the code and its dependencies.
We built a fictional dispatch-software repository with 12 files: the company's own package.json marked UNLICENSED, vendored MIT and GPL-3.0 code, an AGPL and an MPL file header, a BSD Python manifest, and five invented node_modules packages.
- Permissive: 5, with 'MIT OR Apache-2.0' counted as the less restrictive choice.
- Flagged: GPL-3.0 (strong copyleft), AGPL-3.0 (network copyleft), PolyForm Noncommercial, and a package with no licence field.
- The company's own UNLICENSED marker was flagged as restricted: expected, since it means the company reserved its rights.
- Our unmarked source file produced no entry; the top-level licence covers it.
How do you clear licences before a sale?
Find every licence, remove what you must, and write the rest into the contract.
- 1
Scan the repository
Run a licence checker over the whole folder with dependencies installed; keep the dated output.
- 2
Remove what you can't pass on
Strip or replace non-commercial and Commons Clause code, or get the rights holder's written permission.
- 3
Separate copyleft parts
List GPL, AGPL and MPL files so the buyer receives them under their own licences, with the source and notices.
- 4
Keep the notices
Ship MIT and Apache notices and NOTICE files with the copy you hand over.
- 5
Scope the grant
Limit exclusivity and ownership promises to the company's own code; list third-party code in the warranties.
What this post doesn't cover
Licence texts don't settle every case. Whether linking makes your code a derivative work, whether training on GPL code creates obligations, and how a court reads a custom licence depend on the facts and the country. Patents and code copied without any licence need their own review.
Ownership is a separate check: licences say nothing about whether staff and contractors assigned their rights. Our guide to selling a codebase covers it.
Sources
10 sources · checked Nov 24, 2026
The DataBroker team checked the facts on this page against 10 public sources, last on .
- GNU General Public License v3.0§0 propagate and convey, §4 price, §5(c), §10 no further restrictions · Checked
- GNU Affero General Public License v3.0§13 remote network interaction · Checked
- Mozilla Public License 2.0§§3.1 and 3.3 · Checked
- Apache License 2.0§4 redistribution conditions · Checked
- The MIT License, Open Source InitiativeRight to sell copies; notice condition · Checked
- Commons Clause License Condition v1.0No right to Sell; definition of Sell · Checked
- PolyForm Noncommercial License 1.0.0Noncommercial purposes only · Checked
- Open Source Initiative, FAQSelling open source; commercial is not proprietary · Checked
- Black Duck, 2026 Open Source Security and Risk Analysis report947 codebases, 98%, 68%, 8%, 11%, licence prevalence, M&A quote · Checked
- BigCode, The Stack dataset cardPermissive licences only; MPL, EPL and LGPL removed in v1.1 · Checked
Open source licenses in a codebase sale FAQ
Can I sell code that uses GPL libraries?
Yes, you can charge for a copy: GPL-3.0 §4 allows any price. But the GPL parts and works built on them pass under the GPL, so you can't sell them on closed or exclusive terms.
Does giving an AI lab a copy of our repository count as distribution?
Under GPL-3.0's wording, handing over a copy is conveying, while users reaching software over a network is not. Whether the model trained on the code is itself covered is unsettled; ask a lawyer.
What is the Commons Clause?
A rider added to a licence such as Apache-2.0 that removes the right to sell the software: to charge for a product or service whose value comes entirely or substantially from it. Code under it needs the licensor's permission before a sale.
Related
- Open source license checker
An open source license checker for a whole repository: it finds every licence it can and flags those to review before selling the code.
- Lines of code counter
A lines of code counter for whole repositories: choose a folder and see code, comments and blank lines by language, without uploading anything.
- How to sell software you have built
How to sell software you have built, whether that means the whole product, the IP, or licensing the codebase as training data.
- Code datasets for AI training
Code datasets range from open corpora built from public repositories to private codebases that AI labs now buy from shut-down startups.
Codebase value calculatorA codebase value calculator that reads a public GitHub repository in your browser and estimates rebuild effort and cost with basic COCOMO.
- Dataset overlap
Dataset overlap is the part of your data a lab already has; here is how labs measure it and how to measure it first.
More from the blog
- What is a tail clause in a broker or finder's fee agreement?
A tail clause keeps your fee owed after the agreement ends; here is what eight filed agreements set and how to write one.
- Can a bankrupt company sell customer data?
Can a bankrupt company sell customer data? Often, but its old privacy promises follow the data into court, as RadioShack and 23andMe showed.
- How to check data broker registration for a data supplier
Check data broker registration for any data supplier in four state registries, then read what each entry says before you buy.
Free tool
Try the open source license checker
An open source license checker scans a codebase for licence files, package licence fields and per-file licence headers, so you can see which licences cover the code and its dependencies.
- Free
- No sign-up
- Runs in your browser








