LearnThatStack Ace your next interview
AI Engineering
AI Security & Guardrails.
Change topic Change
Practice · Questions

All questions

Showing of 55
Beginner 13
01

What is prompt injection, and why does OWASP rank it as the number one risk for LLM applications?

Beginner ·

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:

Keep going - a few more words and AI can grade it.

Last attempt -

Your answer

Re-explain

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.

Rewriting in plainer words…

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 ↓

Related concept

Tailored explanation · switch back to · ·
What should the new diagram focus on?
How well did you know this?
AI:

02

Explain the difference between direct and indirect prompt injection, with an example of each.

Beginner ·

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:

Keep going - a few more words and AI can grade it.

Last attempt -

Your answer

Re-explain

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.

Rewriting in plainer words…

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 ↓

Related concept

Tailored explanation · switch back to · ·
What should the new diagram focus on?
How well did you know this?
AI:

03

Why can't prompt injection be fixed the way SQL injection was fixed with parameterized queries?

Beginner ·

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:

Keep going - a few more words and AI can grade it.

Last attempt -

Your answer

Re-explain

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.

Rewriting in plainer words…

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 ↓

Related concept

Tailored explanation · switch back to · ·
What should the new diagram focus on?
How well did you know this?
AI:

04

What is a jailbreak, and how does it differ from prompt injection?

Beginner ·

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:

Keep going - a few more words and AI can grade it.

Last attempt -

Your answer

Re-explain

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.

Rewriting in plainer words…

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 ↓

Related concept

Tailored explanation · switch back to · ·
What should the new diagram focus on?
How well did you know this?
AI:

05

Why is model alignment, such as RLHF safety training, not a security boundary?

Beginner ·

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:

Keep going - a few more words and AI can grade it.

Last attempt -

Your answer

Re-explain

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.

Rewriting in plainer words…

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 ↓

Related concept

Tailored explanation · switch back to · ·
What should the new diagram focus on?
How well did you know this?
AI:

06

What is system prompt leakage, and why should you assume your system prompt will eventually be extracted?

Beginner ·

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:

Keep going - a few more words and AI can grade it.

Last attempt -

Your answer

Re-explain

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.

Rewriting in plainer words…

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 ↓

Related concept

Tailored explanation · switch back to · ·
What should the new diagram focus on?
How well did you know this?
AI:

07

What data leakage risks should you consider when adding an LLM feature to an existing product?

Beginner ·

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:

Keep going - a few more words and AI can grade it.

Last attempt -

Your answer

Re-explain

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.

Rewriting in plainer words…

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 ↓

Related concept

Tailored explanation · switch back to · ·
What should the new diagram focus on?
How well did you know this?
AI:

08

What are provider moderation endpoints, and where do they fit in an LLM application pipeline?

Part of Pro
09

How does the principle of least privilege apply to LLM agents and their tools?

Part of Pro
10

Why must LLM output be treated as untrusted data, and what goes wrong when it isn't?

Part of Pro
11

Why do LLM endpoints need rate limiting beyond what a normal API already has?

Part of Pro
12

What is AI red teaming, and how does it differ from traditional penetration testing?

Part of Pro
13

What is a guardrail in an LLM application, what types exist, and where does each one sit in the request path?

Part of Pro
Intermediate 21
14

Walk me through the threat model of a typical LLM application. Where are the trust boundaries?

Part of Pro
15

Describe a realistic indirect prompt injection attack chain against an email assistant, and the defenses that matter most.

Part of Pro
16

What role does input filtering play in defending against prompt injection, and what are its limits?

Part of Pro
17

How can output filtering prevent data exfiltration from an LLM application? What specific checks would you implement?

Part of Pro
18

When should an AI agent require human confirmation, and how do you design approval gates people won't rubber-stamp?

Part of Pro
19

Explain the "lethal trifecta" for AI agents and how you would break it in a system you design.

Part of Pro
20

Give an overview of the OWASP Top 10 for LLM Applications, 2025 edition. Which entries do teams most often underestimate?

Part of Pro
21

What causes sensitive information disclosure in LLM applications, and how do you mitigate it?

Part of Pro
22

Design a PII redaction pipeline for prompts sent to a third-party LLM API.

Part of Pro
23

When would you build a custom content classifier instead of relying on a provider's moderation endpoint?

Part of Pro
24

How do Llama Guard-style guardrail models work, and where do they sit in the request lifecycle?

Part of Pro
25

How do structured outputs and schema validation act as a guardrail?

Part of Pro
26

Where do allowlists beat denylists in LLM application security? Give concrete examples.

Part of Pro
27

What is "excessive agency," and how do you right-size an agent's autonomy?

Part of Pro
28

How should secrets be handled in an application that calls LLMs and executes tools?

Part of Pro
29

What supply chain risks are specific to AI applications, and what is "slopsquatting"?

Part of Pro
30

What security risks come with MCP servers and third-party tool integrations, and how do you vet them?

Part of Pro
31

How would you design rate limiting and abuse prevention for a public-facing AI feature?

Part of Pro
32

How can an agent's persistent memory be poisoned, and how do you defend stored memory across sessions?

Part of Pro
33

How can invisible characters, encodings, and images smuggle prompt injections past filters, and how would you normalize input before it reaches the model?

Part of Pro
34

What should you log for an LLM feature, and how do you keep prompt and trace logs from becoming a data-leak liability?

Part of Pro
Expert 21
35

Describe the dual-LLM pattern for handling untrusted content. What are its limitations, and how does CaMeL improve on it?

Part of Pro
36

Why will an injection-detection classifier alone never make an agent safe, and what does adequate defense in depth look like?

Part of Pro
37

How do you sandbox an agent that executes model-generated code?

Part of Pro
38

Design a tool permissioning model for a multi-tool agent platform.

Part of Pro
39

What security risks are specific to RAG systems, and how do you enforce authorization in retrieval?

Part of Pro
40

Explain data and model poisoning attacks and what defenses an application team realistically has.

Part of Pro
41

Your system prompt encodes proprietary product logic. What is a realistic protection strategy?

Part of Pro
42

How can an LLM response exfiltrate data without any tool use, and how do you close those channels?

Part of Pro
43

An LLM's output feeds into SQL queries, shell commands, and rendered HTML in your application. What controls do you need?

Part of Pro
44

How would you stand up a red teaming program for AI features? Cover scope, methods, and cadence.

Part of Pro
45

What metrics and testing artifacts make AI safety and security testing meaningful over time?

Part of Pro
46

What security risks does fine-tuning introduce, and what precautions do you take before and after a tuning run?

Part of Pro
47

An indirect injection incident caused your agent to email exfiltrated data externally. Walk through your incident response.

Part of Pro
48

What isolation guarantees do you need in a multi-tenant AI SaaS, and where do they silently break?

Part of Pro
49

What does the EU AI Act require, and what should an engineer shipping LLM features into the EU know in 2026?

Part of Pro
50

How would you operationalize the NIST AI RMF and its Generative AI Profile in an engineering organization?

Part of Pro
51

Design an enterprise email assistant that reads mail, searches internal docs, and drafts replies, while resisting the lethal trifecta end to end.

Part of Pro
52

A new tool request for an existing agent would create an exfiltration path. How do you reason about and communicate composition risk?

Part of Pro
53

How do you evaluate whether your guardrails actually work, and avoid a false sense of security?

Part of Pro
54

You join a company with several shipped LLM features and no AI security program. Build the case and the 90-day plan.

Part of Pro
55

What new attack surfaces appear in multi-agent systems, and how do you contain a compromised sub-agent?

Part of Pro

No matches

Try a different filter or search term.

Know someone prepping for AI Security & Guardrails? Send them this set.
Pro · $10/mo

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.

Technologies
No technologies match “”.
Cross-cutting topics
No topics match “”.
By role
Stacks & frameworks

MEAN

MongoDB, Express, Angular, Node.js

MERN

MongoDB, Express, React, Node.js

LAMP

Linux, Apache, MySQL, PHP

Django

Python Full-Stack Development

Ruby on Rails

Convention over Configuration

Serverless on AWS

Serverless Architecture on AWS

Flutter Mobile

Flutter Cross-Platform Mobile Development

Spring Boot

Enterprise Java Development

.NET

Microsoft Ecosystem

Vue

Vue.js, Vite, TypeScript, Tailwind, Node.js

Go Backend

Golang, gRPC, PostgreSQL, Redis, RabbitMQ

FastAPI

Python, FastAPI, SQLAlchemy, PostgreSQL

React Native

React, TypeScript, Redux, Firebase

iOS Native

Swift, SwiftUI, UIKit, Firebase

Android Native

Java, Jetpack Compose, Firebase

DevOps / Platform

Docker, Kubernetes, Terraform, CI/CD

AI Engineer

LLMs, RAG, Agents, Evals

AI-Powered Developer

Claude Code, Copilot, Agentic Workflows

Core SWE Interview Prep

Data structures, algorithms, OS, concurrency, networking, git