Open in VS Code: From your cloned
s26-06643repository, run in the terminal:code sse/optional/ethics-copyright/ethics-copyright.ipynb
Ethics, Copyright, and Licensing in AI-Assisted Development#
As AI tools become central to how we write software, we need to understand the legal and ethical landscape around AI-generated code. This lecture covers copyright law as it applies to AI outputs, open-source licensing, data privacy when using AI tools, and responsible use practices.
This is a rapidly evolving area. The goal is not to give you definitive legal answers, but to equip you with the frameworks and awareness to navigate these issues as they develop.
Section 1: Who Owns AI-Generated Code?#
The Thaler v. Perlmutter Ruling#
In a landmark case, Stephen Thaler sought to register a copyright for a work created entirely by his AI system, DABUS. The U.S. Copyright Office refused registration, and the courts upheld that decision all the way through the D.C. Circuit. On March 2, 2026, the Supreme Court declined to hear the case, cementing the rule: purely AI-generated works cannot be copyrighted under current U.S. law. Human authorship is required.
The Spectrum of Human Involvement#
In practice, most AI-assisted code falls somewhere on a spectrum:
Level |
Description |
Likely Copyrightable? |
|---|---|---|
Purely AI |
Prompt AI, use output verbatim |
No |
AI-drafted, human-edited |
AI generates, human substantially revises |
Probably yes |
Human with AI autocomplete |
Human writes, AI fills in lines |
Yes |
Human-authored |
Human writes everything, no AI |
Yes |
The key concept is “significant human input.” The Copyright Office has indicated that the human must exercise creative control — selecting, arranging, and modifying AI output in ways that reflect original expression.
Why This Matters#
If your code is not copyrightable, you cannot enforce a license on it. This has real implications:
Anyone could use your AI-generated code without restriction
You cannot prevent others from copying it
Open-source licenses (which rely on copyright) may not apply to purely AI-generated portions
Patent protection may still be available for novel algorithms, but that is a separate (and expensive) process
Exercise 1: Can You Copyright This?#
Discuss with a neighbor: which of these scenarios likely produce copyrightable code?
(a) You prompt an AI: “Write a Python function to calculate the Fibonacci sequence” and use the output verbatim.
(b) You prompt an AI to write a data processing pipeline, then substantially rewrite the output — changing the algorithm, adding error handling, restructuring the flow.
(c) You write a class by hand, and your AI autocomplete fills in individual lines as you type.
(d) You write a detailed specification of a novel algorithm (pseudocode, edge cases, data structures), and the AI implements it exactly to your specification.
There are no definitive answers yet — the courts are still working this out. But thinking through these scenarios helps you understand the spectrum.
Section 2: Open Source Licensing#
Why Licenses Matter#
A common misconception: “If code is on GitHub, it’s free to use.” Wrong. Code with no license is not open source — it is “all rights reserved” by default. The author retains full copyright, and you technically cannot use, modify, or distribute it without permission.
The Main Open Source Licenses#
Licenses fall into two broad categories:
Permissive licenses — minimal restrictions:
License |
Key Requirements |
|---|---|
MIT |
Include copyright notice and license text |
BSD 2-Clause |
Include copyright notice and license text |
Apache 2.0 |
Include notice, state changes, include NOTICE file; grants patent rights |
Copyleft licenses — require derivative works to use the same license:
License |
Key Requirements |
|---|---|
GPL v3 |
Derivative works must also be GPL; must provide source code |
LGPL v3 |
Like GPL but allows linking from non-GPL code (common for libraries) |
AGPL v3 |
Like GPL but also applies when software is accessed over a network |
Choosing a License#
For most scientific Python packages, MIT or BSD 3-Clause are common choices — they are simple, well-understood, and impose minimal burden on users. If you want to ensure your code (and all derivatives) remain open, choose GPL.
A helpful resource: https://choosealicense.com
AI and Licensing: Open Questions#
When AI tools generate code, several licensing questions arise:
AI modifying licensed code: If an AI agent modifies GPL-licensed code, the modifications are likely still bound by the GPL — the license follows the code, not the author.
AI reproducing licensed code: If an AI tool outputs code that closely matches GPL-licensed training data, are you bound by the GPL? This is legally untested, but the safe answer is yes — if the output is substantially similar to copyrighted code, you should comply with its license.
The Copilot lawsuit (Doe v. GitHub): A class-action lawsuit alleges that GitHub Copilot reproduces open-source code without proper attribution or license compliance. Copyright claims were dismissed, but breach-of-contract and DMCA claims survive. As of early 2026, the case is still in discovery. The outcome could reshape how AI coding tools handle licensed training data.
When AI-Generated Code Has No Copyright Holder#
Open source licenses are copyright licenses — they function by granting permissions that a copyright holder has the right to grant. If no copyright exists (because the code is purely AI-generated), the license is a legal nullity. This creates specific vulnerabilities:
Permissive licenses (MIT, BSD) become redundant. You cannot enforce attribution or any other term if you hold no copyright. The code is effectively public domain, which is more permissive than MIT anyway.
Copyleft (GPL) is especially vulnerable. GPL’s viral propagation depends entirely on copyright. AI-generated portions incorporated into a GPL project cannot be “infected” by the copyleft requirement — creating potential licensing holes that allow proprietary use of those portions.
Proprietary code is also exposed. If portions of a proprietary codebase are purely AI-generated (and therefore public domain), competitors could freely copy those portions.
The practical takeaway: if you want your license to hold up, ensure meaningful human creative involvement in the code — review, modify, and refactor AI output rather than using it verbatim.
Exercise 2: License Detective#
Pick 3 Python packages you commonly use (e.g., requests, numpy, pytest, pandas, scikit-learn). For each one:
Find the license (check PyPI or the GitHub repository)
What does each license require of you?
If your project depends on a GPL-licensed package, what does that mean for your project’s license?
Bonus: Ask your AI agent: “What license should I use for a scientific Python package?” Does it give good advice? Does it mention the trade-offs?
Section 3: The “Codewashing” Problem#
The interaction between AI’s lack of copyright and its training on copyrighted data creates a potential copyright laundering vector:
Feed copyrighted code to an LLM (in-context or via training)
Prompt it to rewrite or reimplement the code
Publish the output — which has no human author and therefore no copyright holder
This could theoretically strip the original copyright, since the output is a new artifact with no copyright holder, and the LLM’s transformation may obscure the derivation.
Case Study: The chardet Relicensing Dispute (2026)#
In March 2026, the chardet Python library — a widely used character encoding detector — became a high-profile example of these tensions. Dan Blanchard, who had maintained chardet since 2012, released version 7.0.0 as a complete rewrite under the MIT license. The original code, created by Mark Pilgrim in 2006, was licensed under the LGPL (a copyleft license).
Blanchard described the rewrite as a “clean room” reimplementation: he worked “in an empty repository with no access to the old source tree” and “explicitly instructed Claude not to base anything on LGPL/GPL-licensed code.” Plagiarism detection tools showed only 1.29% similarity between the old and new code, compared to 80-93% between traditional releases.
Pilgrim objected publicly, arguing the maintainers had “no right to relicense this project.”
This case illustrates every tension in this section simultaneously:
Deep familiarity problem: Blanchard maintained the code for over a decade. Can anyone who has read and modified a codebase for that long produce a truly “independent” reimplementation?
Training data contamination: Claude was almost certainly trained on the original chardet source code. Can an AI that has seen the LGPL code produce output that is genuinely independent of it?
Clean room failure: Traditional clean-room reimplementation requires strict separation between the team that reads the original and the team that writes the replacement. An LLM that was trained on the original categorically fails this separation.
Process vs. outcome: The plagiarism detection score (1.29% similarity) suggests the output is different. But the process involved an AI trained on the original and a human steeped in the original’s design. Which matters more legally?
The case is unresolved as of early 2026, but it demonstrates that AI-assisted “clean room” relicensing is not as clean as it appears.
Why it might work#
The output is a new artifact with no copyright holder to enforce against
Proving the output is a derivative work requires showing substantial similarity, which is hard when LLMs paraphrase at a semantic level
No human author means no one to sue for the copying act itself
Why it probably doesn’t fully work#
Input-side infringement. Feeding copyrighted code to an LLM without a license may itself be infringement, regardless of the output. LLM training data cases (Doe v. GitHub, NYT v. OpenAI, Authors Guild v. OpenAI) have not given a blanket pass here.
Substantial similarity survives paraphrasing. Courts assess structure, sequence, and organization (SSO) — not just literal copying. Identical architecture can still infringe even with no verbatim lines.
Clean room defense fails. Traditional clean-room reimplementation requires strict separation from the original. An LLM shown the original in-context (or trained on it) categorically fails this test.
Intermediate copying doctrine. Courts (Sega v. Accolade) have ruled that temporary copying for analysis can constitute infringement. Passing code through an LLM context window is a form of copying.
The unresolved gap#
Current rulings address the output side (no human author → no copyright) without fully resolving the input side (was feeding it to the LLM infringement?). These two threads have not been adjudicated together, leaving the codewashing loophole unaddressed.
This is why tools like GitHub Copilot filter outputs that are too similar to training data, and why companies like Google and Amazon have offered legal indemnification for AI-generated code — tacit acknowledgment that the exposure is real.
Section 4: Data Privacy and AI Tools#
Where Does Your Code Go?#
When you paste code into an AI chatbot or use an AI coding assistant, your code is sent to remote servers for processing. Depending on the tool and your plan, this data may be:
Stored temporarily for processing and then deleted
Retained for abuse monitoring
Used to train or improve future models
The policies vary significantly by tool and subscription tier. Free-tier tools are more likely to use your inputs for training.
What NOT to Paste into AI Tools#
Be especially careful with:
API keys and credentials — these can be leaked or logged
Proprietary source code — check your employer’s policy first
Patient data or PII — HIPAA, FERPA, and GDPR violations can result from exposing personal data
Export-controlled research — ITAR/EAR regulated code should never go to external services without authorization
Trade secrets — once shared with an external service, trade secret protection may be waived
Best Practices#
Use enterprise or team plans that explicitly exclude your data from training
Consider local models (e.g., Ollama, llama.cpp) for sensitive work
Strip sensitive data before sharing code for debugging
Check your institution’s AI use policy — many universities and companies now have one
Exercise 3: Read the Fine Print#
Pick one AI tool you use (Claude, GitHub Copilot, ChatGPT, or another) and look up its current terms of service or data usage policy. Try to answer:
Does the company train on your inputs?
Who owns the output?
How long is your data retained?
Is there a difference between free and paid tiers?
Compare your findings with a neighbor who looked up a different tool. Were you surprised by anything?
Section 5: Responsible Use and Professional Ethics#
Over-Reliance#
AI tools can make you faster, but they can also erode your skills if you are not careful:
If you always accept AI suggestions without understanding them, you lose the ability to write and debug code independently
AI can produce plausible-looking code that is subtly wrong — you need the expertise to catch this
In job interviews, you will need to demonstrate understanding, not just the ability to prompt an AI
The goal of this course is to use AI as a tool, not a crutch. You should be able to explain every line of code in your projects.
Attribution#
When should you credit AI assistance?
In academic work: follow your institution’s and instructor’s policies (this course requires AI use, but you must understand and explain everything)
In publications: many journals now require disclosure of AI tool usage
In professional code: check your team’s conventions; at minimum, document AI use in commit messages or comments when it has contributed significantly
Environmental Impact#
AI has a real environmental footprint:
Training GPT-3 produced an estimated 502 metric tons of CO2
Every query to an LLM uses compute resources — inference costs add up at scale
Being efficient with your prompts is not just about saving time — it reduces energy consumption
This is not a reason to avoid AI tools, but it is a reason to use them thoughtfully rather than wastefully.
Section 6: AI in Academia#
AI in Academic Writing#
The rules around AI in academic writing are still being established, and they vary widely:
Some journals ban AI-generated text entirely
Others allow it with disclosure
Most agree that AI cannot be listed as an author (it cannot take responsibility for the work)
AI in Peer Review#
Using AI to assist with peer review raises ethical concerns:
Manuscripts under review are confidential — uploading them to AI tools may violate this
AI review may miss domain-specific nuances or introduce biases
Many conferences and journals have explicitly prohibited using AI for peer review
AI-Generated Figures and Data#
If AI generates figures, data visualizations, or synthetic data, this should be disclosed. Reproducibility requires that others know how your outputs were produced.
This Course’s Policy#
In this course:
AI use is required — it is a core tool we are teaching
You must understand and be able to explain everything you submit
You must be able to modify and extend AI-generated code when asked
The goal is AI-augmented competence, not AI-dependent output
What Does “Your Own Work” Mean in 2026?#
This is perhaps the deepest question. A carpenter who uses a power saw still builds the house. A writer who uses spell-check still writes the book. An engineer who uses AI to write code still engineers the software — as long as they understand it, can explain it, and take responsibility for it.
Exercise 4: Ethical Scenarios Discussion#
In small groups, discuss the following scenarios. What would you do? What are the competing considerations?
(a) You ask an AI to write a security-critical authentication function for a medical device. The code looks correct. What is your obligation before deploying it?
(b) Your AI coding assistant generates a function that is clearly a near-verbatim copy from a GPL-licensed project. You can tell because it includes a comment referencing the original project. What should you do?
(c) You are writing a research paper and AI drafts the methods section based on your bullet points. How do you handle authorship and disclosure?
(d) A colleague pastes proprietary client data into ChatGPT to help debug a data processing issue. What do you say to them?
Summary#
Topic |
Key Takeaway |
|---|---|
Copyright |
Purely AI-generated works are not copyrightable; human authorship is required |
Licensing |
Code without a license is “all rights reserved”; choose a license for your projects |
AI + Licensing |
Open source licenses depend on copyright; AI-generated code with no copyright holder may make licenses unenforceable |
Codewashing |
Feeding copyrighted code through an LLM to strip copyright likely fails on input-side grounds, but the legal gap remains open |
chardet case |
AI-assisted “clean room” relicensing is legally uncertain — training data contamination and deep familiarity undermine independence claims |
Data Privacy |
Be careful what you paste into AI tools; check the terms of service |
Responsible Use |
Understand your code, attribute AI assistance, consider environmental impact |
Academia |
Disclose AI usage; understand your institution’s policies |
Tips and Tricks#
Check the license before using any package:
pip show [package]displays the license — make this a habit.Prompt: “What license should I use for [project type]?”: AI gives reasonable recommendations but always verify the trade-offs yourself.
Add a LICENSE file on day one: An unlicensed repo is “all rights reserved” by default — pick a license before sharing code.
Prompt: “Audit this code for potential license compliance issues”: AI can flag patterns that look like they came from specific open-source projects.
Never paste credentials into AI chat: If your code has API keys, redact them before sharing — even with paid tools.
Review your AI tool’s data policy annually: Terms change — what was private last year may be used for training now.
Disclose AI usage in academic work: When in doubt, over-disclose — it is better to be transparent than to face plagiarism concerns later.
Treat AI output as a draft under your name: You are responsible for everything you submit, regardless of who (or what) wrote the first version.
Foundational Concepts to Commit to Memory#
Purely AI-generated works are not copyrightable under current U.S. law — human authorship is required. The Supreme Court declined to hear the Thaler case in 2026.
Code with no license is “all rights reserved” — it is not open source. You cannot legally use, modify, or distribute it without the author’s permission.
MIT and BSD are permissive licenses (minimal restrictions). GPL is copyleft (derivative works must also be GPL). Know the difference.
Open source licenses depend on copyright. If AI-generated code has no copyright holder, the license may be unenforceable — copyleft (GPL) is especially vulnerable since its viral propagation requires copyright to function.
“Codewashing” = feeding copyrighted code through an LLM to strip copyright. It likely fails on input-side infringement grounds, but the output-side / input-side interaction has not been adjudicated together.
If AI reproduces licensed code, you should comply with that license — the license follows the code, not the author.
Never paste API keys, credentials, PII, or proprietary code into AI tools without understanding the tool’s data retention and training policies.
AI cannot be listed as an author on academic publications — it cannot take responsibility for the work.
“Significant human input” is the key concept for copyrightability — selecting, arranging, and modifying AI output to reflect original expression.
Disclosure of AI usage is increasingly required in academic publications, professional code, and institutional policies. When in doubt, disclose.
Knowing vs. Doing: Reflection#
Ethics and copyright might feel like topics you can afford to learn “when you need them.” But unlike a missing feature or a slow function, ethical and legal mistakes often cannot be fixed after the fact. You cannot un-share confidential data with an AI tool. You cannot retroactively add a license to code that has already been copied without one. You cannot undo a plagiarism accusation by saying you did not know the AI was reproducing GPL-licensed code. This is an area where knowing the landscape — even at a high level — protects you in ways that no amount of after-the-fact learning can.
The tension here is different from other topics in this course. With classes or databases, the risk of “learning too much before doing” is wasted time. With ethics and legal issues, the risk of “doing too much before learning” is real harm — to your reputation, your institution, or other people. That does not mean you need a law degree. It means you need to internalize a small set of principles: check the license, disclose AI usage, protect sensitive data, and ensure you can explain and take responsibility for your code. Those principles fit on an index card, and they will serve you for years.
AI agents can actually help you navigate this space — they can check license compatibility, draft disclosure statements, and flag potential issues in your workflow. But they cannot make ethical judgments for you, and they cannot take responsibility for your decisions. The value you bring is not legal expertise. It is the willingness to pause and ask “should I?” before asking “can I?” That habit of reflection is what separates a responsible practitioner from someone who just ships code.
Additional Resources#
U.S. Copyright Office: AI-Generated Works Guidance — the Copyright Office’s guidance on registering works containing AI-generated material
Choose a License — a simple guide to choosing an open-source license for your project
OSI Open Source Definition — the Open Source Initiative’s definition of what qualifies as open source
The Doe v. GitHub/Copilot Lawsuit — information on the class-action lawsuit over AI code generation and open-source licensing
The chardet Relicensing Dispute — Simon Willison’s analysis of the chardet LGPL-to-MIT relicensing via AI-assisted “clean room” rewrite, illustrating the tensions between AI code generation, training data contamination, and copyleft licensing