prompt-injection-defense

Implement input validation, tool allow-lists, and output sanitization against prompt injection attacks.

46|4|Updated Jan 27, 2026
One-click install
npx skills add https://github.com/BagelHole/DevOps-Security-Agent-Skills --skill prompt-injection-defense-bagelhole
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: prompt-injection-defense
Source: https://github.com/BagelHole/DevOps-Security-Agent-Skills/tree/main/security/ai/prompt-injection-defense
Command: npx skills add https://github.com/BagelHole/DevOps-Security-Agent-Skills --skill prompt-injection-defense-bagelhole

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill protects AI systems from malicious prompt injection attacks, ensuring the integrity and security of AI-driven applications and workflows.

Core Features & Use Cases

  • Input Validation: Implements checks on user input to detect and neutralize injection attempts.
  • Tool Permissioning: Enforces strict allow-lists for tool usage to prevent unauthorized actions.
  • Output Sanitization: Validates and cleans tool outputs to remove smuggled instructions.
  • Use Case: Protect a customer service chatbot from users trying to make it reveal sensitive system information or perform unauthorized actions by overriding its core instructions.

Quick Start

Apply prompt injection defense measures to the AI system.

Frequently Asked Questions about prompt-injection-defense

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I prevent prompt injection attacks in my LLM application?

You prevent prompt injection attacks by enforcing input validation, tool permission allow-lists, output sanitization, and context isolation boundaries to neutralize malicious overrides and smuggled instructions in LLM workflows.

What is indirect prompt injection from untrusted document retrieval?

Indirect prompt injection occurs when malicious instructions are smuggled into untrusted documents retrieved by the system, which you mitigate through context segregation, output policy checks, and strict instruction hierarchy enforcement.

How do I secure AI tool permissions to prevent unauthorized actions?

You secure AI tool permissions by implementing explicit tool allow-listing and requiring human approval for sensitive operations, ensuring the LLM cannot execute unauthorized actions if its core instructions are overridden.

Does input validation alone stop cross-tenant leakage in AI systems?

Input validation alone does not stop cross-tenant leakage; you need defense in depth combining context segregation, output validation, and strict isolation boundaries to prevent data exposure across tenants.

How do I sanitize tool outputs to remove smuggled instructions?

You sanitize tool outputs by applying output policy checks and validation controls that detect and remove smuggled instructions before the LLM processes the retrieved data, maintaining instruction hierarchy integrity.

When do I need defense in depth for AI security?

You need defense in depth for AI security when deploying systems vulnerable to user input overrides, untrusted document retrieval, or cross-tenant leakage, requiring multiple controls like input validation and output sanitization.