Skip to content

Interview question · Prompt Injection & Jailbreaks

Design layered defences against indirect prompt injection. Which layers are deterministic, and which are probabilistic?

Map each control to a specific read, operation or release. Check policy inputs, audience permissions, verdict timing and useful work instead of relying on defense labels.

mediumEssentialNewUpdated Nov 2026

TL;DR: Place controls against specific prohibited reads, releases and effects, and state what each actually enforces. Deterministic implementation is useful only with correct policy inputs and complete coverage; learned defenses can reduce observed failures or block covered releases without establishing permission. Combine them around a supported workflow and test what happens when each layer fails.

How to approach it

Choose a concrete assistant, identify the source author and draw the actual data and action paths. List the audiences and operations the current grant permits. Place each control before the consequence it is meant to prevent, then name its assumptions and remaining gaps. Do not make the design a list of products or a universal ranking of controls.

A strong answer

A fictional account-support assistant reads selected customer messages and internal staff notes, then prepares a reply. The customer can edit message text but cannot read staff-only notes, add recipients or change the worker's account permissions. The worker may read both sources; that does not automatically authorize sending both sources back to the customer.

PROPERTY, ENFORCEMENT AND COVERAGE
Layer the checks around actual resources and audiences
  1. 1

    1 · Read the selected records

    Current caller permissions

    • A worker may read more than a customer may receive

    Read authorization is one decision

  2. 2

    2 · Process source material

    Scoped contexts and measured defenses

    • Preserve useful work and trace derived values

    A clean score does not grant authority

  3. 3

    3 · Admit the actual release

    Content, audience and operation

    • Enforce the current grant on every covered path

    Check timing and fallback behavior

  4. 4

    4 · Verify the result

    Denied, delivered or unresolved

    • Protect evidence and inspect missing outcomes

    Keep language and effect failures distinct

Build the permission layer from trusted identity and current policy inputs. The retrieval service checks which records the worker may access. The reply service separately checks the actual audience and allowed content flow. Shared records can be legitimate reads; "only the user's own data" is too narrow to describe every valid access model.

A narrow tool can reduce the operation space. For example, a reply function can resolve a selected thread in service code rather than accept arbitrary recipient text. Yet existing thread participants are not automatically entitled to every staff note or attachment. Check recipient membership, actual audience, content restrictions and the current task grant together. A narrow function signature alone does not prove the right policy.

Review the layers with their precise claims:

LayerProperty it can supportAssumption or gap to inspect
Resource authorizationReject reads outside the current caller grantTrusted identity, policy freshness and every read path
Restricted effect interfaceAdmit only allowed operations and parametersThe allowed set must match the task, including cumulative limits
Data-flow and audience policyPrevent a covered release to a forbidden audienceCorrect labels, derivations and complete release mediation
Rendering restrictionsPrevent specified client fetches or active contentPreview, export and other rendering paths need their own coverage
Source cues and trained priorityImprove measured handling of conflicting source instructionsActual model, representation, cases and useful-work results
Classifier-based gateBlock covered inputs or releases at its operating pointMisses, false blocks, verdict timing and fallback behavior

A domain allowlist can enforce membership in a destination set. That set may include a shared host with unauthorized accounts, so it does not establish audience permission by itself. Likewise, disabling remote images on one view addresses that fetch path; it does not close every disclosure through text, exports, links or other clients.

The design can separate planning from source reading where the task permits. A committed workflow and a quarantined reader reduce certain ways source prose reaches a planner. They still pass values to later steps, and a fixed program can contain data-dependent branches. Inspect the argument and release policies as described in the architecture lesson.

Use source marking, hierarchy-aware behavior and classifiers where evaluation supports their benefit. A classifier can be preventive when its verdict gates the relevant release. Its empirical coverage is a different assurance claim from a service refusing a recipient outside a trusted grant. Calling one component probabilistic does not make its observed prevention unreal; calling another deterministic does not make its policy correct.

If human approval is required, bind it to the actual immutable operation and show the relevant audience, content and effect. A current bounded standing grant can legitimately permit automation. The choice should follow the task and release requirements, with meaningful review capacity measured, rather than requiring a click for every action or accepting every click as informed authorization.

Failure handling belongs in the layer design. A required check that times out must use its specified hold or restricted fallback. A denied operation must not be silently retried through another tool. A missing effect receipt must not become an automatic success label or a reason to repeat an uncertain action.

For evidence, record minimized source references, policy and component versions, decisions and actual release outcomes with suitable access and retention. Unexpected actions are investigation signals, not automatic proof of injection. A later turn may still depend on an earlier source through memory or a summary even after raw text leaves context; inspect those dependencies instead of assuming a context reset erased them.

Test the system only in owned or explicitly authorized isolated environments with synthetic records and controlled effects after real checks. Include wrong recipients, forbidden content flows, guard timeouts, alternate paths and valid replies. Measure source-following errors, denied proposals, confirmed exposure, unknown outcomes and lost useful work separately. Each requirement needs evidence; one aggregate success rate cannot certify the whole design.

What interviewers probe next

  • "Which layer would you build first?" Address a concrete unmet requirement with the highest relevant consequence; for this case, separate staff-note readership from the customer reply grant.
  • "The sender is limited to thread participants. Is exfiltration solved?" No; verify that each participant may receive the specific content and that other release paths are covered.
  • "Can the classifier run after streaming starts?" Only if the relevant protected release remains safely held or constrained; a late verdict cannot retract delivered text.

What if?

What if · interview follow-ups

Hold your answer as the constraints change

A fictional account-support assistant reads customer messages and staff-only notes to prepare replies. Customers control message text, while service code owns the worker's read permissions and the customer reply grant.

  1. Start here

    The worker may read a staff note. Can the assistant include it in a customer reply?

How it's scored

The design should connect every asserted property to its implementation and its evidence.

Weak: Lists guardrails, treats deterministic code as automatically correct, or assumes a known hostname or thread member is always authorized.

Hire: Places resource, action and release checks along the actual workflow and explains the coverage limits of learned defenses.

Strong Hire: Tests trusted policy inputs, alternate paths, failure timing and derived state while preserving allowed replies and meaningful evidence.

Common mistakes

  • Using a successful read check as permission to send the same content elsewhere.
  • Equating a narrow tool name with a correct audience policy.
  • Logging full sensitive context for every event without a justified evidence plan.
  • Treating a blocked operation as proof that no misleading or confidential text reached a reader.
You just read a free answer. Every topic opens its first 5 answers to anyone. Sign in and the count per topic goes to 10, and we keep track of how far you get in every topic.Google sign-in · free · no payment details
HOW DID IT GO?
0
READING SIGNED OUT

Signing in doubles your free answers, from 5 to 10 per topic, and the site starts remembering you: mastery per topic, bookmarks, and a next-focus recommendation. Free, no card.

Sign in free
UP NEXT ON YOUR JOURNEY
DISCUSSION · 0

No comments yet. Share a correction or a different way to answer it.