AI threat surfaces
user input · retrieved content · model artifact · tool calls · model output · logs/telemetry · feedback data- Threat model the entire flow and trust boundaries.
Learn how prompt injection, poisoned retrieved content, sensitive-data leakage and tool abuse become application security problems, and how layered controls reduce risk.
Engineering focus: AI security, safety and governance
Learn how prompt injection, poisoned retrieved content, sensitive-data leakage and tool abuse become application security problems, and how layered controls reduce risk.
The rest of this module introduces the formal terminology and production controls behind that idea. You are not expected to memorize the vocabulary before using it.
Carry the same support assistant forward: approved KB, source citations, explicit insufficient-evidence fallback and one bounded read-only asset lookup. Reuse prior artifacts so each module adds evidence to one production AI system.
Attackers can place adversarial instructions directly in user input or indirectly in documents/web content. No single prompt reliably solves this; use trust boundaries, least-privilege tools, content isolation, authorization and output/action validation.
Prompts, retrieval indexes, conversation history, logs, tool results and training/fine-tuning data can all expose secrets or personal information. Minimize data before it reaches the model and control what is logged.
Model output is untrusted input to downstream software. Escape content for HTML/SQL/shell contexts, validate structured fields and never execute generated code or commands merely because they came from a model.
Track model source/digest/licence, embedding models, prompt/templates, datasets, packages and retrieval content. A poisoned document or untrusted model artifact can change behaviour without a code change.
NIST AI RMF and its Generative AI Profile provide a risk-management structure. The engineering team still needs system-specific owners, acceptance criteria, monitoring and escalation; framework adoption is not a substitute for controls.
Define harms and unacceptable outcomes for the actual application. A support assistant, code agent and medical workflow have different impact boundaries, review requirements and fallback policies.
user input · retrieved content · model artifact · tool calls · model output · logs/telemetry · feedback datauntrusted content isolation + retrieval ACLs + narrow tools + app authorization + output validation + monitoring + human approval for impactGoal: Create an abuse-case table and verify that controls sit outside the model where appropriate.
cat > /tmp/ai-threats.json <<'EOF'
[
{"threat":"indirect_prompt_injection","surface":"retrieved_document","control":"treat document as data; narrow tools; app authorization"},
{"threat":"secret_disclosure","surface":"logs","control":"redaction/minimization and restricted retention"},
{"threat":"unsafe_tool_call","surface":"tool_executor","control":"schema + user authorization + confirmation"}
]
EOFpython3 - <<'PY2'
import json
x=json.load(open('/tmp/ai-threats.json'))
assert len(x)>=3
assert all('control' in r and len(r['control'])>20 for r in x)
assert any('authorization' in r['control'] for r in x)
print('PASS: layered threat controls')
PY2For each threat, add an observable signal: denied tool calls, sensitive-data redaction count, suspicious instruction patterns or retrieval-source anomalies. Monitoring is not the prevention control but makes attacks and drift visible.
AI security combines classic application security with new model/data interaction risks; the controls must surround the model.
Run bundled prompt-injection and unsupported-evidence cases through your local pipeline and store the results for Module 08 evaluation.
unzip -q public/labs/ai/AI-Engineering-Lab-Pack-v0.3.19-r2.zip -d /tmp/ai-sec-packcat /tmp/ai-sec-pack/security/adversarial-cases.jsonlpython3 /tmp/ai-sec-pack/security/check_policy.py /tmp/ai-sec-pack/security/adversarial-cases.jsonlConcept and scenario checks. Reveal the answer only after you commit to a decision.
Because adversarial instructions can enter through untrusted content and become dangerous when the surrounding system grants tools/data authority.
As untrusted input requiring validation/escaping appropriate to the destination.
Model/data sources and versions plus prompts, embedding models, libraries and retrieval content lineage.
The page remains untrusted data and the application authorization/tool policy must deny unauthorized admin actions.
Progress is saved in this browser immediately. When you sign in to My Learning, it can also sync across devices.
Attempt the core lab and knowledge checks before marking the module complete.