Sub topic 2
Permissive and Copyleft Licenses in Brief
Assume you understand Git, code review, and the basic purpose of open-source licenses. This chapter focuses on code produced with an AI assistant. It is general education, not legal advice.
Permissive and copyleft licenses
A permissive license lets you use, modify, and redistribute code with relatively few conditions. Common examples include MIT, BSD, and Apache-2.0. You normally must preserve copyright and license notices. Apache-2.0 also includes conditions about patents and notices.
A copyleft license allows use and modification but requires specific licensing conditions for some redistributed versions. The GNU General Public License (GPL) is a common example. When covered code is distributed in a combined work, the license may require you to provide corresponding source code and grant recipients similar freedoms.
| License family | Typical obligation |
|---|---|
| Permissive | Keep notices and license text |
| Copyleft | Meet license conditions for covered combined or modified works |
The license depends on the source code that an output resembles or reproduces. Calling code “AI-generated” does not remove the original license.
# SPDX-License-Identifier: Apache-2.0
# Copyright (c) 2026 Example Corp.
def clamp(value: float, low: float, high: float) -> float:
return max(low, min(value, high))Training data and memorized output
An AI coding tool may have learned from public repositories, including repositories with different licenses. Training does not automatically prove that a particular output copies protected code. However, an output can still reproduce recognizable code, comments, structure, or license notices from a source project.
Review unusual or highly specific output. Search distinctive lines before accepting them. If the tool identifies a source, follow that source's license instead of assuming the output is unrestricted.
When generated code brings license obligations
Treat copied or near-copied code as third-party code. Record its source, preserve required notices, and check whether combining it with your project changes your distribution obligations. A passing test does not establish license compliance.
Reading tool terms and indemnity offers
Read the tool's current terms for output ownership, reuse rights, training, confidentiality, retention, and indemnity. Indemnity is a contractual promise to handle specified claims or costs, often subject to exclusions, usage limits, and plan requirements. It is not a guarantee that every output is safe to ship.
Exercise
An assistant produces code that closely matches a GPL-licensed repository. Can you ship it under your project's MIT license without further review?
Show answer
No. Identify the matching source, examine the GPL obligations, and decide whether the code can be replaced, separately used, or distributed under compatible terms.