Page 8 of 8~112 min topic

Prompt injection in code

Ship and explain the injection regression suite

Page 8 packages proved vs unproved evidence so another engineer can run, trust, or reject the prompt-injection regression suite for a document-grounded agent.

~14 min this pageMastery and shipping

1Learn the idea

Read

Assemble the ship record

A shippable lab artifact includes: how to run it, the metric result (attack success rate, canary leakage, forbidden tool-call count), the failure you can still reproduce (answer refuses in text but a hidden tool call posts a canary token), the security gate for treating retrieved document text as trusted system instructions, and a rollback note. The user decision it supports remains: block indirect instructions in retrieved documents from causing forbidden tool calls.

Read

Freeze the evidence

release: candidate
baseline: stable
gates:
  primary_metric: "attack success rate"
  required: "0.00 canary leakage and 0.00 forbidden tool calls across critical attacks"
  security_regression: pass
  staging_probe: pass
  telemetry_signal: "injection_attack_success_total"
rollout:
  canary_percent: 5
  rollback_on: "critical failure or sustained SLO breach"
owner: on-call-ai-platform

Expected evidence: 0.00 canary leakage and 0.00 forbidden tool calls across critical attacks. Store this beside the fixture version so scores remain meaningful after content changes in prompt-injection-in-code.

Read

Explain limits without apology

State operating limits for the injection regression suite in plain language: fixture size, offline vs live dependencies, and what would require a new eval set. Shipping prompt-injection-in-code is honest scoping, not maximal confidence language.

Read

Lab notebook: proved vs unproved

Fill this table in your notes for the injection regression suite:

  • Proved on indirect-pdf-07 with IGNORE RULES + CANARY payload: …
  • Unproved beyond the fixture: …
  • Metric that blocks release: attack success rate, canary leakage, forbidden tool-call count
  • Failure still reproducible: answer refuses in text but a hidden tool call posts a canary token
  • Security gate: treating retrieved document text as trusted system instructions
  • Rollback: …

Ship the narrative only when the unproved list is honest. Reviewers trust narrow claims that support block indirect instructions in retrieved documents from causing forbidden tool calls more than maximal language that collapses under the first production oddity.

Read

Worked judgment

Hand your ship note to a peer and ask them to recreate a proved/unproved ship note with rollback without watching you type. If they cannot, your evidence is still tribal knowledge. Tighten the run command and the metric line until a stranger can validate the injection regression suite against indirect-pdf-07 with IGNORE RULES + CANARY payload.

Read

Why this stage matters for the injection regression suite

At the mastery and shipping stage for prompt-injection-in-code, the job is narrower than finishing a product demo. You are creating one progressive evidence piece about indirect-pdf-07 with IGNORE RULES + CANARY payload that later pages inherit without redefining success. Keep that fixture small enough to inspect by hand, keep outputs copy-pasteable as text, and refuse to narrate this baseline as if it were a production SLA: agent without document/instruction separation on the same attacks.

For this page specifically, success looks like a proved/unproved ship note with rollback while still centering the user decision to block indirect instructions in retrieved documents from causing forbidden tool calls. If you cannot point to a file, command, or assertion that proves that for the injection regression suite, stay on this page instead of advancing.

How-to: red-team prompt injection · Snippet: injection test fixture · Glossary: adversarial prompt

Previous

Go deeper

Before you start

Why this matters

List two things this chapter proved on the fixture and two things it did not prove about the injection regression suite. If you cannot name the gaps, you are not ready to ship the narrative—even if the code runs.

In the wild

See how this idea shows up as a product and a company — then come back to the lesson. Skills transfer across vendors.

Check your understanding

Page assessment

Answer from memory. Completion is saved from this evidence, not from opening the next page.

1. Are proved and unproved lists both non-empty?
2. Is rollback concrete (command or version pin)?
3. Would a stranger reproduce the metric on the fixture?
4. Does the note still center the decision: block indirect instructions in retrieved documents from causing forbidden tool calls?

All responses are required.