Resources / Code generation
AI-generated code and open-source licenses: a compliance checklist
Can AI-generated code break open-source licenses? What the real risks are, and a practical checklist: dependency scanning, snippet matching, policies and records.
AI coding tools learned from public code, much of it under open-source licenses. That raises a practical question for any team shipping AI-written code: could it bring in license obligations you didn't agree to? This guide covers where the real risk is and what to do about it. It is not legal advice; for decisions that matter, ask a lawyer who knows your situation.
Where the risk actually is
There are three different things people worry about, and they need different controls:
- Dependencies the AI adds. The model writes
npm install some-packageor adds a line torequirements.txt. That package has a license, and so do its dependencies. This is by far the most common way license obligations enter a codebase, AI or not. - Copied snippets. Occasionally a model reproduces a recognisable block of existing code. If that code is under a copyleft license such as the GPL, using it can carry obligations.
- Ownership of the generated code itself. Whether you can claim copyright in code an AI wrote is a separate question, covered in who owns AI-generated code.
A compliance checklist
1. Scan dependencies on every change
Run a software composition analysis (SCA) or license scanner in CI. It lists every direct and transitive dependency with its license and fails the build on licenses you've decided not to allow. This catches the biggest source of risk automatically, regardless of who — or what — added the dependency.
2. Write down an allowlist
Decide once which licenses are fine (commonly MIT, BSD, Apache-2.0, ISC), which need review (for example LGPL, MPL) and which are blocked for your product (often GPL or AGPL for closed-source software you distribute or run as a service). Put the list in the repository so both people and tools follow it.
3. Turn on public-code filters where your tool has them
Some AI coding assistants can block suggestions that closely match public code, or show where a match came from. Turn it on for production repositories.
4. Check long, unusually specific blocks
Short, generic code (a loop, a fetch call, a sort) isn't the concern. A long block that implements a well-known algorithm in a distinctive way, or includes comments and names that look like they came from a specific project, deserves a search before you merge it. Snippet-matching tools can automate this.
5. Keep records
Note which tools generated which changes (commit messages or PR labels are enough), keep CI scan results, and keep the allowlist under version control. If a question ever comes up, a record of your process is worth more than a promise that nothing went wrong.
6. Know your vendor's terms
AI tool vendors differ in what they promise about generated output — some offer indemnity on certain plans, usually conditional on settings such as public-code filters being on. Read the terms for the plan you actually pay for.
What this means day to day
For most backend code — glue between APIs, validation, database queries — the practical risk is the dependencies, not the generated lines. Automate dependency checks, set a clear policy, and review the rare long block that looks borrowed.
On Wisp
Wisp shows every package a project uses on its packages page and keeps each change as a numbered version with its summary, so you have a record of what was added and when. Projects can also be mirrored to GitHub, where your existing license scanners run on every commit.
Build it with Wisp — describe an API, get it live.