All questions
Showing of 55What is prompt injection, and why does OWASP rank it as the number one risk for LLM applications?
Answer it yourself first - out loud, or typed below.
How should your speech become text?
Listening… your words appear above as you speak - tap Stop when you're done.
Recording · cr - tap Stop & transcribe when you're done.
Transcribing with AI…
Voice:
Last attempt -
Prompt injection is an attack in which untrusted input causes an LLM to follow an attacker's instructions instead of the developer's. The root cause is architectural: an LLM receives instructions and data in the same token stream. There is no privileged channel that reliably separates the two.
Any text the model reads, whether typed by a user or pulled from a document, can potentially steer its behavior.
The Open Worldwide Application Security Project (OWASP) ranks prompt injection first because it is both high impact and not fully solved. An attack can leak context, trigger unauthorized tools, bypass content policy, or manipulate output shown to users.
Unlike SQL injection, there is no equivalent of parameterized queries that fully fixes it. So mitigation relies on defense in depth. Constrain what the model can access and do, filter inputs and outputs, require human confirmation for consequential actions, and monitor for anomalies.
Every design decision about an LLM feature should assume some injected instruction will eventually get through.
This answer doesn't lend itself to a diagram - it reads best . No credits were charged.
Why there's no diagram: “”
The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓
Explain the difference between direct and indirect prompt injection, with an example of each.
Answer it yourself first - out loud, or typed below.
How should your speech become text?
Listening… your words appear above as you speak - tap Stop when you're done.
Recording · cr - tap Stop & transcribe when you're done.
Transcribing with AI…
Voice:
Last attempt -
Direct prompt injection is when the attacker is the user: they type adversarial input straight into the application.
Indirect prompt injection is when malicious instructions arrive through content the model processes on behalf of a legitimate user. A web page it is asked to summarize, an email in an inbox assistant, or a PDF attachment. Other carriers include a calendar invite and a document retrieved by a RAG pipeline.
The victim never typed anything malicious; the payload rode in on data.
Indirect injection is generally considered the more dangerous class. This is because the injected content can target other people, arrives through channels developers often treat as trusted data, and scales. One poisoned document can attack every user whose assistant reads it.
Direct injection is partly a user-abuse problem handled with moderation and rate limits. At the same time, indirect injection demands treating all retrieved or fetched content as untrusted, restricting agent privileges, and gating consequential actions on human review.
This answer doesn't lend itself to a diagram - it reads best . No credits were charged.
Why there's no diagram: “”
The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓
Why can't prompt injection be fixed the way SQL injection was fixed with parameterized queries?
Answer it yourself first - out loud, or typed below.
How should your speech become text?
Listening… your words appear above as you speak - tap Stop when you're done.
Recording · cr - tap Stop & transcribe when you're done.
Transcribing with AI…
Voice:
Last attempt -
SQL injection was solvable because SQL has a formal grammar. Parameterized queries give the database a structural guarantee: this part is code, that part is data, and the parser enforces the boundary deterministically. No cleverness in the data can cross it.
LLMs have no such boundary. The model consumes a single sequence of tokens and decides probabilistically what to attend to. Chat APIs offer system, user, and tool roles, and models are trained to prioritize system messages. But that priority is a learned tendency, not an enforced rule.
Delimiters, XML tags, and phrases like "never follow instructions in the document below" are suggestions the model usually honors and sometimes does not. This is especially true against inputs crafted to exploit it.
Because the separation is statistical, any filter or instruction hierarchy can be bypassed by a sufficiently creative input, and attackers iterate cheaply.
The model's obedience to instructions is a reliability feature you strengthen, not a security boundary you rely on.
This answer doesn't lend itself to a diagram - it reads best . No credits were charged.
Why there's no diagram: “”
The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓
What is a jailbreak, and how does it differ from prompt injection?
Answer it yourself first - out loud, or typed below.
How should your speech become text?
Listening… your words appear above as you speak - tap Stop when you're done.
Recording · cr - tap Stop & transcribe when you're done.
Transcribing with AI…
Voice:
Last attempt -
A jailbreak is an input crafted to make a model bypass its own safety training. It produces content the model was trained to refuse, such as harmful instructions or policy-violating material.
Historic conceptual examples include role-play framings ("pretend you are an AI with no rules") and hypothetical or fictional wrappers. Encoding tricks can also smuggle a request past refusal behavior.
Prompt injection targets the application around the model. The attacker tries to override developer instructions, leak context data, misuse tools, or defraud users.
The two overlap in technique, since both manipulate model behavior through language. A single attack can be both, for example a jailbreak embedded in a retrieved document.
You reduce jailbreaks with moderation layers and provider safety features. You reduce injection with privilege reduction and output controls, because alignment alone cannot be trusted to hold.
This answer doesn't lend itself to a diagram - it reads best . No credits were charged.
Why there's no diagram: “”
The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓
Why is model alignment, such as RLHF safety training, not a security boundary?
Answer it yourself first - out loud, or typed below.
How should your speech become text?
Listening… your words appear above as you speak - tap Stop when you're done.
Recording · cr - tap Stop & transcribe when you're done.
Transcribing with AI…
Voice:
Last attempt -
A security boundary must be deterministic, enforced, and fail closed. A permission check either passes or it does not, regardless of how persuasive the request is. Alignment is none of those things.
Safety training shifts the probability distribution of model outputs toward refusing harmful requests. The refusal is a learned behavior that adversarial inputs can and regularly do overcome.
New jailbreak techniques are published continuously, and each model release resets the cat-and-mouse game.
There are structural reasons it cannot be airtight. The model cannot verify who is speaking; any text claiming authority might be an attacker.
The engineering implication: treat model refusals as a valuable defense-in-depth layer and a UX safeguard. Place actual security controls in deterministic systems around the model.
A useful rule: the model can be socially engineered, so never give it authority you would not give a well-meaning but gullible intern.
This answer doesn't lend itself to a diagram - it reads best . No credits were charged.
Why there's no diagram: “”
The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓
What is system prompt leakage, and why should you assume your system prompt will eventually be extracted?
Answer it yourself first - out loud, or typed below.
How should your speech become text?
Listening… your words appear above as you speak - tap Stop when you're done.
Recording · cr - tap Stop & transcribe when you're done.
Transcribing with AI…
Voice:
Last attempt -
System prompt leakage means a user discovers the hidden instructions that configure an LLM application. Assume those instructions can eventually be extracted.
Models are built to follow text instructions, not to protect secrets. Attackers can retry, rephrase, and compare outputs until parts of a prompt appear.
Two risks follow:
- Direct risk: any API key, password, customer data, or private rule stored in the prompt may be exposed.
- Indirect risk: leaked safety rules help attackers design better bypasses.
Treat the prompt as configuration, not as a secret store. Keep authorization and business rules in backend code. Store credentials in a vault and reveal them only to trusted tool code. Output filters can catch copied prompt text, but the safe design makes a leaked prompt low impact.
This answer doesn't lend itself to a diagram - it reads best . No credits were charged.
Why there's no diagram: “”
The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓
What data leakage risks should you consider when adding an LLM feature to an existing product?
Answer it yourself first - out loud, or typed below.
How should your speech become text?
Listening… your words appear above as you speak - tap Stop when you're done.
Recording · cr - tap Stop & transcribe when you're done.
Transcribing with AI…
Voice:
Last attempt -
Data can leak through several different channels.
First, input-side leakage. User or company data sent to a third-party model API may be retained, logged, or used for training depending on the provider's terms. So you must check data processing agreements and disable training on your data where applicable.
Second, output-side leakage. The model can echo personal data from the context into responses seen by the wrong person. Reveal one user's data to another through shared context or caching bugs, or emit memorized training data.
Third, retrieval leakage: a RAG pipeline that ignores document permissions will happily summarize files the requesting user should never see.
Fourth, system prompt leakage of any sensitive configuration placed in instructions.
Fifth, logging and observability. Prompt and completion logs are a rich personal data store that needs the same protection as production databases, including retention limits and access controls.
Mitigations map channel by channel.
This answer doesn't lend itself to a diagram - it reads best . No credits were charged.
Why there's no diagram: “”
The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓
What are provider moderation endpoints, and where do they fit in an LLM application pipeline?
How does the principle of least privilege apply to LLM agents and their tools?
Why must LLM output be treated as untrusted data, and what goes wrong when it isn't?
Why do LLM endpoints need rate limiting beyond what a normal API already has?
What is AI red teaming, and how does it differ from traditional penetration testing?
What is a guardrail in an LLM application, what types exist, and where does each one sit in the request path?
Walk me through the threat model of a typical LLM application. Where are the trust boundaries?
Describe a realistic indirect prompt injection attack chain against an email assistant, and the defenses that matter most.
What role does input filtering play in defending against prompt injection, and what are its limits?
How can output filtering prevent data exfiltration from an LLM application? What specific checks would you implement?
When should an AI agent require human confirmation, and how do you design approval gates people won't rubber-stamp?
Explain the "lethal trifecta" for AI agents and how you would break it in a system you design.
Give an overview of the OWASP Top 10 for LLM Applications, 2025 edition. Which entries do teams most often underestimate?
What causes sensitive information disclosure in LLM applications, and how do you mitigate it?
Design a PII redaction pipeline for prompts sent to a third-party LLM API.
When would you build a custom content classifier instead of relying on a provider's moderation endpoint?
How do Llama Guard-style guardrail models work, and where do they sit in the request lifecycle?
How do structured outputs and schema validation act as a guardrail?
Where do allowlists beat denylists in LLM application security? Give concrete examples.
What is "excessive agency," and how do you right-size an agent's autonomy?
How should secrets be handled in an application that calls LLMs and executes tools?
What supply chain risks are specific to AI applications, and what is "slopsquatting"?
What security risks come with MCP servers and third-party tool integrations, and how do you vet them?
How would you design rate limiting and abuse prevention for a public-facing AI feature?
How can an agent's persistent memory be poisoned, and how do you defend stored memory across sessions?
How can invisible characters, encodings, and images smuggle prompt injections past filters, and how would you normalize input before it reaches the model?
What should you log for an LLM feature, and how do you keep prompt and trace logs from becoming a data-leak liability?
Describe the dual-LLM pattern for handling untrusted content. What are its limitations, and how does CaMeL improve on it?
Why will an injection-detection classifier alone never make an agent safe, and what does adequate defense in depth look like?
How do you sandbox an agent that executes model-generated code?
Design a tool permissioning model for a multi-tool agent platform.
What security risks are specific to RAG systems, and how do you enforce authorization in retrieval?
Explain data and model poisoning attacks and what defenses an application team realistically has.
Your system prompt encodes proprietary product logic. What is a realistic protection strategy?
How can an LLM response exfiltrate data without any tool use, and how do you close those channels?
An LLM's output feeds into SQL queries, shell commands, and rendered HTML in your application. What controls do you need?
How would you stand up a red teaming program for AI features? Cover scope, methods, and cadence.
What metrics and testing artifacts make AI safety and security testing meaningful over time?
What security risks does fine-tuning introduce, and what precautions do you take before and after a tuning run?
An indirect injection incident caused your agent to email exfiltrated data externally. Walk through your incident response.
What isolation guarantees do you need in a multi-tenant AI SaaS, and where do they silently break?
What does the EU AI Act require, and what should an engineer shipping LLM features into the EU know in 2026?
How would you operationalize the NIST AI RMF and its Generative AI Profile in an engineering organization?
Design an enterprise email assistant that reads mail, searches internal docs, and drafts replies, while resisting the lethal trifecta end to end.
A new tool request for an existing agent would create an exfiltration path. How do you reason about and communicate composition risk?
How do you evaluate whether your guardrails actually work, and avoid a false sense of security?
You join a company with several shipped LLM features and no AI security program. Build the case and the 90-day plan.
What new attack surfaces appear in multi-agent systems, and how do you contain a compromised sub-agent?
This answer is part of Pro.
The full written answer, with the trade-offs and follow-ups an interviewer will probe.
No matches
Try a different filter or search term.
AI Security & Guardrails cheatsheet
- The 30-second threat model01
- Why AI security is different02
- OWASP Top 10 for LLM Applications (2025)03
- Prompt injection04
- Prompt injection defense catalog05
- The lethal trifecta06
- Jailbreaks, and why alignment is not a security boundary07
- Data leakage08
- PII handling and redaction pipeline09
- Content moderation10
- Guardrail framework comparison11
- Agent sandboxing checklist12
- + 8 more inside
- + 14 more inside
48 of 55 AI Security & Guardrails answers are in Pro.
Full answers, code samples, and AI explanations that go simpler or deeper. Cancel anytime.
- Full answers + code
- AI explanations, simpler or deeper
- 1,000 AI credits / month
- Cancel anytime
Change topic
Pick a different technology or stack. Your current topic stays put until you choose a new one.
MEAN
MongoDB, Express, Angular, Node.jsMERN
MongoDB, Express, React, Node.jsDjango
Python Full-Stack DevelopmentRuby on Rails
Convention over ConfigurationServerless on AWS
Serverless Architecture on AWSInterviewers also test these - they're common to every stack, whichever one you picked above.
Flutter Mobile
Flutter Cross-Platform Mobile DevelopmentInterviewers also test these - they're common to every stack, whichever one you picked above.
Spring Boot
Enterprise Java Development.NET
Microsoft EcosystemVue
Vue.js, Vite, TypeScript, Tailwind, Node.jsGo Backend
Golang, gRPC, PostgreSQL, Redis, RabbitMQInterviewers also test these - they're common to every stack, whichever one you picked above.
FastAPI
Python, FastAPI, SQLAlchemy, PostgreSQLReact Native
React, TypeScript, Redux, FirebaseiOS Native
Swift, SwiftUI, UIKit, FirebaseAndroid Native
Java, Jetpack Compose, FirebaseDevOps / Platform
Docker, Kubernetes, Terraform, CI/CDInterviewers also test these - they're common to every stack, whichever one you picked above.
AI Engineer
LLMs, RAG, Agents, EvalsAI-Powered Developer
Claude Code, Copilot, Agentic WorkflowsCore SWE Interview Prep
Data structures, algorithms, OS, concurrency, networking, gitInterviewers also test these - they're common to every stack, whichever one you picked above.
Interviewers also test these - they're common to every stack, whichever one you picked above.