← All courses

EDGE FDE

Intermediate

Stop prompt attacks and leaks

Keep private data private and block prompt-injection before it reaches the model or leaves the device.

Guardrails middleware with injection checks and PII redaction around LanguageModelSession.

Your checks run first. Guardrails.default is Apple's filter, not a complete product policy. iOS 27 and macOS 27 only.

Lessons

  1. How attacks and leaks show up on device
  2. Put middleware in front of the session
  3. Check for injection first
  4. Redact PII on the device
  5. Test the pipeline on device

Key concepts

Takeaways

Agent briefs

Related courses

Run tools in a safe box · Talk to tools with MCP · Make several agents agree first · Route work to the right Apple model