Search

PythonReactSEOPDF
OpenClaw

Prompt Injection Protection

Prompt Injection Protection Skill

blackworm0 source installs☆ 0 Repository stars

Installation

Follow the repository instructions for this skill and your agent. Review the files and dependencies before adding it to your workflow.

SkillHub CLI

skillhub install blackworm/prompt-injection-protection

Inspect the source and compatibility requirements, then follow its installation steps.

Give your agent the source link and ask it to inspect instructions and dependencies before explaining the installation steps.

View source ↗Guides

Skill instructions

Prompt Injection Protection Skill

Description

A comprehensive skill to protect against prompt injection attacks when processing external content such as websites, emails, documents, and other untrusted input sources.

Purpose

This skill provides methods to safely sanitize, validate, and process external content to prevent malicious prompt injection attempts that could manipulate the AI's behavior or cause it to execute unintended actions.

Features

  • Content sanitization and validation
  • Prompt injection detection and filtering
  • Secure processing of web content
  • Safe extraction of information from untrusted sources
  • Protection against jailbreak attempts

Security Measures

  • Input sanitization
  • Output encoding
  • Context isolation
  • Validation of external content
  • Prevention of instruction hijacking

Usage

The skill provides functions to:

  • Sanitize external content before processing
  • Validate content against injection patterns
  • Safely extract information from untrusted sources
  • Process web content securely
  • Filter potentially harmful instructions

Source information

Source
github
Repository
openclaw/skills
Path
skills/blackworm/prompt-injection-protection
Version
—
Commit
8590a1dc19a174eccd4e6649b0a738c0068084b9
Classification source
rules
Status
active
Visibility
public

These signals come from indexed source analysis and may lag behind changes. Check the current source files.

README

Prompt Injection Protection Skill

This skill provides comprehensive protection against prompt injection attacks when processing external content such as websites, emails, documents, and other untrusted input sources. It includes real-time security alerts for suspicious activities.

Features

  • Content sanitization and validation
  • Prompt injection detection and filtering
  • Secure processing of web content
  • Safe extraction of information from untrusted sources
  • Protection against jailbreak attempts
  • NEW: Real-time security alerts for suspicious commands
  • NEW: Detection of system file access attempts
  • NEW: User confirmation for risky operations

Security Alert System

The skill now includes a comprehensive security notification system that:

  • Alerts you when suspicious commands are detected
  • Warns about system file access attempts
  • Notifies you of credential/password file access
  • Flags potential injection attempts in web content
  • Requires user confirmation for risky operations

Usage Examples

Basic Usage
const PromptInjectionProtection = require('./index.js');
const protection = new PromptInjectionProtection();

// Set up security alert callback
protection.setSecurityAlertCallback(async (alertInfo) => {
  console.log(`🚨 SECURITY ALERT: ${alertInfo.type}`);
  console.log(`   Severity: ${alertInfo.severity}`);
  console.log(`   Action Required: ${alertInfo.actionRequired}`);
});

// Process external content safely
const result = protection.processExternalContent(untrustedContent, {
  maxLength: 5000,
  strictMode: true
});

if (result.isSafe) {
  // Process the sanitized content
  console.log(result.sanitized);
} else {
  // Handle unsafe content
  console.warn('Potentially unsafe content detected', result.injectionCheck);
}
Command Pre-Checking (NEW FEATURE)
// Check a command before executing it
const commandCheck = await protection.preCheckCommand('sudo rm -rf /', {
  source: 'user_input'...

Extracted content

SKILL.md
# Prompt Injection Protection Skill

## Description
A comprehensive skill to protect against prompt injection attacks when processing external content such as websites, emails, documents, and other untrusted input sources.

## Purpose
This skill provides methods to safely sanitize, validate, and process external content to prevent malicious prompt injection attempts that could manipulate the AI's behavior or cause it to execute unintended actions.

## Features
- Content sanitization and validation
- Prompt injection detection and filtering
- Secure processing of web content
- Safe extraction of information from untrusted sources
- Protection against jailbreak attempts

## Security Measures
- Input sanitization
- Output encoding
- Context isolation
- Validation of external content
- Prevention of instruction hijacking

## Usage
The skill provides functions to:
- Sanitize external content before processing
- Validate content against injection patterns
- Safely extract information from untrusted sources
- Process web content securely
- Filter potentially harmful instructions
README
# Prompt Injection Protection Skill

This skill provides comprehensive protection against prompt injection attacks when processing external content such as websites, emails, documents, and other untrusted input sources. It includes real-time security alerts for suspicious activities.

## Features

- Content sanitization and validation
- Prompt injection detection and filtering
- Secure processing of web content
- Safe extraction of information from untrusted sources
- Protection against jailbreak attempts
- **NEW: Real-time security alerts for suspicious commands**
- **NEW: Detection of system file access attempts**
- **NEW: User confirmation for risky operations**

## Security Alert System

The skill now includes a comprehensive security notification system that:

- Alerts you when suspicious commands are detected
- Warns about system file access attempts
- Notifies you of credential/password file access
- Flags potential injection attempts in web content
- Requires user confirmation for risky operations

## Usage Examples

### Basic Usage

```javascript
const PromptInjectionProtection = require('./index.js');
const protection = new PromptInjectionProtection();

// Set up security alert callback
protection.setSecurityAlertCallback(async (alertInfo) => {
  console.log(`🚨 SECURITY ALERT: ${alertInfo.type}`);
  console.log(`   Severity: ${alertInfo.severity}`);
  console.log(`   Action Required: ${alertInfo.actionRequired}`);
});

// Process external content safely
const result = protection.processExternalContent(untrustedContent, {
  maxLength: 5000,
  strictMode: true
});

if (result.isSafe) {
  // Process the sanitized content
  console.log(result.sanitized);
} else {
  // Handle unsafe content
  console.warn('Potentially unsafe content detected', result.injectionCheck);
}
```

### Command Pre-Checking (NEW FEATURE)

```javascript
// Check a command before executing it
const commandCheck = await protection.preCheckCommand('sudo rm -rf /', {
  source: 'user_input'...

Related skills

OpenClaw

13-Day Sprint Method

galizki

Productivity system based on Maya calendar with 13 natural tones for project management and personal development

OpenClaw

1password

daggerkun007

Set up and use 1Password CLI (op). Use when installing the CLI, enabling desktop app integration, signing in (single or multi-account), or reading/injecting/running secrets via op.