14A.7 Data, Vendor and Supply-Chain Governance, plus NIST AI RMF and ISO/IEC 42001 Awareness
Every agent you ship moves data and depends on things you did not write. Prompts carry user text to a provider. Logs and traces keep copies. Retrieval pulls company documents into the context window. A model, a package, an MCP server, a skill file and an eval tool are all someone else's work running with your permissions. Governance is the habit of knowing where data goes, who else touches it, and what you rely on, and being able to prove it. This lesson gives you that habit in four parts: data governance for prompts, logs and retrieved content (classes, redaction, retention, deletion, residency); vendor governance (provider data terms for OpenAI and Anthropic, a vendor register and a risk questionnaire, including eval tooling and what an eval platform uploads); supply-chain governance for agent stacks (packages, MCP servers, skills, model files, and SBOMs); and standards awareness: what the NIST AI RMF and ISO/IEC 42001 are, and what they are not (a short summary here; the full explanation and a runnable control-mapping script live in 12.9, 6.8 to 6.11). It pairs with 14A.6 (inventory, risk tiers, policy-as-code). The general operating machinery is in 11C.4, Parts 2 and 3 and the compliance landscape, standards and the EU AI Act in 12.9; this lesson adds the agent-specific and runnable layer and does not repeat them.
What you'll learn
- Where data lands in an agent system (prompts, logs, traces, retrieved content, memory, eval data) and how a five-class data classification drives what may go where
- How to redact, route, expire and erase data, with runnable code and an honest list of what pattern matching misses
- What OpenAI and Anthropic publish about training use, retention, zero data retention, data processing agreements, subprocessors and regional options, checked on 1 December 2026
- How to keep a vendor register, ask the right vendor risk questions, and treat eval tooling as a vendor with telemetry defaults and uploads
- Supply-chain controls for agent stacks: pin and hash packages, vet MCP servers and skills, verify model files, and produce a software bill of materials (SBOM)
- Where the NIST AI RMF and ISO/IEC 42001 fit (Part 4 is a short summary that points to the full explanation in 12.9, 6.8 to 6.11)
- How to evaluate your own governance: redaction recall, register completeness and an egress check that proves a tool sends nothing out
What you don't need
- API keys. Every program is standard-library Python that makes no network calls (the egress demo blocks the network on purpose). The provider facts are read from the providers' own pages, not by calling them.
- Docker, a database, a vector store or any service. Stores in the examples are in-memory lists.
- Legal training. This lesson explains what providers and standards publish. It is not legal advice, and a contract or a regulator can say something different.
Setup
Python 3.11 or newer and nothing else (standard library only). As of 1 December 2026 there is nothing to install. Save each code block under the file name in its first comment and run it with python3 <file>; the two JSON files are named in the sentence before them because JSON has no comments. The outputs below were produced with Python 3.14 by running exactly these files with warnings turned into errors (python3 -W error). The vendor and stack data in the examples are made up to show failures; your register will say different things. Every fact about a provider or standard carries the date it was checked, 1 December 2026, and the page it came from. Pages change, so re-check before you rely on one.
What you must be able to do after this lesson#
- Classify data into the five classes and decide, per class, where it may go
- Redact data before it is stored and erase one person from every store with a single report
- State, with a date, what OpenAI and Anthropic publish about training use, retention, zero data retention and residency
- Build a vendor register and check it against the data flows you actually have
- Audit an agent stack for unpinned packages, unreviewed MCP servers and skills, and unsafe model files, and verify a file hash
- Prove that an eval tool sends nothing out by running it behind a network guard
- Explain in one sentence each what the NIST AI RMF and ISO/IEC 42001 are, and why running tests is not compliance
Why this matters for an AI engineer#
Security reviewers, customers and auditors ask the same questions again and again. Does our data train anyone's model? Where is it stored, and for how long? Who are the subprocessors? Can you delete one user's data everywhere? What do you do about a malicious package or MCP server? Are you ISO certified, or aligned to NIST? If you cannot answer in a day, deals stall and launches wait. If you can, governance becomes a short document backed by scripts, not a scramble.
| You'll hear... | You'll understand it after... |
|---|---|
| "What data goes into the prompt, and into the logs?" | Part 1: Data governance |
| "Does the provider train on our data? How long do they keep it?" | Part 2: Provider data terms |
| "Send us your vendor risk questionnaire answers." | 3.1 The vendor register and questionnaire |
| "Does our eval tool phone home?" | 3.3 Eval tooling is a vendor too |
| "How do we know that MCP server or model is safe?" | 3.2 The supply chain of an agent stack |
| "Are we NIST AI RMF compliant? ISO 42001 certified?" | Part 4: NIST AI RMF and ISO/IEC 42001 |
| "How do we know the controls work?" | Part 5: Evaluate it |
Part 1: Data governance for prompts, logs and retrieved content#
This part extends 11C.4, Part 3 (the data lifecycle) and 12.4, Part 1 (leak paths) with a runnable classify, redact, route, expire and erase policy, and with what the two primary providers publish about residency. The prose that only repeats those lessons is kept short.
1.1 Where the data goes#
An agent run touches more places than the prompt. Each is a copy, and each copy has its own retention, its own readers and its own failure modes.
flowchart LR
U["user text"] --> P["prompt to the model provider"]
R["retrieved documents"] --> P
T["tool results"] --> P
M["memory"] --> P
P --> PROV["provider: abuse-monitoring logs,<br/>stored state, subprocessors"]
P --> L["your app logs"]
P --> TR["traces"]
TR --> TS["trace platform"]
L --> EV["eval datasets"]
TR --> EV
EV --> EP["eval platform"]
R --> IDX["vector index<br/>(copies of your documents)"]| Place | What lands there | Who can read it | The governance question |
|---|---|---|---|
| Prompt | User text, system prompt, retrieved chunks, tool results, memory | The provider and its subprocessors | Is this class of data allowed to leave? Under which terms? |
| Application logs | Requests, errors, sometimes full prompts | Engineers, support | Did we store raw personal data "for debugging"? |
| Traces | Every model call and tool call with inputs and outputs (03.12, 11A.1) | On-call, the trace vendor | Are payloads captured? Redacted? For how long? |
| Retrieved content | Chunks of your documents, and the index built from them | Whoever can query the index | Does the index inherit its sources' class, and does it respect who may see what? |
| Memory | What the agent remembers about users (08B.4) | The agent, anyone who reads the store | Can we delete one person's memories? |
| Eval data | Test cases copied from production | Eval authors, an eval platform if you upload | Was it sampled, scrubbed and frozen, or is it live customer text? |
| Caches and queues | Prompt caches, retry queues, dead-letter queues | Infrastructure | Do deletions reach them? |
12.4, Part 1 draws the full leak-path map and 11C.4, 3.1 lists what a system accumulates. The rule that follows from both is: every place that holds a copy needs an owner, a retention period and a way to delete.
1.2 Classify first#
You cannot govern data you have not classified. Use a small set of classes that people can apply in seconds. These are the five from 11C.4, 2.6, which this lesson uses throughout.
| Class | Examples | Default handling in this lesson |
|---|---|---|
| public | Published docs, marketing copy | Anywhere |
| internal | Code, wikis, non-personal business data | Approved providers and trace stores |
| personal | Names, emails, phone numbers, account ids, conversation content | Approved providers only; redact before traces and eval uploads; short retention; deletable by person |
| sensitive | Health, finance, government ids, card numbers, children's data | Local only unless a signed agreement and zero data retention exist; shortest retention |
| secrets | API keys, passwords, tokens | Nowhere: not in prompts, tools, logs, traces or evals |
Three habits make classes work: classify up when unsure, classify at the source (a document's class follows it into the prompt, the log and the index), and a mixed record takes the highest class (11C.4, 2.6 explains each).
1.3 Prompts: minimise, then send#
The cheapest protection is not sending the data. Before a prompt is built, ask whether the model needs the value at all. A refund agent needs the order id and amount, not the customer's full address. Where it does need personal data, send it to a provider you have vetted (Part 2) and keep the class on the request so downstream code, such as the policy engine of 14A.6, can see it. Secrets never go into a prompt: a model cannot keep a secret it has been shown, and it will be copied into every log that records the prompt (08A.7, Part 7 shows redacting tool results before the model sees them).
1.4 Logs and traces: redact before you store#
Your logs and traces are your own retention policy, and they are usually the longest-lived copy. Three rules:
- Redact on the way in, not "later". A raw value written to a log can be copied to a backup before any cleanup job runs.
- Decide whether to capture payloads at all. Traces are valuable because they show inputs and outputs, and that is exactly the sensitive part. Many tracing setups let you record structure (which tools, how long, how many tokens) without content. Capture content for the agents and environments where you need it and redact it there.
- Retention for traces is shorter than for the audit log. The audit log of changes and decisions (14A.6, 11A.3) is kept long. Traces that contain conversation text are kept as short as debugging allows.
1.5 Retrieved content: the index inherits its sources#
Retrieval-augmented agents copy your documents into a vector index and then into prompts. Two governance consequences:
- The index has the highest class of any source in it, and it must be deletable. If a document is removed or a person asks for erasure, the chunks and embeddings derived from it have to go too (11C.4, 3.3).
- Retrieval must respect who may see what. Filters on user, team or tenant belong on the query, not in the prompt. 07.2, Part 6 teaches access-control filters, and 12.7, Part 2 covers poisoning and the other retrieval attacks. Treat retrieved text as untrusted input too: a poisoned document is a prompt injection with a good delivery route.
1.6 Retention, deletion and the regional question#
Retention is "how long do we keep each copy?", chosen per class and per place. The schedule in the code below is an example (seven days for sensitive, 30 for personal, 90 for internal, a year for public). Your own legal and audit duties set the floor, so agree the numbers with their owners (11C.4, 3.2).
Deletion must reach every store, not just the main database: the trace platform, the eval dataset, the vector index and the caches too. Keep a data-flow inventory (the table in 1.1) and one erase function per store, called from one place, with a report of what was removed. 11C.4, 3.3 has the runbook, and 1.7 below is the runnable version.
Residency means where data is stored and processed. It has two halves, and providers treat them separately: where model inference runs, and where data is stored at rest. What the two providers publish, checked on 1 December 2026:
| OpenAI | Anthropic | |
|---|---|---|
| Control | Data residency is set per project at creation and cannot be changed later. Eligibility is through contacting sales. It covers Customer Content, not "system data", which may be stored and processed outside the selected region (Data residency guide) | Two independent settings: inference_geo (per request or workspace default) and workspace geo (where data is stored at rest, fixed at workspace creation) (Data residency) |
| Regions | US and Europe (EEA and Switzerland) have storage and processing. Japan, India, Australia and the UAE have processing with narrower model and tier support. Canada, Singapore, South Korea and the UK are storage only: processing may happen outside the region | inference_geo accepts "us" or "global" (the default). Workspace geo currently offers "us" only |
| Price effect | A 10% uplift on data residency endpoints for eligible models released on or after 5 March 2026 | US-only inference is priced at 1.1x the standard rate for Claude 4.6 and later models |
| Caveats | store=true on Chat Completions is not available outside the US; several features are US and EU only; storage-only regions may process elsewhere |
inference_geo is not available on Amazon Bedrock or the OpenAI-compatibility endpoint; older models return a 400 error if you pass it; rate limits are shared across geos |
Two lessons from the table. First, "data residency" is a product with a price and exceptions, not a global switch: read the endpoint and model limits before promising a region to a customer. Second, the same model through a cloud marketplace has different terms (02.9, 9.3): re-check residency and retention whenever you change platform.
To pin Anthropic inference to the US on a request (illustrative, needs ANTHROPIC_API_KEY and the anthropic package; the parameter and the response field are from the page above):
# claude_residency.py -- illustrative, needs ANTHROPIC_API_KEY and the anthropic package
import anthropic
client = anthropic.Anthropic()
response = client.messages.create(
model="claude-sonnet-5-5",
max_tokens=256,
inference_geo="us", # "global" is the default
messages=[{"role": "user", "content": "Summarise our refund policy in two sentences."}],
)
print(response.content[0].text)
print("inference ran in:", response.usage.inference_geo) # check, do not assumeRefunds are available within 30 days of purchase for unused items. ...
inference ran in: usFor OpenAI, regional processing is chosen at project creation and then used through the regional domain (for example eu.api.openai.com), as the residency guide describes, so there is no per-request parameter to show. In code it is the client's base URL:
# oai_residency.py -- illustrative, needs OPENAI_API_KEY (from an EU data-residency project) and the openai package
from openai import OpenAI
client = OpenAI(base_url="https://eu.api.openai.com/v1") # domain from the Data residency guide
response = client.responses.create(
model="gpt-6-luna",
input="Summarise our refund policy in two sentences.",
store=False, # do not keep application state
)
print(response.output_text)Refunds are available within 30 days of purchase for unused items. ...1.7 A runnable data policy: classify, redact, route, expire, erase#
The code below is the governance layer, small enough to read. It is not a production PII detector: 12.4, Part 3 teaches validators, NER and evaluating detectors properly. What this file shows is how classification connects to decisions: what may go to which destination, how long it lives, and how to erase a person.
# data_governance.py: classify text, redact it, decide where it may go, and erase a person everywhere (stdlib only)
import re
from datetime import date, timedelta
ORDER = ["public", "internal", "personal", "sensitive", "secrets"]
# Pattern -> data class. Regexes are a first line of defence, not a guarantee (see the lesson).
PATTERNS = [
("api_key", "secrets", re.compile(r"\b(?:sk|pk)-[A-Za-z0-9_-]{16,}\b")),
("card", "sensitive", re.compile(r"\b\d(?:[ -]?\d){12,18}\b")), # confirmed with a Luhn check below
("gov_id", "sensitive", re.compile(r"\b\d{3}-\d{2}-\d{4}\b")), # US SSN shape
("email", "personal", re.compile(r"\b[\w.+-]+@[\w-]+(?:\.[\w-]+)+\b")),
("phone", "personal", re.compile(r"(?<!\d)\+?\d{1,3}[ -]?\(?\d{3}\)?[ -]?\d{3}[ -]?\d{4}(?!\d)")),
]
def luhn_ok(digits):
nums = [int(c) for c in digits if c.isdigit()][::-1]
total = sum(n if i % 2 == 0 else (n * 2 - 9 if n * 2 > 9 else n * 2) for i, n in enumerate(nums))
return 13 <= len(nums) <= 19 and total % 10 == 0
def scan(text):
"""Return [(kind, data_class, start, end)] for everything sensitive that the patterns can see."""
found = []
for kind, cls, rx in PATTERNS:
for m in rx.finditer(text):
if kind == "card" and not luhn_ok(m.group()):
continue
found.append((kind, cls, m.start(), m.end()))
return sorted(found, key=lambda f: f[2])
def classify(text):
classes = {cls for _, cls, _, _ in scan(text)} or {"internal"} # unlabeled text is at least internal
return max(classes, key=ORDER.index)
def redact(text):
out, last = [], 0
for kind, _, s, e in scan(text):
if s < last:
continue
out += [text[last:s], f"[{kind.upper()}]"]
last = e
return "".join(out) + text[last:]
# Where may each class go? Destinations are the places data can land.
# provider_unvetted: a provider on default terms, no DPA, not in your vendor register (a free tier, a trial key)
# provider_approved: a vendor in your register with a signed DPA and no-training terms (see vendor_register.py)
ALLOWED = {
"public": {"provider_unvetted", "provider_approved", "trace_store", "eval_platform", "local"},
"internal": {"provider_approved", "trace_store", "local"},
"personal": {"provider_approved", "local"}, # to a trace store or eval platform only after redaction
"sensitive": {"local"}, # to a provider only with ZDR and a signed agreement: ask first
"secrets": set(), # nowhere. Not even local logs.
}
RETENTION_DAYS = {"public": 365, "internal": 90, "personal": 30, "sensitive": 7, "secrets": 0}
def route(text, destination):
"""Decide what may be sent to `destination`. Redaction is applied for traces and eval uploads."""
cls = classify(text)
if destination in ALLOWED[cls]:
return {"class": cls, "action": "send as is", "payload": text}
if cls != "secrets" and destination in ("trace_store", "eval_platform"):
clean = redact(text)
if classify(clean) in ("public", "internal"):
return {"class": cls, "action": "send redacted", "payload": clean}
return {"class": cls, "action": "block", "payload": None}
class Store:
"""A stand-in for one place data lives: logs, traces, vector index, eval dataset."""
def __init__(self, name):
self.name, self.rows = name, []
def add(self, user, text, on, cls):
self.rows.append({"user": user, "text": text, "on": on, "class": cls})
def purge_expired(self, today):
keep = [r for r in self.rows if today - r["on"] <= timedelta(days=RETENTION_DAYS[r["class"]])]
removed, self.rows = len(self.rows) - len(keep), keep
return removed
def erase_user(self, user):
before = len(self.rows)
self.rows = [r for r in self.rows if r["user"] != user]
return before - len(self.rows)Three details to notice. scan confirms a card-shaped number with a Luhn check, so an order number that merely looks like a card is not flagged. classify treats unlabelled text as at least internal, never public: you must prove text is public, not assume it. And route returns one of three actions: send as is, send redacted (for trace stores and eval platforms, if redaction makes the text safe enough) or block.
Run it on a handful of texts:
# demo_data.py: classify, redact, route, expire and erase
from datetime import date
import data_governance as dp
samples = [
"How do I reset my password?",
"Refund order A17 for ana@example.com, call +1 415 555 0132 if it fails",
"Card 4242 4242 4242 4242 was charged twice, SSN 123-45-6789",
"Order number 4242 4242 4242 4241 is late", # looks like a card, fails the Luhn check
"my key is sk-FAKEFAKEFAKEFAKE1234 please debug", # a fake, shaped like a key
"Ana Lopez lives at 12 Elm Street, Leeds", # personal data with no pattern: the scanner misses it
]
for t in samples:
print(f"[{dp.classify(t):9s}] {dp.redact(t)}")
print("\nrouting the second and third sample:")
for t in samples[1:3]:
for dest in ("provider_unvetted", "provider_approved", "trace_store", "eval_platform"):
r = dp.route(t, dest)
print(f" {dest:17s} {r['action']:13s} {r['payload'] or ''}")
print()
print("routing the key:", dp.route(samples[4], "trace_store")["action"], "/", dp.route(samples[4], "local")["action"])
# retention and erasure across more than one store
today = date(2026, 12, 1)
logs, traces, evals = dp.Store("app_logs"), dp.Store("trace_store"), dp.Store("eval_dataset")
logs.add("u1", "refund question", date(2026, 11, 28), "personal")
logs.add("u1", "old chat", date(2026, 9, 1), "personal") # 91 days old, limit 30
logs.add("u2", "faq", date(2026, 9, 1), "internal") # 91 days old, limit 90
traces.add("u1", "[EMAIL] asked about A17", date(2026, 11, 29), "personal")
evals.add("u1", "case copied from a trace", date(2026, 11, 20), "personal")
evals.add("u2", "another case", date(2026, 11, 20), "personal")
print()
for s in (logs, traces, evals):
print(f"{s.name:13s} expired removed: {s.purge_expired(today)}")
print("erase u1:", {s.name: s.erase_user("u1") for s in (logs, traces, evals)})
print("rows left:", {s.name: len(s.rows) for s in (logs, traces, evals)})[internal ] How do I reset my password?
[personal ] Refund order A17 for [EMAIL], call [PHONE] if it fails
[sensitive] Card [CARD] was charged twice, SSN [GOV_ID]
[internal ] Order number 4242 4242 4242 4241 is late
[secrets ] my key is [API_KEY] please debug
[internal ] Ana Lopez lives at 12 Elm Street, Leeds
routing the second and third sample:
provider_unvetted block
provider_approved send as is Refund order A17 for ana@example.com, call +1 415 555 0132 if it fails
trace_store send redacted Refund order A17 for [EMAIL], call [PHONE] if it fails
eval_platform send redacted Refund order A17 for [EMAIL], call [PHONE] if it fails
provider_unvetted block
provider_approved block
trace_store send redacted Card [CARD] was charged twice, SSN [GOV_ID]
eval_platform send redacted Card [CARD] was charged twice, SSN [GOV_ID]
routing the key: block / block
app_logs expired removed: 2
trace_store expired removed: 0
eval_dataset expired removed: 0
erase u1: {'app_logs': 1, 'trace_store': 1, 'eval_dataset': 1}
rows left: {'app_logs': 0, 'trace_store': 0, 'eval_dataset': 1}Read the output carefully.
- The order number that fails the Luhn check stays
internal, but the real card and the SSN make the third textsensitive, so it is blocked from every provider and sent redacted to a trace store. - The key is
secrets: blocked everywhere, includinglocal, because the rule for secrets is that they are not logged at all. - The last sample is the lesson's warning. "Ana Lopez lives at 12 Elm Street, Leeds" is personal data, and the scanner calls it
internalbecause no pattern matches a name or an address. A regex-based redactor has high recall on structured values (emails, phones, cards, keys) and near zero on free-text names and addresses. NER-based and model-based detectors help and have their own misses (12.4, 3.4 to 3.6). Treat redaction as one layer, and keep minimisation and approved-provider rules on top. - The retention step removed two rows from the app log: a personal row past its 30 days, and an internal row at 91 days against a 90-day limit. The erase step then removed user
u1from all three stores in one call, and the report shows what each store held. The unexpiredu2row in the eval dataset is the one left. If you only erased the app log,u1's traces and eval case would still be there.
Part 2: Provider data terms (OpenAI and Anthropic)#
This part extends 02.9, 9.2 (the provider snapshot, which also covers Google and OpenRouter) with the contractual layer for the two primary providers: DPAs, subprocessor notices, exceptions and deletion at the end.
Before real user data goes to a provider you need four answers: is it used for training, how long is it kept, can retention be reduced to zero, and what legal terms cover it? 11C.5, Part 4 gives the one-page version; this part adds the contractual layer for governance. Everything below was checked against the named official pages on 1 December 2026.
| Question | OpenAI API | Anthropic API (commercial) |
|---|---|---|
| Training use | Data sent to the API is not used to train or improve OpenAI models unless you explicitly opt in (Your data) | By default Anthropic does not use inputs or outputs from commercial products to train models. Exceptions: feedback you submit (kept up to 5 years, de-linked from user and customer ids) and data you choose to share (Is my data used for model training?, dated 18 August 2026) |
| Default retention | Abuse-monitoring logs are kept up to 30 days, longer if law requires. The Responses API keeps application state for 30 days when store is true |
Inputs and outputs are deleted from backend systems within 30 days of receipt or generation, with exceptions such as features you control (Files API) (How long do you store my organization's data?, dated 1 July 2026) |
| Reducing retention to zero | Zero Data Retention (ZDR) and Modified Abuse Monitoring exclude customer content from abuse-monitoring logs; both need prior approval by OpenAI. Under ZDR, store is always treated as false. Image and file inputs are scanned for CSAM, and flagged ones are retained for manual review even under ZDR |
Zero data retention is an agreement, not a default: the 30-day timeframe does not apply "when you and we have agreed otherwise" |
| Exceptions you must plan for | Feature limits under ZDR (some endpoints still store application state) | If automated trust-and-safety systems flag a request, inputs and outputs may be kept up to 2 years and classification scores up to 7 years; retention can also extend to enforce the Usage Policy or comply with law |
| Data processing agreement | The DPA supplements the OpenAI Services Agreement, OpenAI acts as processor, effective 1 January 2026 (last updated 1 December 2025). General authorisation of listed sub-processors; changes are notified by blog post, in-service notice, other reasonable method or email, and you may object within 30 days (DPA) | The DPA forms part of the Commercial Terms, Anthropic is the processor, effective 24 February 2025. General authorisation of the subprocessors in Schedule 4, published at anthropic.com/subprocessors; new ones need reasonable notice and you may object on reasonable grounds within 15 days or are deemed to consent. SCCs, a UK Addendum and a Swiss Addendum cover transfers (DPA) |
| Deletion at the end | Returned or deleted at your instruction after the agreement ends; data retained for legal reasons is isolated | Within 30 days of termination a copy is returned on request, then all copies deleted, with exceptions for law, disputes and combating harmful use |
| Audit rights | See the DPA | Annual external audits (reports such as SOC 2 on written request); your own audit on written request at your expense, with conditions |
How to use this table in governance:
- "Not used for training" is not "not stored". Both providers keep API data for about 30 days by default. If stored-for-30-days is not acceptable for a data class, the stricter option is the only answer, and it needs approval or an agreement. This is why Part 1 has
sensitiveas local-only by default. - Note the exceptions in the register, not only the default. A flagged request retained for two years is the kind of fact a privacy officer will ask about.
- Re-read on a schedule. Both policy pages above carry dates (July and August 2026) and have changed before. Put a review date in the vendor register (3.1), and re-check when you change the model, endpoint, feature or cloud platform (11C.5).
- Features change terms. Stored conversation state, background modes, file storage and hosted tools have their own retention. Check the feature's page, not just the general one.
- The DPA, not the marketing page, is the commitment. Subprocessor lists change; the DPA says how you hear about it and how long you have to object. Someone must subscribe to those notices and own the objection window.
Part 3: Vendor and supply-chain governance#
Deep-dive
This part extends 11C.4, 2.7 (the vendor file and review cadence) and 12.7, Parts 5 and 6 (supply-chain defences and the vendor checklist) with a runnable register check and an audit of an agent stack.
3.1 The vendor register and questionnaire#
A vendor register is the inventory of everything outside your company that touches your data or your code: model providers, gateways, trace and observability platforms, eval tools and platforms, vector database hosts, MCP servers someone else runs. 11C.4, 2.7 gives the "vendor file" fields and review cadence, and 12.7, 6.1 a security checklist. The questions below are the ones a vendor risk questionnaire asks, and the ones to ask yourself before you sign up for any tool.
| Area | Question |
|---|---|
| Data | Which of our data classes will you receive? Is any of it used for training, evaluation or product improvement? How long is it retained, and can retention be zero? |
| Location | Where is data stored and processed? Can we pin a region? What may leave the region (for example "system data")? |
| Subprocessors | Who else touches our data? How are we notified of changes, and how long do we have to object? |
| Legal | Is a DPA available and signed? Which transfer mechanism applies? Do you offer a BAA if we handle health data? |
| Security | Which independent reports exist (SOC 2 Type II, ISO/IEC 27001), for what period, with what exceptions? Can we see them? How are incidents reported to us, and within what time? |
| Telemetry | What do your SDKs and libraries send by default? How is it switched off? |
| Access | Who at the vendor can read our data, under what conditions? |
| Exit | Can we export and delete everything, in what format and within what window? What do we lose if we leave? |
| Change | How are we told about price, policy, deprecation and terms changes? |
"SOC 2 certified" is a report, not a badge: it covers defined controls over a period, with exceptions listed (11C.4, 2.7). Ask to read it.
Make the register data and check it against what you actually send. The register below (made-up, to show failures) has a model provider pair, a gateway used as a fallback, a trace platform, an eval library and an eval platform. Save it as vendors.json:
[
{"name": "openai-api", "kind": "model_provider", "max_data_class": "personal", "dpa_signed": true,
"training_use": "no (default for API)", "zdr": false, "regions": ["us"], "subprocessors_reviewed": "2026-10-20",
"telemetry": "n/a", "exit_plan": true, "last_review": "2026-10-20"},
{"name": "anthropic-api", "kind": "model_provider", "max_data_class": "personal", "dpa_signed": true,
"training_use": "no (default for commercial)", "zdr": false, "regions": ["us"], "subprocessors_reviewed": "2026-09-02",
"telemetry": "n/a", "exit_plan": true, "last_review": "2026-09-02"},
{"name": "llm-gateway-x", "kind": "gateway", "max_data_class": "internal", "dpa_signed": false,
"training_use": "unknown", "zdr": false, "regions": ["unknown"], "subprocessors_reviewed": "",
"telemetry": "n/a", "exit_plan": false, "last_review": "2026-03-01"},
{"name": "trace-saas", "kind": "trace_store", "max_data_class": "internal", "dpa_signed": true,
"training_use": "no", "zdr": false, "regions": ["eu"], "subprocessors_reviewed": "2026-06-30",
"telemetry": "n/a", "exit_plan": true, "last_review": "2026-06-30"},
{"name": "eval-library", "kind": "eval_tool", "max_data_class": "internal", "dpa_signed": false,
"training_use": "n/a", "zdr": false, "regions": ["local"], "subprocessors_reviewed": "",
"telemetry": "default on", "telemetry_opt_out_set": false, "exit_plan": true, "last_review": "2026-11-24"},
{"name": "eval-platform", "kind": "eval_platform", "max_data_class": "internal", "dpa_signed": false,
"training_use": "unknown", "zdr": false, "regions": ["us", "eu"], "subprocessors_reviewed": "",
"telemetry": "n/a", "exit_plan": false, "last_review": "2026-11-24"}
]# vendor_register.py: check the vendor register against what you actually send (stdlib only)
import json
from datetime import date
ORDER = ["public", "internal", "personal", "sensitive", "secrets"]
TODAY = date(2026, 12, 1)
REVIEW_EVERY_DAYS = 180
# What each system sends to which vendor, at the highest data class (from your data flow inventory).
FLOWS = [
{"from": "support-bot", "to": "openai-api", "data_class": "personal"},
{"from": "faq-bot", "to": "anthropic-api", "data_class": "public"},
{"from": "support-bot", "to": "llm-gateway-x", "data_class": "personal"}, # the fallback route
{"from": "tracing", "to": "trace-saas", "data_class": "personal"}, # raw traces, not redacted
{"from": "ci-evals", "to": "eval-library", "data_class": "internal"},
{"from": "ci-evals", "to": "eval-platform", "data_class": "personal"},
{"from": "ci-evals", "to": "mystery-tool", "data_class": "internal"},
]
def check(vendors, flows, today=TODAY):
by_name = {v["name"]: v for v in vendors}
problems = []
for f in flows:
v = by_name.get(f["to"])
where = f"{f['from']} -> {f['to']} ({f['data_class']})"
if v is None:
problems.append((where, "vendor is not in the register"))
continue
if ORDER.index(f["data_class"]) > ORDER.index(v["max_data_class"]):
problems.append((where, f"register allows up to {v['max_data_class']}"))
if f["data_class"] in ("personal", "sensitive") and not v["dpa_signed"]:
problems.append((where, "personal data without a signed DPA"))
if f["data_class"] == "sensitive" and not v["zdr"]:
problems.append((where, "sensitive data without zero data retention"))
for v in vendors:
age = (today - date.fromisoformat(v["last_review"])).days
if age > REVIEW_EVERY_DAYS:
problems.append((v["name"], f"review is {age} days old (limit {REVIEW_EVERY_DAYS})"))
if v["kind"] != "model_provider" and v["training_use"] == "unknown":
problems.append((v["name"], "training use of your data is unknown: ask, do not assume"))
if v.get("telemetry") == "default on" and not v.get("telemetry_opt_out_set"):
problems.append((v["name"], "telemetry is on by default and the opt-out is not set"))
if not v["exit_plan"] and v["max_data_class"] != "public":
problems.append((v["name"], "no exit plan"))
if not v["subprocessors_reviewed"] and v["kind"] != "eval_tool":
problems.append((v["name"], "subprocessor list never reviewed"))
return problems
if __name__ == "__main__":
with open("vendors.json") as f:
vendors = json.load(f)
problems = check(vendors, FLOWS)
for where, why in problems:
print(f"{where:45s} {why}")
print(f"\n{len(problems)} problem(s)")support-bot -> llm-gateway-x (personal) register allows up to internal
support-bot -> llm-gateway-x (personal) personal data without a signed DPA
tracing -> trace-saas (personal) register allows up to internal
ci-evals -> eval-platform (personal) register allows up to internal
ci-evals -> eval-platform (personal) personal data without a signed DPA
ci-evals -> mystery-tool (internal) vendor is not in the register
llm-gateway-x review is 275 days old (limit 180)
llm-gateway-x training use of your data is unknown: ask, do not assume
llm-gateway-x no exit plan
llm-gateway-x subprocessor list never reviewed
eval-library telemetry is on by default and the opt-out is not set
eval-platform training use of your data is unknown: ask, do not assume
eval-platform no exit plan
eval-platform subprocessor list never reviewed
14 problem(s)Each line is a decision to make:
- The fallback gateway receives personal data but is registered up to
internal, has no signed DPA, no reviewed subprocessors and no exit plan. The route exists so that outages do not break the app, and it quietly breaks your data rules during outages. Fix the register (do the review) or remove the route for personal data. - Raw traces carry personal data to the trace platform, which is registered up to
internal. Either redact before sending (Part 1) or review the vendor up topersonal. - The eval platform receives personal data with no DPA and an unknown training position. Evaluation datasets copied from production are the usual cause (11A.4 covers building them safely).
mystery-toolis not in the register at all. A flow to an unregistered vendor is how shadow tooling shows up. This check is the vendor equivalent of the shadow agent of 14A.6.- The eval library's telemetry is on by default and nobody set the opt-out. That is the subject of 3.3.
3.2 The supply chain of an agent stack#
An agent is assembled from parts written by other people, and each part runs with some of your permissions. List them, because each has its own failure mode.
| Part | Examples | What can go wrong |
|---|---|---|
| Packages | The provider SDKs, agent frameworks, parsers | A typosquatted or hijacked package, a malicious update, a vulnerable version |
| MCP servers | A server launched with npx -y something or uvx something |
Whatever is newest runs on your machine or in your network; a server can change its tool descriptions after you approved them; a third-party server sees your tool calls (08E.2, 12.6, Part 4) |
| Skills and instruction files | SKILL.md folders, AGENTS.md-style files (08E.4, 08B.5) |
A skill with scripts or hidden instructions; instructions that widen what the agent will do |
| Model files | Open-weight models, classifiers, embedding models | A pickle file that executes code when loaded; weights altered after publication (12.7, Part 4) |
| Datasets | Fine-tuning data, retrieval corpora, eval sets | Poisoned or mislicensed data |
| Tool and prompt definitions | Tool descriptions, system prompts from a registry | Edited without review (11C.4, 2.3) |
| Eval tooling | Libraries and platforms | Telemetry, uploads, a dependency tree of its own (3.3) |
The controls are the ones software supply-chain security already knows, applied to these parts. The names below were checked on 1 December 2026.
- Pin and hash. Pin every package to an exact version and verify a hash (
pip install --require-hashes, or a lock file with hashes; pip docs and 12.7, 5.2). This course writes install commands without==pins because the lock file is the pin. The agent-specific case is the MCP server launch command:npx -y @acme/orders-mcpfetches whatever is newest on every start, while a pinned version and a reviewed digest do not. - Scan for known vulnerabilities.
pip-auditchecks an environment against the Python Packaging Advisory Database and exits non-zero on a known vulnerability, so it works in CI (12.7, 5.2). It finds known issues only. - Review what you run. Read MCP server code or use a vetted internal mirror; allow-list the tools you actually need (14A.6, 08E.3); review skills that contain scripts like code, because they are code. The official MCP Registry (in preview as of 1 December 2026) hosts metadata about public servers and verifies namespaces through GitHub or DNS, so you know who published a name; its documentation says it delegates security scanning to the underlying package registries and downstream aggregators, and does not host private servers (MCP Registry). A registry entry tells you who published a server, not that the server is safe.
- Verify model files. Prefer formats that cannot run code on load (safetensors over pickle, per 12.7, 4.1), pin a checksum, and check a signature where the publisher provides one. The OpenSSF Model Signing (OMS) project defines a signing and verification format for machine-learning models, with a
model-signingPython package; signatures follow the Sigstore bundle format and can use keyless Sigstore, a private PKI or bare keys (per OpenSSF's project materials, verified 1 December 2026; check the project for the current release). - Build provenance. SLSA (Supply-chain Levels for Software Artifacts) is a set of incrementally adoptable guidelines for supply-chain security. Its current spec is version 1.2, with a Build track (levels 1 to 3) and a Source track (slsa.dev). Awareness is enough for an application team: when you pick a dependency or an internal build system, "does it produce SLSA provenance?" is a fair question.
- Keep a bill of materials. A software bill of materials (SBOM) lists the components of a system. CycloneDX is an SBOM format whose specification is standardised as ECMA-424; the second edition (December 2025) defines CycloneDX 1.7 (Ecma). CycloneDX has an ML-BOM capability for AI systems that records models, datasets, their provenance and the dependencies between them (CycloneDX). 11C.4, 2.2 also mentions the OWASP AI-BOM initiative. The agent inventory of 14A.6 is a first cousin of an AI BOM: it lists agents, tools and models; an SBOM lists the libraries and files underneath.
The code audits a made-up stack of packages, MCP servers, skills and model files, checks a file against a pinned hash, and writes a minimal CycloneDX-shaped BOM.
# supply_chain.py: audit an agent stack's dependencies, MCP servers, skills and model files (stdlib only)
import hashlib
import json
import tempfile
from pathlib import Path
STACK = {
"packages": [ # what a lock file gives you: exact version, source and a hash
{"name": "openai", "version": "3.42.1", "sha256": "ab12" * 16, "source": "pypi"},
{"name": "anthropic", "version": "2.4.0", "sha256": "cd34" * 16, "source": "pypi"},
{"name": "fast-pdf-utils", "version": "latest", "sha256": "", "source": "pypi"},
{"name": "internal-tools", "version": "0.9.0", "sha256": "", "source": "git+https://example.com/x.git@main"},
],
"mcp_servers": [
{"name": "io.github.acme/orders", "launch": "npx -y @acme/orders-mcp", "pinned": False, "reviewed": True, "tools_allowed": ["orders_get"]},
{"name": "com.example/weather", "launch": "uvx weather-mcp==1.4.2", "pinned": True, "reviewed": True, "tools_allowed": ["forecast"]},
{"name": "community/everything", "launch": "npx -y everything-mcp@2.0.1", "pinned": True, "reviewed": False, "tools_allowed": ["*"]},
],
"skills": [
{"path": "skills/refund-policy/SKILL.md", "has_scripts": False, "reviewed": True, "author": "team-support"},
{"path": "skills/web-scraper/SKILL.md", "has_scripts": True, "reviewed": False, "author": "unknown"},
],
"models": [
{"name": "triage-classifier.safetensors", "format": "safetensors", "sha256": "", "signed": False, "source": "hub"},
{"name": "legacy-ranker.pkl", "format": "pickle", "sha256": "ef56" * 16, "signed": False, "source": "hub"},
],
}
def audit(stack):
out = []
for p in stack["packages"]:
if p["version"] in ("latest", "") or not p["sha256"]:
out.append(f"package {p['name']}: not pinned to a version and hash")
if p["source"] != "pypi":
out.append(f"package {p['name']}: installed from {p['source']} (a moving branch, not a release)")
for m in stack["mcp_servers"]:
if not m["pinned"]:
out.append(f"mcp {m['name']}: launch command {m['launch']!r} fetches whatever is newest")
if not m["reviewed"]:
out.append(f"mcp {m['name']}: never reviewed")
if "*" in m["tools_allowed"]:
out.append(f"mcp {m['name']}: exposes every tool; allow-list the ones you need")
for s in stack["skills"]:
if s["has_scripts"] and not s["reviewed"]:
out.append(f"skill {s['path']}: contains scripts nobody reviewed (author: {s['author']})")
for m in stack["models"]:
if m["format"] == "pickle":
out.append(f"model {m['name']}: pickle files can run code on load; prefer safetensors or isolate")
if not m["sha256"]:
out.append(f"model {m['name']}: no pinned checksum")
if not m["signed"]:
out.append(f"model {m['name']}: no signature from the publisher")
return out
def verify_file(path, expected_sha256):
h = hashlib.sha256(Path(path).read_bytes()).hexdigest()
return h == expected_sha256, h
def minimal_bom(stack):
"""A minimal CycloneDX-shaped BOM: libraries and models as components. Illustrative, not schema-validated."""
comps = [{"type": "library", "name": p["name"], "version": p["version"], "purl": f"pkg:pypi/{p['name']}@{p['version']}"}
for p in stack["packages"] if p["source"] == "pypi" and p["version"] != "latest"] # unpinned: cannot be listed
comps += [{"type": "machine-learning-model", "name": m["name"],
"hashes": [{"alg": "SHA-256", "content": m["sha256"]}] if m["sha256"] else []} for m in stack["models"]]
return {"bomFormat": "CycloneDX", "specVersion": "1.7", "version": 1, "components": comps}
if __name__ == "__main__":
for line in audit(STACK):
print("-", line)
with tempfile.TemporaryDirectory() as d:
weights = Path(d) / "model.bin"
weights.write_bytes(b"pretend these are model weights")
pinned = hashlib.sha256(b"pretend these are model weights").hexdigest()
print("\nverify untouched file:", verify_file(weights, pinned)[0])
weights.write_bytes(b"pretend these are model weights, plus a backdoor")
ok, got = verify_file(weights, pinned)
print("verify swapped file: ", ok, "| got", got[:12], "expected", pinned[:12])
bom = minimal_bom(STACK)
print(f"\nBOM: {bom['bomFormat']} {bom['specVersion']}, {len(bom['components'])} components; first and last:")
print(json.dumps([bom["components"][0], bom["components"][-1]], indent=2))- package fast-pdf-utils: not pinned to a version and hash
- package internal-tools: not pinned to a version and hash
- package internal-tools: installed from git+https://example.com/x.git@main (a moving branch, not a release)
- mcp io.github.acme/orders: launch command 'npx -y @acme/orders-mcp' fetches whatever is newest
- mcp community/everything: never reviewed
- mcp community/everything: exposes every tool; allow-list the ones you need
- skill skills/web-scraper/SKILL.md: contains scripts nobody reviewed (author: unknown)
- model triage-classifier.safetensors: no pinned checksum
- model triage-classifier.safetensors: no signature from the publisher
- model legacy-ranker.pkl: pickle files can run code on load; prefer safetensors or isolate
- model legacy-ranker.pkl: no signature from the publisher
verify untouched file: True
verify swapped file: False | got a4d713e2e668 expected 68d8038c6e9a
BOM: CycloneDX 1.7, 4 components; first and last:
[
{
"type": "library",
"name": "openai",
"version": "3.42.1",
"purl": "pkg:pypi/openai@3.42.1"
},
{
"type": "machine-learning-model",
"name": "legacy-ranker.pkl",
"hashes": [
{
"alg": "SHA-256",
"content": "ef56ef56ef56ef56ef56ef56ef56ef56ef56ef56ef56ef56ef56ef56ef56ef56"
}
]
}
]Every line is a finding with an owner. The unpinned package and the one installed from a moving branch can change under you. The MCP server launched with npx -y and no version fetches the newest release on every start. The community server that was never reviewed also exposes every tool. The skill with scripts and an unknown author is code nobody read. The pickle model can execute code when loaded. The hash check at the bottom is the control working: the untouched file verifies, and the swapped file does not.
The BOM lists only components with a real version, and that is intentional: a component you cannot name and version cannot be in a BOM, and a component not in the BOM is one you cannot patch when a vulnerability is announced. The BOM is minimal and was not validated against the CycloneDX schema. Use a real generator for production (the CycloneDX project maintains tools), then validate its output. The hashes in this example stack are placeholders.
3.3 Eval tooling is a vendor too#
Eval libraries and platforms receive your test cases, which are often copied from production, and they are software with telemetry and dependency trees. They belong in the vendor register and the supply-chain audit like any other tool. The specifics live in the eval track and are not repeated here:
| Question | Where the answer is | What it covers |
|---|---|---|
| Who owns the package, what licence, what could change? | 10B.1, 2.4 Governance, licences and what they mean for you | Owner, licence, business model, data flow by default, for both packages |
| What does it send by default, and how is it switched off? | 10B.1, 5.3 The environment files and telemetry | What anonymous usage events contain, the opt-out switches, the legacy package's separate switch |
| What commands send data off the machine? | 10B.1, 5.7 Commands that leave the machine | Commands that contact the platform or call hosted models |
| What does an eval log reveal when shared? | 10B.1, 5.6 Inspect records your git remote (optional) | Repository URL and commit in log headers |
| Is telemetry the same as upload? What does a platform upload? | 10B.7, 5.5 Telemetry is not the same as upload | Three kinds of outbound data and three switches; evaluation data leaves only when a platform key is configured |
| How does the platform handle data, and what should you ask? | 10B.7, 5.6 Data handling | The vendor's stated protections, and the procurement questions: classification, residency, retention, subprocessors, exit path |
The governance move is to turn those facts into register entries and CI checks. In the register above, eval-library has telemetry: "default on" and the opt-out unset, so the check flags it: the fix is to set the documented opt-out in every environment that runs it (laptop and CI), as 10B.1, 5.3 explains. eval-platform is flagged for an unknown training position, no DPA and no exit plan, which are exactly the questions 10B.7, 5.6 says to ask. And the eval dataset question is a data-class question: use the redactor and router of Part 1 so only public or redacted text reaches a platform. Part 5 gives you an egress check that proves a run sent nothing out.
Part 4: Standards awareness: NIST AI RMF and ISO/IEC 42001#
Reference
Customers and procurement teams will ask whether you "align to NIST" or are "ISO 42001 certified". The full explanation now lives in the compliance lesson, so it is not repeated here: 12.9, 6.8 to 6.11 covers the difference between a law, a framework and a management system standard, the NIST AI RMF (four functions, the Generative AI Profile, the Playbook) and ISO/IEC 42001 (structure, Statement of Applicability, certification versus conformance), with dates checked on 1 December 2026, and a runnable script that maps your controls to the four NIST functions and shows the gaps. The EU AI Act and its 2026 date changes are in 12.9, 4.2.
What matters for this lesson is how the standards connect to the work above:
- The NIST AI RMF GOVERN function asks for an inventory of AI systems and for policies on third-party risk. The agent inventory of 14A.6 and Parts 2 and 3 of this lesson (provider terms, vendor register, supply chain) are the evidence an engineer supplies.
- Neither document is passed by running tests. A red-team or eval tool's "NIST" or "ISO 42001" preset is a coverage checklist, not a compliance result (10B.7, 1.3 says the same from the tooling side).
Part 5: Evaluate it#
This lesson's controls are testable: the redactor catches what it claims to catch, the router blocks what it should, the vendor register matches the data you send, and a tool that is meant to send nothing out sends nothing out. As in 14A.6, Part 6, there are two layers: deterministic checks of your governance code (cheap, run on every commit) and measurements of a real model's behaviour under those controls.
5.1 Where to read first#
Start with the concept lessons, then the tooling.
- 10A.7 Evaluating Agents, Tool Use and Multimodal Systems is the concept home for agent evaluation. For this lesson read 4.4 Budget, permission and policy compliance: an agent that sends a prohibited data class to a tool is a policy violation you can score.
- 10A.11 applies where memory holds personal data: deletion and "forgetting" are testable behaviours. 10A.12 applies when agents pass data to each other.
Then the eval-tooling facts this lesson relies on, which are the specifics for what an eval tool sends and keeps:
- 10B.1, 5.3 (telemetry and environment files) and 5.7 (commands that leave the machine); 2.4 for licences and governance.
- 10B.7, Part 1, which runs red-team tests against standards checklists (the standards summarised in Part 4), and 5.5 and 5.6 on telemetry versus upload and data handling.
The DeepEval lessons (required track):
- 10B.2 DeepEval Fundamentals: test cases and the runner, and its telemetry section (1.5).
- 10B.3 Judges, 10B.4 Built-in Metrics (several metrics concern privacy-like failures), 10B.5 Tracing and Agent Evaluation, 10B.6 Datasets and 10B.7 DeepEval in Production: the full set for building and running the checks in CI.
The optional Inspect lessons:
- (optional) 10B.1, 5.6 on what Inspect logs record, 10B.8 Inspect AI Fundamentals to 10B.17 DeepEval or Inspect?, and 10B.15 for sandboxed runs whose network access you control.
5.2 What to measure for this lesson#
| What | How | Typical pass rule |
|---|---|---|
| Redaction recall | Text with planted values of each structured class (emails, phones, cards, keys, ids) | 100% of planted structured values removed. Names and addresses reported separately as a known miss, not hidden |
| Over-redaction | Lures that look sensitive but are not (an order number, a date) | Lures survive. Too many false positives and people turn the redactor off |
| Routing conformance | (text, destination, expected action) cases for every class and destination | Zero mismatches; nothing above internal reaches an unvetted destination |
| Deletion coverage | Create records for a test user in every store, erase, count survivors | Zero rows left for the user in any store, including traces, indexes and eval sets |
| Register completeness | Compare data flows (from gateway or egress logs) with the register | Zero flows to unregistered vendors; zero flows above a vendor's ceiling |
| Egress | Run the eval or agent with the network blocked and count connection attempts | Zero attempts when the opt-out is set |
| Cross-user leakage in outputs | Do outputs repeat planted personal data across users? (10B.4 metrics) | Zero cross-user leaks, reported with an interval |
5.3 A concrete tiny eval#
Inputs: eight short texts, each with the values that must disappear, the values that must survive (lures), and a documented known miss. Metric: recall on planted values and lures left intact. Pass rule: recall 7 of 7 planted values and 8 of 8 lures intact, and the known misses listed rather than hidden. The test is only convincing if you also make it fail on purpose: delete the email pattern and confirm recall drops.
# redaction_eval.py: measure the redactor on labelled text, and list what it is known to miss (stdlib only)
import data_governance as dp
# (text, planted values that must NOT survive redaction, values that must survive untouched)
CASES = [
("Refund A17 for ana@example.com", ["ana@example.com"], ["A17"]),
("Call me on +1 415 555 0132 tomorrow", ["415 555 0132"], ["tomorrow"]),
("Card 4242 4242 4242 4242 charged twice", ["4242 4242 4242 4242"], ["charged twice"]),
("SSN 123-45-6789 on file", ["123-45-6789"], ["on file"]),
("key sk-FAKEFAKEFAKEFAKE1234 leaked", ["sk-FAKEFAKEFAKEFAKE1234"], ["leaked"]),
("Order 4242 4242 4242 4241 is late", [], ["4242 4242 4242 4241"]), # fails Luhn: a lure, must survive
("Ticket 2026-11-28 was closed", [], ["2026-11-28"]), # a date: a lure, must survive
("Mail ana@example.com and bo@example.org", ["ana@example.com", "bo@example.org"], ["Mail"]),
]
KNOWN_MISSES = [ # personal data with no pattern: documented, not hidden
("Ana Lopez lives at 12 Elm Street, Leeds", ["Ana Lopez", "12 Elm Street"]),
]
leaked = overredacted = planted = kept = 0
for text, must_go, must_stay in CASES:
out = dp.redact(text)
planted += len(must_go)
kept += len(must_stay)
bad = [v for v in must_go if v in out]
over = [v for v in must_stay if v not in out]
leaked += len(bad)
overredacted += len(over)
if bad or over:
print("FAIL", text, "| leaked:", bad, "| over-redacted:", over)
print(f"recall on planted values: {planted - leaked}/{planted}")
print(f"lures left intact: {kept - overredacted}/{kept}")
for text, values in KNOWN_MISSES:
out = dp.redact(text)
print("known miss, still visible:", [v for v in values if v in out])recall on planted values: 7/7
lures left intact: 8/8
known miss, still visible: ['Ana Lopez', '12 Elm Street']The known miss is the honest part: the eval documents what the redactor cannot do. A report that says "recall 100%" without the miss list would mislead a reviewer.
The second check proves a tool sends nothing out. It runs code with name lookups and connections blocked and counts the attempts. The toy_eval_run function is a stand-in written for this lesson that behaves like a library with default-on telemetry. It is not any real package; the technique applies to a real eval run, with the real package's documented switch instead of TOY_TELEMETRY_OPT_OUT.
# egress_guard.py: count network attempts made by code under test, without making any (stdlib only)
import os
import socket
import urllib.request
class Attempts:
def __init__(self):
self.hosts = []
def guarded(fn):
"""Run fn() with name lookups and connections blocked. Return (result_or_error, attempted_hosts)."""
seen = Attempts()
real_gai, real_connect = socket.getaddrinfo, socket.socket.connect
def no_gai(host, *a, **k):
seen.hosts.append(str(host))
raise OSError(f"blocked by guard: {host}")
def no_connect(self, addr, *a, **k):
seen.hosts.append(str(addr))
raise OSError(f"blocked by guard: {addr}")
socket.getaddrinfo, socket.socket.connect = no_gai, no_connect
try:
try:
result = fn()
except Exception as e: # the code under test may swallow or raise; we only count attempts
result = f"raised {type(e).__name__}"
finally:
socket.getaddrinfo, socket.socket.connect = real_gai, real_connect
return result, seen.hosts
# Stand-in for a tool that reports usage unless told not to. This is NOT any real package.
def toy_eval_run():
if os.environ.get("TOY_TELEMETRY_OPT_OUT") != "1":
urllib.request.urlopen("http://telemetry.invalid/ping", timeout=1)
return "scores computed locally"
os.environ.pop("TOY_TELEMETRY_OPT_OUT", None)
print("default settings: ", guarded(toy_eval_run))
os.environ["TOY_TELEMETRY_OPT_OUT"] = "1"
print("opt-out set: ", guarded(toy_eval_run))default settings: ('raised URLError', ['telemetry.invalid'])
opt-out set: ('scores computed locally', [])With default settings the guard saw an attempt to reach telemetry.invalid. With the opt-out set, there were no attempts. In CI you run your real eval inside the guard with the documented opt-out set and fail the build on any attempt. 10B.7, 1.6 uses a socket guard in the same spirit, which is a good place to see it applied to a real package. Note the limit: the guard sees connections made from this Python process. A subprocess or a sidecar needs an operating-system level check (a firewall rule or a network namespace), which 10B.15 (optional) touches on for sandboxes.
Common misconceptions#
- "The provider doesn't train on our data, so there is nothing to govern." Training is one question of four. Retention, subprocessors, region and your own copies (logs, traces, indexes, eval sets) remain, and your copies are usually the longest-lived.
- "Zero data retention is on by default." It is a separate arrangement: OpenAI requires prior approval, Anthropic offers it by agreement. The defaults keep data for about 30 days.
- "We redacted the prompt, so the logs are safe." Redaction applies to the copy you redact. Redact at the point data leaves your process, and for every sink.
- "Regex redaction finds all personal data." It finds structured values well and names and addresses poorly. Use it as one layer, publish its misses, and keep minimisation and approved-provider rules.
- "Deleting from the database erases the user." The user's data is also in traces, vector indexes, caches, eval datasets and the vendor's systems. Erase through one function per store and report each.
- "A signed model or a clean scan means it is safe." It means the file came from that publisher and has no known vulnerability. Review and least privilege still apply.
- "Our eval tool is local, so it sends nothing." Many tools send anonymous usage telemetry by default, and a platform receives data once a key is set. Read the telemetry section, set the opt-out, and check egress.
- "We ran a NIST or ISO preset in our red-team tool, so we are compliant." Neither the NIST AI RMF nor ISO/IEC 42001 is passed by running tests, and 42001 certifies a management system, not a model (12.9, 6.8).
Key takeaways#
- Data lands in prompts, logs, traces, indexes, memory, eval data and caches. Each copy needs an owner, a retention period and a deletion path.
- Classify data into a few classes (public, internal, personal, sensitive, secrets), classify up when unsure, and let the class decide the destination.
- Redact before storing, route by class, expire by schedule and erase a person through every store. Pattern matching misses names and addresses, so publish the known misses.
- Both OpenAI and Anthropic state that API data is not used for training by default, keep it about 30 days by default, and offer zero data retention only by approval or agreement. Residency has two halves (inference and storage), a price and exceptions. Check dates, and re-check on change.
- Keep a vendor register, ask the same questionnaire of every vendor including eval tooling (telemetry defaults, what a platform uploads), and check the register against the data you actually send.
- For agent stacks, pin and hash packages, review MCP servers and skills, prefer safe model formats with checksums and signatures, keep an SBOM (CycloneDX, ML-BOM), and know that SLSA exists for build provenance.
- The NIST AI RMF is a voluntary framework and ISO/IEC 42001 a certifiable management system standard. Neither is passed by running tests. Use a framework to find the function with nothing under it, and to organise evidence, not to claim compliance (12.9, 6.8 to 6.11).
- Evaluate your governance with redaction recall and lures, routing conformance, deletion coverage, register completeness and an egress check.
Terms introduced in this lesson#
| Term | Meaning |
|---|---|
| Data classification | Labelling data with a class (public, internal, personal, sensitive, secrets) that decides how it may be handled |
| Data-flow inventory | A list of every place data lands (prompts, logs, traces, indexes, memory, eval sets), with owner and retention |
| Redaction | Replacing sensitive values with placeholders before the data is stored or sent |
| Luhn check | A checksum that tells a real card number from a number that merely looks like one |
| Routing (data) | Deciding, per class and destination, whether to send as is, send redacted or block |
| Retention schedule | How long each class of data is kept in each place |
| Erasure | Deleting one person's data from every store that holds it |
| Data residency | Where data is stored and processed; for providers, inference geography and storage geography are separate |
| Zero data retention (ZDR) | A provider arrangement under which customer content is not retained after processing |
| Modified Abuse Monitoring | An OpenAI arrangement that excludes customer content from abuse-monitoring logs |
| Data processing agreement (DPA) | The contract that governs how a processor handles personal data for you |
| Subprocessor | A vendor that the vendor you contracted with uses to process your data |
| Vendor register | The inventory of external vendors with data classes sent, terms, region, review date and exit plan |
| Vendor risk questionnaire | The standard list of questions about data, security, subprocessors, telemetry and exit |
| Software bill of materials (SBOM) | A list of the components of a software system |
| ML-BOM | CycloneDX's bill of materials for machine-learning systems, covering models, datasets and dependencies |
| CycloneDX | An SBOM specification, standardised as ECMA-424 |
| SLSA | Supply-chain Levels for Software Artifacts: guidelines and levels for build and source integrity |
| Hash pinning | Requiring a dependency's cryptographic hash to match a recorded value before installing it |
| Model signing | Signing a model file so that consumers can verify who published it and that it is unchanged |
| Egress check | A test that counts network connections a program attempts |
Exercises#
- A new class of leak. Add an IBAN pattern (two letters, two digits, then up to 30 letters or digits) to
data_governance.pyassensitivewith a checksum confirmation if you can. Add a planted case and a lure toredaction_eval.py. Hint: the IBAN check is a mod-97 test on the rearranged number with letters mapped to 10 to 35. A lure can be a product code with the same shape that fails the check. If you skip the checksum, expect the lure to be redacted, and note that in the eval. - Break the eval. Delete the email entry from
PATTERNSand runredaction_eval.py. What does it report? Then restore it and raise the Luhn minimum to 16 digits. Which case notices? Hint: the first change fails the planted email cases (recall drops). The second one fails only if some card in the cases has 13 to 15 digits, so the eval is blind to it unless you add such a card. That is the mutation lesson of 14A.6: a green eval only covers the cases it has. - Register your own stack. Write a
vendors.jsonfor the tools you actually use (provider, tracing, eval) and aFLOWSlist. Run the checker. How many findings do you get, and which would a customer security review ask about first? Hint: start with the flows to the provider and the trace store, then the telemetry fields. Finding "I do not know the training position" is a valid, useful result: write "unknown", not a guess. - Hash a model. Download nothing: create a small file, record its SHA-256 in a JSON pin file, and write
verify_pins.pythat refuses to continue if any file in the pin file differs. Hint: reuseverify_filefromsupply_chain.py. Print the expected and actual hash prefixes, and exit non-zero on a mismatch so CI fails. - Map your controls. Run the
rmf_map.pyscript from 12.9, 6.11, add three controls of your own toCONTROLSand map each to the NIST functions. Where is your thinnest function? Write two sentences you would say to a customer who asks about it. Hint: be honest about the gap. A true "MEASURE is thin: we have evals but no red-team run yet, planned for next quarter" is a stronger answer than a vague "aligned". - Residency reading. Read the two residency pages in 1.6 and write the one-line answer to "Can we guarantee EU-only processing for personal data?" for each provider, including the conditions you need to confirm. Hint: for OpenAI it depends on project creation in an EU region, endpoint and model support, and the storage-only caveat for some regions. For Anthropic,
inference_geocurrently offers"us"and"global", and the Anthropic page lists no EU option; check the page again before answering a customer.
Check yourself#
- Name five places an agent system keeps a copy of user data.Any five of: prompts at the provider, application logs, traces and the trace platform, vector indexes, agent memory, eval datasets and platforms, caches, retry and dead-letter queues, backups.
- Why does
classifytreat unlabelled text asinternalrather thanpublic?Text must be proven public, not assumed. If a label is missing, the safe default is the lowest class that still restricts it (internal), and a detector can raise it. - Why is redacting "later" in a cleanup job weaker than redacting on the way in?A raw value written to a log or sink can be copied to backups, replicas and other systems before any later job runs. Redacting at the point data leaves your process stops the copies from existing.
- What are the two halves of data residency, and how do the two providers differ in how they are set?Where inference runs and where data is stored at rest. OpenAI sets residency per project at creation (regional domains, eligibility through sales). Anthropic uses
inference_geoper request or workspace default and a workspace geo set at creation. - Does "not used for training" mean "not stored" for the OpenAI and Anthropic APIs? What is the default retention, and what reduces it to zero?No. Both providers state API data is not used for training by default, but both keep it for about 30 days by default (abuse-monitoring logs for OpenAI, backend deletion within 30 days for Anthropic). Zero data retention reduces it: OpenAI by prior approval (ZDR or Modified Abuse Monitoring), Anthropic by agreement.
- Name three questions on a vendor risk questionnaire about subprocessors and telemetry.Examples: who are your subprocessors and how do we hear about changes and object; what telemetry do your SDKs send by default and how is it switched off; is our data used for training or product improvement; can we export and delete everything.
- Why is
npx -y some-mcp-servera supply-chain problem, and what is the fix?It fetches and runs whatever is newest on every start, so a hijacked or changed release runs with your permissions. Pin to a reviewed version (and digest), allow-list its tools, and run it in a sandbox.
Further resources#
- 11C.4 — Operating LLM Systems: governance, vendor management, retention and erasure for AI systems.
- 12.9 — Responsible AI, Policy and Compliance: the regulatory landscape, standards and the EU AI Act.
- 12.4 — PII, Privacy and Data Leakage and 12.7 — Securing Data and the Supply Chain: detection, model and software supply chain, vendor checklists.
- 11C.5 — Model Lifecycle on One Page: the one-page version of provider retention, and 14A.6: inventory, risk tiers and policy-as-code.
- 10B.1 — The Eval Framework Track and 10B.7 — DeepEval in Production: licences, telemetry, what leaves the machine, platform data handling, and standards presets.
- OpenAI: Your data, Data residency, Data Processing Addendum.
- Anthropic: How long do you store my organization's data?, Is my data used for model training?, Data residency, Data Processing Addendum, Subprocessors.
- Standards: 12.9, 6.8 to 6.11 (NIST AI RMF, the Generative AI Profile, ISO/IEC 42001, and the control-mapping script), with the primary sources linked from its further resources.
- Supply chain: pip secure installs, pip-audit, SLSA, CycloneDX ML-BOM, ECMA-424, MCP Registry.
← 14A.6 — Agent Inventory, Risk and Autonomy Classification, and Policy-as-Code | Module 14A overview | 14A.8 — Skills Map and Gap Analysis →