Contents
Open-source licenses matter far more for AI-generated code than many companies realise: AI tools can reproduce code fragments from their training data, and coding agents add libraries with their own licence terms on their own. If you distribute software or publish apps, you should understand both risks and secure them with clear processes. This article gives a practical overview – it is not legal advice.
Why Open-Source Licenses Matter for AI-Generated Code
Large language models for code were trained to a considerable extent on publicly available source code released under a wide range of open-source licences. In the vast majority of cases the models generate new code that combines patterns but is not a recognisable copy. In individual cases, however, longer passages can be reproduced almost verbatim – for example well-known algorithms or frequently copied blocks of code.
The second risk, often the bigger one in practice, is less well known: coding agents install packages on their own to solve a task. Every new dependency brings its licence – and possibly further transitive dependencies with yet other licences. Without control, a licence landscape grows that nobody consciously chose.
The Main Licence Types at a Glance
For risk assessment, what matters is which family a licence belongs to:
| Licence type | Examples | Typical obligations | Risk for proprietary software |
|---|---|---|---|
| Permissive | MIT, BSD, Apache 2.0 | Keep copyright notice and licence text; Apache 2.0 adds change notices and patent terms | Low if notice obligations are met |
| Weak copyleft | LGPL, MPL 2.0 | Disclose changes to the library itself; integration into your own software usually possible | Medium, depending on how it is integrated |
| Strong copyleft | GPL | Provide derivative works under the same licence, including source code, when distributed | High for distributed software and apps |
| Network copyleft | AGPL | Source code obligations also apply when software is offered over a network, e.g. as SaaS | High, even for pure web services |
Whether and when copyleft obligations actually apply depends on how code is linked, how it is distributed and how the case is interpreted. When in doubt, seek qualified legal advice.
Typical Risk Scenarios in Practice
- Verbatim code: an AI suggestion largely matches a function from a GPL project. If this code becomes part of a distributed app, licence obligations may arise without anyone noticing.
- Dependency added by an agent: to solve a problem, a coding agent installs an AGPL-licensed library into a SaaS backend.
- Removed licence notices: during AI-assisted refactoring, licence headers in third-party files get lost. That breaches the notice obligation even if the licence is permissive.
- Copied snippets from forums: code from Q&A platforms is often under its own licence with an attribution requirement – even when it lands in the project via an AI conversation.
Closely related is the question of who actually owns AI-generated code. We cover these copyright aspects in copyright in AI-generated code.
Measures: How to Protect Your Company
- Define a licence policy: create an allowlist of permitted licences (e.g. permissive ones), a list requiring review (e.g. LGPL, MPL) and a list of prohibited licences for certain product types (e.g. AGPL for SaaS).
- Use tool settings: some AI coding tools offer filters or warnings when suggestions closely match public code. Check which options your tool provides and enable them.
- Restrict agents: specify in project rules and permissions that coding agents may not add new dependencies without approval.
- Automate licence scans: software composition analysis and licence scanners in the CI pipeline detect new dependencies and their licences on every merge.
- Maintain a software bill of materials: an SBOM documents all components and licences. The EU Cyber Resilience Act requires manufacturers of products with digital elements to document the components they use, among other things – see NIS2 and the Cyber Resilience Act.
- Extend the review checklist: questions such as "New dependency? Licence checked?" and "Unusually polished, self-contained code block?" belong in every review checklist.
- Check contracts: clarify what assurances your AI vendor gives regarding third-party rights and under which conditions they apply.
These points integrate well into an overarching AI governance framework for development teams.
What Clients Should Ask Their App Agency
If you commission an app, you as the publisher are ultimately responsible for the released software. Ask your provider specifically:
- How do you ensure that AI-generated code does not trigger licence obligations?
- Will we receive a list of all dependencies with their licences?
- Are licence notices (e.g. in the app's settings) fully implemented?
- Are all rights to the custom-developed source code transferred to us?
At app-entwickeln-lassen.de, clients receive 100 % ownership of the source code. Why this matters so much is explained in source code ownership and usage rights.
Planning an app? Request a free fixed-price quote in 2 minutesConclusion
AI-generated code is not automatically a licensing problem, but it increases the likelihood of unnoticed licence violations – above all through automatically added dependencies. A clear licence policy, restricted agent permissions, automated licence scans, a maintained SBOM and an updated review checklist keep the risk manageable. For the legal assessment of specific cases, consult qualified advisers; this article is not legal advice.
Frequently Asked Questions
Can AI-generated code violate open-source licences?
Yes, for example if a suggestion largely reproduces licensed code or an agent adds libraries with restrictive licences. Filters, scans and reviews reduce the risk significantly.
Which open-source licences are particularly critical for commercial apps?
Strong copyleft licences such as the GPL and network copyleft licences such as the AGPL require special attention. Permissive licences like MIT or Apache 2.0 are usually unproblematic if notice obligations are met.
What is an SBOM and do I need one?
An SBOM (software bill of materials) lists all components of a piece of software with versions and licences. It supports licence compliance and security and is becoming more important with the Cyber Resilience Act.
Should coding agents be allowed to install packages on their own?
Preferably not without approval. Require new dependencies to be checked for licence, maintenance status and security before merging.