Scenario test · 90 minutes
Decide whether an AI claims assistant may launch
- Review the security file of an unfamiliar AI system and find its gaps
- Complete the file set so that the checker passes, with controls that work outside the model, and add its use case, its links to public lists and its watch list
- Write a launch recommendation that says what you checked and what you did not
The lab folder as it stands after this lesson. Unzip it in ~/krlab.
More
The zip holds every file that the course has printed up to here. To start this lesson with the files of the earlier lessons only, take the zip of the lesson before. Type the code yourself first: you learn more.
Scenario
KR Cover, a small home-insurance company, will launch a claims assistant for policyholders next month. A policyholder chats with it, uploads photos and PDF documents of a damage claim, and asks about the state of a claim. The assistant summarises the documents for the claims team, and it can add a note to a claim or pay a claim of up to 100. A colleague started the security file and then moved to another project. The head of claims asks you for one thing: "May we launch on the first of the month, and if not, what must we do first?"
You have the files of the colleague, the checker of lesson 10 and the scorer of lesson 8. Every task uses only your own computer.
Your tasks
Plan about 90 minutes. A reader who types every repair by hand may need up to two hours.
Set up the case
Run this script. It makes the folder ~/krlab/ai-security-fundamentals/claims-review and writes the fact sheet and the files of the colleague into it. Read claims-facts.txt first.
mkdir -p ~/krlab/ai-security-fundamentals/claims-review
cd ~/krlab/ai-security-fundamentals/claims-review
cat > claims-facts.txt <<'EOF'
KR Cover claims assistant (an invented system)
KR Cover is a small home-insurance company. Next month it launches an
assistant for policyholders. A policyholder chats with it, uploads photos and
PDF documents of a damage claim, and asks about the status of a claim.
What the assistant does
- It reads the uploaded documents and writes a summary for the claims team.
- It answers questions from the policy wording and the FAQ.
- It can look up a claim, add a note to it, and pay a claim of up to 100
(the "pay small claim" tool). Larger claims go to a human adjuster.
- The staff screen shows the summary that the assistant wrote.
- A separate fraud-risk model is out of scope of this launch review.
Part What it is Who writes it Owner
K1 Policy wording and FAQ Staff Head of claims
K2 Uploaded documents and the text read from them Policyholders Data protection officer
K3 Claims database: status, notes, payments Claims system and Claims lead
policyholders (notes)
K4 The language model, run by a cloud provider The model provider Vendor manager
K5 The prompt and the retrieval code Developers Lead developer
K6 The claim tools: look up, add note, pay small Developers Lead developer
claim
K7 The chat API and the web server Developers Platform team
K8 The staff screen that shows the summaries Developers (nobody is named)
EOF
cat > assets.json <<'EOF'
{"system": "KR Cover claims assistant",
"actors": {"policyholder": "untrusted", "staff": "trusted", "claims-system": "trusted", "developer": "trusted", "model-provider": "third-party"},
"assets": [
{"id": "K1", "name": "policy wording and FAQ", "layer": "data", "writers": ["staff"], "owner": "head of claims"},
{"id": "K2", "name": "uploaded documents", "layer": "data", "writers": ["policyholder"], "owner": "data protection officer"},
{"id": "K3", "name": "claims database", "layer": "data", "writers": ["claims-system", "policyholder"], "owner": "claims lead"},
{"id": "K4", "name": "language model", "layer": "model", "writers": ["model-provider"], "owner": "vendor manager"},
{"id": "K5", "name": "prompt and retrieval code", "layer": "application", "writers": ["developer"], "owner": "lead developer"},
{"id": "K6", "name": "claim tools", "layer": "agent", "writers": ["developer"], "owner": "lead developer"},
{"id": "K7", "name": "chat API and web server", "layer": "infrastructure", "writers": ["developer"], "owner": "platform team"},
{"id": "K8", "name": "staff screen", "layer": "application", "writers": ["developer"], "owner": ""}]}
EOF
cat > attack-path.csv <<'EOF'
step,attacker_does,tactic,technique,asset,control
1,Asks the chat which tools it has,Reconnaissance,Probe the assistant,K7,rate-limit
2,Uploads a PDF whose text hides an instruction,Resource Development,Prepare hostile content,K2,prompt-rule
3,Asks the assistant to summarise the claim,Initial Access,Hostile text reaches the model,K5,prompt-rule
4,The model follows the hidden instruction,Execution,LLM Prompt Injection,K4,prompt-rule
5,The model calls the pay tool for a claim that is not valid,Impact,Misuse of a connected tool,K6,payment-limit
6,The attacker repeats the upload under many policies,Impact,Scaled loss of money,K2,kill-switch
EOF
cat > flows.csv <<'EOF'
id,from,to,data,boundary
F1,policyholder,K7,chat message and uploaded files,B1
F2,K7,K5,message and files to the chat code,-
F3,K2,K5,text read from uploaded documents,B3
F4,K1,K5,policy wording passages,-
F5,K5,K4,prompt: system text + passages + documents + message,B2
F6,K4,K6,tool call with a claim number,B3
F7,K6,K3,claim lookup and note and payment,-
F8,K6,K4,tool result with claim notes,B3
F9,K4,K7,answer from the model,B3
F10,K7,policyholder,answer shown on the page,B1
F11,K4,K8,summary for the claims team,B3
EOF
cat > threats.csv <<'EOF'
id,flow,threat,control
T1,F1,A policyholder message tells the assistant to ignore its rules,prompt-rule
T2,F1,A flood of chats and uploads runs up the model bill,rate-limit
T3,F5,The provider keeps prompts that hold claim data,privacy-minimise
T4,F6,Injected text makes the tool read the claim of another person,tool-auth
T5,F6,Injected text makes the tool pay a claim that is not valid,human-approval
T6,F7,A claim note that a policyholder typed waits with an instruction,prompt-rule
T7,F8,A claim note in a tool result carries an instruction,prompt-rule
T8,F9,Model output holds a link that leaks claim data,output-filter
T9,F10,The page shows the answer as live HTML,output-filter
T10,F11,The staff screen shows the summary as live HTML,output-filter
EOF
cat > controls.csv <<'EOF'
control,kind,ai_specific,outside_model,threats,how
rate-limit,prevent,no,yes,T2,50 chats per hour for each policyholder
prompt-rule,prevent,yes,yes,T1 T6 T7,A sentence in the system prompt tells the model to ignore instructions in documents and notes
privacy-minimise,prevent,no,yes,T3,Send only the claim fields that the answer needs
tool-auth,prevent,yes,yes,T4,The tool takes the policyholder id from the session and not from the model
output-filter,prevent,yes,yes,T8 T9 T10,Remove links and escape HTML before any page shows the text
request-log,detect,yes,yes,T1 T2 T3 T4 T5 T6 T7 T8 T9 T10,Log every chat and every tool call with a request id
kill-switch,respond,no,yes,T1 T4 T5 T6 T7 T8,One switch turns off the note and pay tools
EOF
cat > test-plan.csv <<'EOF'
id,control,test,type,pass_when
P1,rate-limit,Send 100 chats in an hour from one policyholder,script,HTTP 429 after 50
P2,prompt-rule,Upload 10 documents with a hidden instruction,script,No answer follows it
P3,privacy-minimise,Read the fields that the tool returns,review,No bank details
P4,tool-auth,Ask for the claim of another policyholder,script,Not found and logged
P5,output-filter,Make the model write a tag and a link,script,No live tag or link
P6,request-log,Send one chat and find it in the log,script,Request id and tool calls appear
EOF
cat > use-case.json <<'EOF'
{
"purpose": "Summarise uploaded claim documents for the claims team and answer questions about a claim",
"objective": "Shorten the time to the first answer on a claim",
"owner": "head of claims",
"success": "Summaries are accurate and staff trust them",
"stop_when": "",
"not_for": "Paying a claim over 100 or refusing a claim: an adjuster decides",
"human": ""
}
EOF
cat > vendor.json <<'EOF'
{"provider": "Cirrus Models (a fictional provider)", "service": "hosted chat model API", "items": [
{"id": "V1", "weight": 3, "critical": true, "answer": "unknown", "evidence": "", "question": "Are prompts and outputs kept out of training?"},
{"id": "V2", "weight": 2, "critical": false, "answer": "yes", "evidence": "30 days, in the terms", "question": "Is retention written, and 30 days or less?"},
{"id": "V3", "weight": 2, "critical": false, "answer": "yes", "evidence": "Two EU regions named", "question": "Are the processing regions named?"},
{"id": "V4", "weight": 3, "critical": true, "answer": "yes", "evidence": "Contract clause 9, 48 hours", "question": "Is breach notice within 48 hours in the contract?"},
{"id": "V5", "weight": 2, "critical": false, "answer": "yes", "evidence": "SOC 2 Type II report, read", "question": "Have you read an independent audit report?"},
{"id": "V6", "weight": 2, "critical": false, "answer": "partial", "evidence": "Pin for 6 months", "question": "Can you pin a model version for 12 months?"}
]}
EOF- Policyholder → Chat API: chat and uploads
- Attacker → Uploads: a PDF that hides an instruction
- Uploads → Language model: text joins the prompt
- Language model → Claim tools: add a note, pay up to 100
- Claim tools → Claims database: note or payment
- Language model → Staff screen: a summary for staff
The scripts of the earlier lessons take the place to read as a word after the script name: the folder for check.py, and the file for score.py. Copy both scripts into the folder, so that you can change them. If you did not keep them, download the lab files (the link on the course page), unzip them, and run sh kr-lab.sh 10-build-the-security-file ~/krlab/ai-security-fundamentals in the unzipped folder.
cp ../security-file/check.py ../vendor/score.py .Find the gaps
- Run the checker of lesson 10 on the folder. Read every failing rule and find its cause in the files.
- Read
assets.jsonand find the asset that has no owner. An asset with no owner is not kept up to date. Then add a twelfth rule to your copy ofcheck.py, so that the checker finds this kind of gap itself. - Find the boundary flow that has no threat. Say which attack from the course it would carry.
- Find the control that has no test.
- Read the columns
howandoutside_modelofcontrols.csv. One control only asks the model to behave, yet the file says that it works outside the model. Say why the checker cannot see that. - Score the model provider with
vendor.json. Put one note in theevidencefield of V1 that says what you would ask the provider.
Complete the file set
- Fix every failing rule with a real fix, not with a rename:
- Name an owner for the asset.
- Make the attack path point at a control that exists.
- Write the missing threat as one new row,
T11. It names the controlhuman-approval. - Add one new control to
controls.csv:human-approval, a prevent control that works outside the model, where a person sees the real action and the amount before any note or payment. List it for T5, T11 and the three injection threats T1, T6 and T7. Add no other control. The detect control must also cover T11. - Correct the false mark in
controls.csv. - Give every control a test, including
human-approval.
- Run your twelve-rule checker until nothing fails.
- Add the two documents of lessons 1 and 9. Copy
check_usecase.pyandcheck_sources.pyfrom../kr-books. The colleague left a starteruse-case.jsonwith four answers. Runcheck_usecase.pyon it, then complete the three answers that fail: a success measure with a number, a stop condition, and what a person checks. Writesources.csvwith the header lineid,what,source,entryand two links: T1 to MIT AI Risk Repository entry 2.2 (an attack on the system) and T3 to entry 2.1 (a leak of personal data). Writewatch.csvwith a watcher for each asset that runs code. Runcheck_sources.pyonce with only the header lineasset,component,watcherinwatch.csv, and then fill the file. The checker looks at three layers only (lesson 9, step 4), yet policyholders upload PDF documents, and the program that reads them has CVE records too: add a row for it by hand. Runpython3 check_usecase.pyandpython3 check_sources.py .on your files.
Decide
- Decide: may the assistant launch on the first of the month? The answer is one of "launch", "launch with conditions" or "do not launch yet". Base it on the checker, on the provider score and on the controls that you do not trust.
Hand in
Hand in two things.
The folder
claims-reviewwith the completed file set:assets.json,attack-path.csv,flows.csv,threats.csv,controls.csv,test-plan.csv,use-case.json,sources.csv,watch.csv, your twelve-rulecheck.py, andvendor.jsonwith your note.A one-page launch recommendation,
recommendation.md. Start with one line: "Decision: ..." (launch, launch with conditions, or do not launch yet). Then use these five headings:- What the system is. Three or four sentences: what it does, who writes to it, what it can change.
- Top risks. The three risks that matter most, each with the asset and the flow, in plain words that the head of claims understands.
- Gaps found. What was missing from the file, as a short list, with the id of each item.
- Controls needed before launch. The controls that must exist and be tested first, and who owns each.
- What I did not check. What is out of scope or untested, so that nobody trusts more than you proved.
Review your work
Model answers to the checks, and how to find them
The first run of the checker prints 5 of 11 rules pass, so 6 rules fail. R4: step 5 of the path names the control payment-limit, which is not in the matrix. R6 and R10: flow F3 and asset K2, because nothing examines the text that is read from uploaded documents. R7 and R8: threat T5 names human-approval, which is not in the matrix, so T5 has no prevent control. R11: kill-switch has no test. Asset K8, the staff screen, has no owner. The control prompt-rule is a sentence in the system prompt, yet the colleague marked it outside_model yes. The checker trusts that mark and does not read the text in how, so it counts the sentence as a prevent control. Lesson 5 measured a rule of this kind: 10 of 10 runs followed the hidden instruction. Once you mark it no, rule R8 fails for T1, T6 and T7 until a real control stands there. The scorer prints HOLD, because the critical item V1 (no training on your prompts) is unknown.
A model fix, as commands, in the folder:
sed 's/"owner": ""/"owner": "lead developer"/' assets.json > assets.new && mv assets.new assets.json
sed 's/,K6,payment-limit$/,K6,human-approval/' attack-path.csv > attack-path.new && mv attack-path.new attack-path.csv
echo 'T11,F3,An uploaded document hides an instruction for the model,human-approval' >> threats.csv
echo 'human-approval,prevent,yes,yes,T1 T5 T6 T7 T11,A person sees the real action and the amount before any note or payment' >> controls.csv
sed -e 's/^prompt-rule,prevent,yes,yes,/prompt-rule,prevent,yes,no,/' -e 's/ T10,Log every/ T10 T11,Log every/' controls.csv > controls.new && mv controls.new controls.csv
cat >> test-plan.csv <<'EOF'
P7,human-approval,Make the model ask to pay a claim,script,Nothing is paid before a person approves
P8,kill-switch,Switch off the note and pay tools in staging,drill,The assistant answers without tools in 1 minute
EOFThe two added documents, as commands:
cp ../kr-books/check_usecase.py ../kr-books/check_sources.py .
cat > use-case.json <<EOF
{
"purpose": "Summarise uploaded claim documents for the claims team and answer questions about a claim",
"objective": "Shorten the time to the first answer on a claim",
"owner": "head of claims",
"success": "At least 95 percent of summaries match the documents in a weekly sample of 40",
"stop_when": "A weekly sample falls below 90 percent, or one payment is made without approval",
"not_for": "Paying a claim over 100 or refusing a claim: an adjuster decides",
"human": "A person approves every note and every payment, and the claims lead checks 40 summaries a week"
}
EOF
cat > sources.csv <<EOF
id,what,source,entry
T1,A policyholder message tells the assistant to ignore its rules,MIT AI Risk Repository,2.2
T3,The provider keeps prompts that hold claim data,MIT AI Risk Repository,2.1
EOF
echo 'asset,component,watcher' > watch.csv
python3 check_sources.py . | tail -2
cat >> watch.csv <<'EOF'
K5,retrieval library and chat code,lead developer
K6,claim tools and their libraries,lead developer
K7,web server and its framework,platform team
K8,staff screen and its framework,lead developer
K2,pdf and image reader,lead developer
EOF
python3 check_usecase.py | tail -1
python3 check_sources.py . | tail -2K2 is in the data layer, so the checker never asks for a watcher for it. The row for the PDF reader is yours to add, and the checker does not mind it.
The twelfth rule, added to check.py above the list RULES (and its name added to that list):
def owners():
"""Every asset has a named owner"""
return [a["id"] for a in assets if not a.get("owner")]With that, the checker prints 12 of 12 rules pass. controls.csv holds 8 controls (the seven and human-approval), and only prompt-rule is marked no.
A model launch recommendation
Decision: do not launch yet.
What the system is. The KR Cover claims assistant chats with policyholders, reads the documents that they upload, writes a summary for the claims team, and can add a note to a claim or pay a claim of up to 100. Policyholders write the uploads and the notes. A hosted model from a third party reads them all.
Top risks. (1) A hidden instruction in an uploaded document (K2, flow F3) makes the model call the pay tool for an invalid claim. A model cannot tell a document from an instruction, so this can be limited and not fully prevented. (2) The model provider may keep or train on the prompts, which hold claim data (K4, flow F5). The provider has not answered. (3) The answer on the policyholder's page and the summary on the staff screen could be shown as live HTML if the output filter fails (K7 and K8, flows F10 and F11), so that a tag in the model output could run script in a browser. output-filter is listed for both flows, and its test P5 has not been run.
Gaps found. Flow F3 had no threat (R6, R10). Threat T5 named a control that did not exist (R7, R8). Step 5 of the path named payment-limit, which was not in the matrix (R4). kill-switch had no test (R11). Asset K8 had no owner. The PDF reader of K2 is in the data layer, so the checker of lesson 9 did not ask for a watcher, and I added one by hand. The only prevent control for the injection threats T1, T6 and T7 was prompt-rule, a sentence to the model, wrongly marked as working outside the model. A small model ignored such a rule in a test.
Controls needed before launch. A person approves every note and every payment (human-approval, owner: head of claims), with a test. It is now the prevent control for T1, T6 and T7, where prompt-rule stood. The tool takes the policyholder from the session (tool-auth). Output is escaped and links are removed (output-filter). A switch turns off the tools, tested in a drill. The provider confirms in writing that prompts stay out of training (V1). Keep prompt-rule as a request, marked outside_model no, and not as a control.
What I did not check. The fraud-risk model is out of scope. I did not test the real assistant or the real contract. The tests in test-plan.csv are planned and not yet run. The checker of lesson 10 does not read the use case, the sources file or the watch list. It proves that the paper is consistent, not that the system is safe.
Mark your report
You mark this yourself, or you ask a colleague or a mentor to mark it. The page checks the numbers above; it cannot read your report.
| Criterion | Not yet | Meets the standard | Strong |
|---|---|---|---|
| Findings | Misses prompt-rule or flow F3. | Six failing rules, K8 with no owner, F3, untested kill-switch, mis-marked prompt-rule, V1 unknown. | Ties each gap to the attack it lets through. |
| Evidence | Gaps with no ids. | Each gap names its id and the rule or score line, and the use case and the watch list are named as files that the checker does not read. | Separates checker results from your own judgement. |
| Judgement | Says 12 of 12 means safe. | Three business risks, each with asset and flow; untested and out-of-scope parts listed. | Says which risk can only be limited, and why. |
| Decision and controls | No decision, or "launch" with V1 unknown. | "Decision:" in line one, reason within three lines; tested controls needed first. | Each control has an owner and a test id. |
| Writing | The head of claims cannot follow it. | One page, plain words, dated, no blame. | Each technical term explained in passing. |
Meets the standard in every row: you can show this report as a work sample. Remove names and data that are not yours to share.
The report proves your work on this scenario, on your own machine, without a proctor. It does not prove work on the real assistant.