Protecting privacy and confidential code when using AI tools

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

Protecting privacy and confidential code when using AI tools

Name:
Date:
Class:

Quick Questions

Shade in the A or B circle for each question.

1. A student wants help fixing a login bug. Which prompt is safer to send to an AI tool?
A Paste the login code with the real password replaced by "example123"
B Paste the login code including the real admin password so the AI can test it
2. True or false: Anything you type into an AI tool is automatically deleted straight away and can never be stored.
A True
B False
3. You need to test a prompt that sorts customer records. Which data should you use?
A Made-up sample records such as "Jane Citizen, 0400 000 000"
B A real export of your client's names, emails and phone numbers
4. Which item should you NOT paste into an AI tool?
A Your client's confidential source code and database login details
B A short generic loop like for i in range(5): print(i)
5. Before using a new AI tool for your SAC project, what is the best first step?
A Assume it is safe because lots of people use it
B Check the tool's data policy to see how your prompts are stored and used

Match the Pairs

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

Left columnRight column
1password = "Tr0ub4dor&3" AReal personal data was pasted into the prompt. Use a few fake sample rows instead, and check the tool's data policy first.
2name = "Sample User" BA real password hard-coded in a script. Never paste this into an AI tool, as the prompt may be stored or used to train the model.
3Replace real customer details with fake sample data before asking an AI tool for help CAnonymous sample data. It is safe to use in a prompt because it identifies no real person.
4Keep secrets such as API keys out of the code you paste, and load them from a safe place instead DThe prompt contains a real password. Replace it with a placeholder such as "PASSWORD" before pasting.
5Prompt: Fix this code. db_password = "Sch00l#2024" Eemail = "student@example.com"
6Prompt: Here is our client database export with real names and phone numbers. Find the bug. Fapi_key = "YOUR_KEY_HERE"

Definitions

confidential data

Fill in the Blanks

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

1.
import os key = os.______("KEY") print("Key is not in the prompt")
2.
_ Fake data only: no real names or emails name = "Student A"
3.
safe = text._______("Ava", "Student A")
4.
if "password" __ prompt: print("Remove it before sending")
5.
if ___ fake: print("Do not paste this into AI")

Spot the Error

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

Question 1
A # Use fake data in the prompt
B fake_name = 'Test User'
C fake_mail = 'a@example.com'
D prompt = f'Fix {real_name}'
E print(prompt)
Question 2
A import os
B key = os.getenv('API_KEY')
C code = open('app.py').read()
D clean = code.replace('X',key)
E print(clean)
Question 3
A policy_read = False
B if not policy_read
C print('Check data policy')
D print('Do not paste yet')
Question 4
A define is_safe(text):
B bad = ['password', 'tfn']
C for w in bad:
D if w in text.lower():
E return False
F return True
Question 5
A names = ['Ava', 'Liam', 'Mia']
B for i in range(names):
C names[i] = f'Student{i}'
D print(names)

Answer Key

Protecting privacy and confidential code when using AI tools
Section A: Quick Questions
Q1
A — Paste the login code with the real password replaced by "example123"
Q2
B — False
Q3
A — Made-up sample records such as "Jane Citizen, 0400 000 000"
Q4
A — Your client's confidential source code and database login details
Q5
B — Check the tool's data policy to see how your prompts are stored and used
Section B: Match the Pairs
Q1
password = "Tr0ub4dor&3" → A real password hard-coded in a script. Never paste this into an AI tool, as the prompt may be stored or used to train the model.
Q2
name = "Sample User" → Anonymous sample data. It is safe to use in a prompt because it identifies no real person.
Q3
Replace real customer details with fake sample data before asking an AI tool for help → email = "student@example.com"
Q4
Keep secrets such as API keys out of the code you paste, and load them from a safe place instead → api_key = "YOUR_KEY_HERE"
Q5
Prompt: Fix this code. db_password = "Sch00l#2024" → The prompt contains a real password. Replace it with a placeholder such as "PASSWORD" before pasting.
Q6
Prompt: Here is our client database export with real names and phone numbers. Find the bug. → Real personal data was pasted into the prompt. Use a few fake sample rows instead, and check the tool's data policy first.
Section C: Definitions
Q1
confidential data — Private information like personal data, passwords or secret code. Never paste it into an AI tool, as it may be stored or used to train the model. Use fake sample data and check the data policy.
Section D: Fill in the Blanks
Q1
import os key = os.getenv("KEY") print("Key is not in the prompt")
Q2
# Fake data only: no real names or emails name = "Student A"
Q3
safe = text.replace("Ava", "Student A")
Q4
if "password" in prompt: print("Remove it before sending")
Q5
if not fake: print("Do not paste this into AI")
Section E: Spot the Error
Q1
D — real_name is never defined, so this causes a NameError. It also suggests using real personal data in the prompt. The line should use the fake sample value: f'Fix {fake_name}'.
Q2
D — replace(old, new) has its arguments swapped. This would insert the secret key into the code instead of removing it. It should be code.replace(key,'X') so the key is hidden before pasting into an AI tool.
Q3
B — The if statement is missing its colon at the end. It should be: if not policy_read:
Q4
A — Python uses the keyword def to define a function, not define. The line should be: def is_safe(text):
Q5
B — range() needs a whole number, but names is a list, so this causes a TypeError. Use range(len(names)) to loop over each index and replace real names with anonymous labels.