360 Secure SkillHub
360 安全技能中心

Promptguard

基于 FastAPI 的本地服务,POST 接口接收 1-100,000 字符文本,返回风险评分、命中模式与文本长度;检测指令覆盖、HTML 注释注入、零宽字符、分隔符攻击、角色切换与系统提示提取,无认证与测试配置。

分类:安全
mirni
mirni
热度 32.37
最近更新 2026-05-11 17:42:41

安装

发给 Agent
帮我安装这个技能:npx secure-skills-cli add mirni/promptguard
兼容性
通用兼容
联网要求
不联网
数据出网
数据不出本机
Metadata
name
promptguard
description
Detect prompt injection attacks in text. Returns risk score and detected patterns.
version
0.1.1
metadata
{"openclaw":{"requires":{"bins":["python"]},"install":[{"kind":"uv","packages":["fastapi","uvicorn","pydantic"]}]}}

PromptGuard

A security API that scans text for common prompt injection patterns and returns a risk score. Designed for AI agents that process untrusted text input from external sources.

What It Detects

  • Instruction override attempts
  • HTML comment injection
  • Zero-width unicode characters
  • Delimiter-based attacks
  • Role switching tokens
  • System prompt extraction attempts

Installation

pip install fastapi uvicorn pydantic

Usage

Start the server:

uvicorn promptguard.app:app --port 8000

Then send a POST request:

curl -X POST http://localhost:8000/v1/scan \
  -H "Content-Type: application/json" \
  -d '{"text": "What is the weather in London today?"}'

Response (clean text):

{
  "risk_score": "0",
  "patterns_detected": [],
  "input_length": 38
}

Request

Field Type Required Description
text string yes Text to scan (1-100,000 chars)

Response

Field Type Description
risk_score decimal 0.0 (safe) to 1.0 (high risk)
patterns_detected list Names of detected patterns
input_length integer Length of input text