Skip to content

Rights and contracts

Can you license a codebase containing open-source components for AI training?

By SourceX Editorial · Reviewed by Noah Loul ·

Short answer

Yes, you can license a codebase that contains open-source components for AI training, but you license only the code your company owns. Third-party components are excluded or clearly marked, and a manifest shows which files are first-party. Buyers scan for open-source contamination, so the package and its history must match what you represent.

Key takeaways

  • License first-party code; third-party code is excluded or marked and never presented as yours.
  • Open source hides in vendored folders, copied snippets, forks and committed dependencies, not only in package manifests.
  • Commit history, code reviews and issues can carry third-party code even when the current tree is clean.
  • Limit representations to first-party files listed in a manifest, with a knowledge qualifier for embedded snippets.
  • Expect buyers to run their own scans and compare the results with your manifest.

What can you license from a codebase with open source inside?#

From a codebase with open source inside, you can license the code your company and its employees or contractors wrote, along with the engineering records around it, but not open-source or other third-party code as if you owned it. The open-source parts stay under their own licenses, and a data license from you cannot grant rights you never held.

That still leaves a great deal. First-party code usually carries the product's business logic, integrations and fixes, and the commit messages, pull request discussions and linked issues explain why each change was made. Those records of real engineering work are what developers building coding assistants look for.

Where open-source code hides in a private repository#

Open-source code hides in more places than a dependency file shows. Package manifests list what the build pulls in, but many repositories also carry third-party code directly in the tree, often added years ago by engineers who have since left.

Build the list by searching the repository, not by asking the team to remember. License files, copyright lines naming other organizations and directory names are the fastest leads.

  • Vendored folders: libraries copied into the repo, often under vendor, third-party or lib directories.
  • Committed dependencies: node_modules or similar folders checked in at some point and never removed.
  • Copied snippets: functions pasted from public answers, blog posts or other projects, sometimes with license headers stripped.
  • Forks: internal forks of open-source projects with company patches layered on top.
  • Generated code: output from open-source generators that can carry template text from the tool.
  • SDKs and samples: vendor SDKs, sample apps and test fixtures copied from documentation.
  • Assets and data: fonts, icons, test datasets and schemas under their own licenses.
  • Customer-owned code: customizations or integrations built under statements of work that assign ownership to the customer. It is not open source, but it is not yours to license either.

Exclude, mark or include: deciding component by component#

Each third-party component gets one of three treatments, decided by its license, how entangled it is with your code and what the buyer needs. Counsel and engineering decide together, and every decision is recorded in the package manifest.

Excluding a component removes its files, not its traces. Imports, configuration and calls into the library remain in first-party code, which is normal and expected; what matters is that the library's own source does not ship.

Exclude, mark or include: deciding component by component
ComponentTypical treatmentReason
Vendored library, unmodifiedExcludeThe public version is available elsewhere; you have no rights to grant
Committed dependency foldersExcludeBulk third-party code adds noise and license questions
Internal fork with company patchesInclude the company's patches, marked; exclude upstream codePatches are first-party work; upstream code is not
Copied snippet inside a first-party fileRemove or rewrite; mark and disclose if it must stayHard to separate cleanly; never present it as owned
Commercial SDK or licensed componentExcludeVendor licenses usually forbid redistribution
Customer-owned customizationExcludeThe statement of work gave ownership to the customer
Copyleft componentExclude unless counsel approvesHow its obligations apply to AI training is unsettled

How buyers check for open-source contamination#

Buyers check for open-source contamination by scanning delivered code for license headers and notices, matching files and snippets against public repositories, and comparing the results with the supplier's manifest. A mismatch between manifest and scan does more damage than a known component that was disclosed.

Run the same checks before delivery. Software composition analysis tools and license scanners flag known components and headers, and a plain search for license text and outside copyright lines catches many leftovers. If the company already keeps a software bill of materials for security reviews, start from it, but treat it as a list of declared dependencies rather than proof that nothing else was copied in.

Secret scanning belongs in the same pass. Gitleaks scans git repositories and files for passwords, API keys and tokens, though its maintainer has said it is feature complete and will receive security patches only. TruffleHog scans git and other sources and can log in to confirm whether a found secret is live, which calls for care when it is pointed at third-party systems.

Commit history and code reviews carry open source too#

Commit history, pull request reviews and issue threads can carry open-source code even when the current tree is clean. A diff that added a vendored library years ago, a review comment pasting a fix from an upstream project and an issue quoting a stack trace from a third-party package all travel with the history.

Decide early whether the package is a snapshot of current code or a history of engineering work. Histories are usually more valuable to buyers, and they need filtering: drop commits that only touch excluded paths, trim diffs to first-party files and review pasted blocks in comments. Rewrite history only on an export copy, never on the working repository.

What to disclose and what to promise#

A code license should disclose every known third-party component and promise only what the supplier controls, which is the first-party code in its manifest. Describe the package as first-party code and related engineering records, list excluded paths and known embedded components, and state the method used to find them.

Tie the representations to that manifest. For embedded snippets the supplier could not reasonably detect, a knowledge qualifier and a remove-and-replace remedy are common. Avoid blanket promises that the package contains no third-party code, because few repositories of any age can support that sentence.

The manifest is the document both sides rely on, so keep it specific enough that a buyer's engineer can reconcile it with a scan without calling you.

  • Repository and path for every file or folder in the package.
  • Status of each path: first-party, excluded or marked third-party.
  • Component name and license for each marked or excluded third-party item.
  • The scanning tools and manual checks used, and when they ran.
  • The date range of commit history included, and the filters applied to it.
  • The engineer and counsel who reviewed and approved the final list.

Illustrative: a property management software company scopes its repos#

Illustrative: a fictional property management software company with a long-running GitHub organization wants to license its main application repository, pull request reviews and linked Jira issues. A first scan finds a committed node_modules folder from an early version, a vendored PDF library, an internal fork of an open-source scheduling component and scattered snippets carrying other organizations' copyright lines.

The CTO's team excludes the committed dependencies and the vendored library, includes only the company's own patches on the fork with clear markers, and removes or rewrites the snippets. History on the export copy is filtered to first-party paths. The final manifest lists every excluded path and marked file, and the company's representation covers the manifest, with a knowledge qualifier for anything the scans missed.

How SourceX scopes code packages#

SourceX scopes code in the Supply and Rights steps of the SourceX five-step transaction, starting from metadata: repositories, languages, years of history and known third-party components. No code is shared during the initial assessment.

For packages that proceed, the SourceX Evidence Packet notes which paths were excluded and why, next to the provenance, licensing rights, permitted use, privacy record and release authorization it always carries. Buyer and supplier then work from the same manifest.

Frequently asked questions

Does using open-source libraries in our product stop us licensing our code?

No. Using libraries through imports and package managers is normal, and your own code that calls them remains yours. The issue is third-party source sitting inside the package you deliver, which you exclude or mark.

Is code our engineers wrote with AI coding assistants first-party?

It is usually treated as company work product, but the law on AI-generated code and the assistant vendor's terms both matter. Note in the manifest if assistants were widely used, and let counsel assess whether any vendor terms affect licensing.

What if we cannot tell whether a snippet came from open source?

Remove or rewrite it if it is small, mark it if it must stay, and disclose the uncertainty. Buyers react better to a disclosed unknown than to a clean promise that their own scan later contradicts.

Can we include permissively licensed components if we keep the notices?

Sometimes, but it rarely helps. Permissive licenses generally allow redistribution with notices, yet your license to a buyer cannot grant more than the original license does, and the buyer can obtain the public version anyway. Excluding the component is usually cleaner; if it must stay, keep its notices and mark it as third-party.

Do our contributions to public open-source projects belong in the package?

Usually not. Code already contributed upstream is published under the project's license and available to anyone. Internal discussions about those contributions, such as design reviews, may still be first-party records worth including.

Should we remove secrets and customer data at the same time?

Yes. Credentials, customer names in test fixtures and production data in seed files should be removed in the same preparation pass, from both the tree and the history of the export copy.

Sources

  • Gitleaks is an MIT-licensed tool for detecting secrets such as passwords, API keys and tokens in git repositories, files and stdin. As of July 2026, its default configuration contains 222 detection rules. Source
  • TruffleHog, an AGPL-3.0 open-source secret scanner from Truffle Security, says it classifies over 800 secret types. For each secret it can classify, it can log in to confirm whether the secret is live, and it scans sources including Git, chats, wikis, logs, object stores and filesystems. Source
  • On May 21, 2026, the gitleaks README was updated to state that "Gitleaks is feature complete," that future releases will be security patches only, and that the maintainer is shifting focus to Betterleaks. Source

Related resources

See if your company qualifies

A short company assessment. No data uploads are needed.

See if you qualify