What Does MPL-2.0 Require When an AI Assistant Copies Code Into One of Your Files?
MPL-2.0 applies copyleft at the file level. If an AI assistant reproduces MPL-2.0 code inside a file, that file may carry notice, source availability and licence-preservation duties, and those duties differ for modified files, new files and larger works. The exact obligations come from the licence text and should be confirmed with qualified counsel. The operational problem is that the trigger happens at insertion, usually with no visible licence signal, so detection and policy decisions need to happen at that moment.
Enforcement points that make generation-time handling practicable
- 1
Identify origin
Evaluate generated code for matches against known licensed sources and for any licence metadata available, at the time of generation.
- 2
Resolve licence and context
Associate the match with a licence and with security context, so the decision is not made on similarity alone.
- 3
Apply policy
Allow, redact, block or escalate for human approval, using rules that reflect counsel's reading of the licence.
- 4
Track the file change
Record which file was changed, whether it was new or modified, and what notices it carries.
- 5
Retain evidence
Keep the match result, the decision and the approver, with retention settings that fit your audit needs.
Facts needed for each AI-assisted insertion
- Which file received the code, and whether the file is new or pre-existing
- Whether the inserted code matches known licensed code, and which licence applies
- Whether the change modifies a file that already carries licence notices
- Whether the file is distributed outside the organisation
- What policy decision was applied at insertion, and who approved any exception
- Where the record of that decision is retained and who can access it
Why file-level scope changes the question
MPL-2.0 is a copyleft licence whose obligations attach at the level of the file, not the whole project. That distinguishes it from broader project-level copyleft licences, where the practical question is usually how far the licence reaches across a combined work. With MPL-2.0 the first question is narrower: did code under this licence end up in this file, and if so, what does that make the file?
The licence text answers that through its definitions, including Covered Software and Modifications. Those definitions determine when a file is treated as covered, and the obligations that follow fall into familiar categories: notices, availability of source code for the covered file, and preservation of the licence. How each applies differs depending on whether the insertion modifies an existing file, lands in a new file, or sits inside a larger work that combines files under other terms.
This guide does not restate the licence clause by clause. Read the licence text directly, and have qualified counsel confirm how it applies to your distribution model. What follows is the engineering side: what has to be known, and when, for those answers to be usable.
What is clear from the text and what is still open
Two kinds of question get mixed together in this topic, and it helps to keep them apart.
The first kind is answerable from the licence: if MPL-2.0 code is present in a file and that file is distributed, which duties apply, and how do they change for a modified file versus a new one? Counsel can answer these against the actual wording, and the answers should be written into internal policy.
The second kind is not settled. Whether and how copyright and licence terms attach to AI-generated output, and how training on copyrighted material is treated, remain under active policy examination. The US Federal Trade Commission, for example, has commented to the US Copyright Office on the scope of copyright in works generated with AI tools and on the use of copyrighted materials in training. Treat these as open questions. A sound control design does not depend on resolving them. It depends on knowing when code that looks like licensed code has entered a file, and handling it under a stated policy.
Why after-the-fact review falls short
The obligation question arises when the code lands in the file. A later pull request review sees a diff, not an origin. A reviewer looking at a clean-looking function has no reliable way to tell whether the assistant wrote it fresh or reproduced it from licensed code, and an assistant that inserts code without attribution leaves no licence signal to find.
There is also a security framing that points the same way. NIST AI 600-1 treats the integrity of generative AI code as part of information security for these systems, and NIST SP 800-218A extends secure development practices to cover AI. Even organisations running their own AI governance name output risks such as plagiarism alongside accuracy; the FTC's internal AI policy does so. None of these is a licence-compliance control, but they support treating AI-inserted code as a security-relevant artefact with its own origin and handling requirements, rather than as ordinary developer-typed text.
The practical consequence is that detection and decision-making belong in the execution path of the coding assistant, before the write, and not in a periodic scan of the repository afterward.
Where Trussed fits
Trussed enforces policy in the execution path of coding assistants, alongside models, agents, tools and MCP servers. Decisions are enforced at runtime, not reviewed after the fact, and the available actions are allow, redact, block, rate limit and escalate for human approval. The scope is individual interactions and tool calls.
Trussed also provides code provenance: the origin, licence and security context of code. For the MPL-2.0 case, that means a policy decision on an insertion can draw on where the code came from and which licence applies, rather than on a reviewer's judgement after the merge. Enforcement generates audit-ready evidence of what was enforced, so a team can show later how an obligation was identified and handled.
Trussed can be deployed self-managed in the customer cloud, with configurable retention and data residency, which matters when evidence about source code must stay inside your own boundary. It does not replace legal interpretation of the licence. Counsel decides what the policy should say, and Trussed enforces it and records the result.
From insertion to evidence
Insertion
The assistant writes code into a file, possibly matching licensed code.
Licence determination
The origin and licence of the code are identified before it lands.
Policy decision
Allow, redact, block or escalate for human approval.
Evidence
The decision and its basis are retained per change.
Put licence handling in the path of your coding assistants
Talk through how code provenance, runtime policy enforcement and audit-ready evidence apply to your coding assistant workflows.
Request a Demo