Ethical issue: copyright when using third-party and AI-generated code

Tip: Choose Save as PDF in the print dialog to download. Use A4 paper size.

Ethical issue: copyright when using third-party and AI-generated code

Name:
Date:
Class:

Quick Questions

Shade in the A or B circle for each question.

1. A developer copies a code snippet from a public forum into a client's app without checking the licence. Is this safe?
A No, it may breach copyright and is an ethical issue
B Yes, anything posted publicly is free to use
2. Which action best avoids copyright problems when using code from a repository?
A Check the licence and follow its conditions
B Delete the licence file and keep the code
3. An AI tool generates code that closely matches a licensed open-source project. What is the risk?
A There is no risk because an AI wrote it
B The output may reproduce licensed work and breach copyright
4. A student uses AI to help write part of their SAC solution. What is the ethical approach?
A Acknowledge that AI was used and check the output
B Hide the AI use and present all code as your own
5. Who is responsible if a company ships software containing unlicensed copied code?
A Nobody, because the code was found online
B The organisation, as well as the developer who added it

Match the Pairs

Draw a line connecting each item on the left to its match on the right.

Left columnRight column
1# Copied from a forum post, no licence checked AAcknowledging AI use and verifying that the output does not reproduce licensed work is ethical practice.
2# Generated by AI, checked against licence B// TODO: search AI snippet for matching licensed code
3AI output can reproduce licensed work, so developers should check where the code came from before using it. CAssuming AI-generated code is automatically safe. It can reproduce licensed work, so its source and licence still need checking.
4Organisations are responsible for making sure the code in their software has a clear source and licence. Dlicence_check(all_code) -> record_source
5paste forum_code into app # it is public, so it is free to use EAssuming code is free to use just because it is publicly visible. Public code can still be copyrighted and have licence conditions.
6ship(ai_code) # AI wrote it, so no copyright issue FPasting code from a forum into a project without checking its licence or source can breach copyright.

Definitions

copyright infringement

Fill in the Blanks

Complete each line of code by filling in the missing parts.

1.
# (c) 2023 Jo Park. All rights ________
2.
# Generated by __, reviewed by a developer
3.
usable = licenceChecked ___ sourceKnown
4.
if ___ licenceChecked: print('Stop')
5.
aiUsed = ____ # acknowledge in report

Spot the Error

Shade in the letter of the line that contains an error.

Question 1
A snippet = get_forum_snippet()
B lic = check_licence(snippet)
C if lic != "allowed":
D use(snippet)
Question 2
A code = ai_generate(prompt)
B hit = scan_licensed(code)
C if hit == True:
D add_to_project(code)
Question 3
A used_ai = True
B credits = []
C if used_ai:
D credits.remove("AI tool")
Question 4
A def approve_release(code):
B if not code.licence_ok:
C return "approved"
D return "blocked"
Question 5
A licence = read_file("LICENSE")
B if licence != None:
C print("Ask owner first")

Answer Key

Ethical issue: copyright when using third-party and AI-generated code
Section A: Quick Questions
Q1
A — No, it may breach copyright and is an ethical issue
Q2
A — Check the licence and follow its conditions
Q3
B — The output may reproduce licensed work and breach copyright
Q4
A — Acknowledge that AI was used and check the output
Q5
B — The organisation, as well as the developer who added it
Section B: Match the Pairs
Q1
# Copied from a forum post, no licence checked → Pasting code from a forum into a project without checking its licence or source can breach copyright.
Q2
# Generated by AI, checked against licence → Acknowledging AI use and verifying that the output does not reproduce licensed work is ethical practice.
Q3
AI output can reproduce licensed work, so developers should check where the code came from before using it. → // TODO: search AI snippet for matching licensed code
Q4
Organisations are responsible for making sure the code in their software has a clear source and licence. → licence_check(all_code) -> record_source
Q5
paste forum_code into app # it is public, so it is free to use → Assuming code is free to use just because it is publicly visible. Public code can still be copyrighted and have licence conditions.
Q6
ship(ai_code) # AI wrote it, so no copyright issue → Assuming AI-generated code is automatically safe. It can reproduce licensed work, so its source and licence still need checking.
Section C: Definitions
Q1
copyright infringement — Using someone else's code, including AI output that copies licensed work, without checking its source or licence. It can breach copyright and is an ethical issue for developers.
Section D: Fill in the Blanks
Q1
# (c) 2023 Jo Park. All rights reserved
Q2
# Generated by AI, reviewed by a developer
Q3
usable = licenceChecked and sourceKnown
Q4
if not licenceChecked: print('Stop')
Q5
aiUsed = True # acknowledge in report
Section E: Spot the Error
Q1
C — The forum code should only be used when its licence allows reuse. The condition should be lic == "allowed". With != the program uses code whose licence does not permit it, which risks copyright infringement.
Q2
C — AI output should only be added when the scan finds no copied licensed work. The test should be hit == False. As written, code that matches licensed work is the code that gets added.
Q3
D — When AI helped write the code, the use should be acknowledged. The line should be credits.append("AI tool") to add the acknowledgement. Removing it hides the AI use, which is an ethical problem.
Q4
B — The organisation is responsible for what it ships, so only code with a checked licence should be approved. The test should be if code.licence_ok:. With not, unchecked code is approved and checked code is blocked.
Q5
B — If no licence file is found, the developer should stop and ask the owner before using the code. The test should be licence == None. With != the message is shown when a licence exists, and code with no licence slips through unchecked, risking copyright infringement.