ari-injection-detection
ARI's 27-pattern injection detection across 6 categories
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
ARI's 27-pattern injection detection across 6 categories
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
Discord slash commands, approval routing, channel policy, button interaction patterns for OpenClaw/ARI Discord integration
Obsidian vault integration patterns — vault-analyzer.ts, /ari-vault-* commands, morning briefing snippet, PARA structure, read-only enforcement
OpenClaw plugin development patterns — hooks, manifest structure, plugin SDK, APEX/CODEX enforcement
NOVA's P1 PayThePryce pipeline — market signal ingest, card detection, price monitoring, script generation, thumbnail generation, video assembly, approval gate
CHASE's P2 Pryceless Solutions pipeline — lead discovery, 5-criteria audit, LLM qualification, Prompt Forge 4-pass lock, demo generation, outreach approval gate
NOVA's thumbnail generation pipeline — Ideogram V3 via Fal.ai (primary) + DALL-E 3 fallback, 4-variant strategy, Pokemon TCG copyright rules,
| name | ari-injection-detection |
| description | ARI's 27-pattern injection detection across 6 categories |
| triggers | ["injection detection","sanitize input","security patterns","content sanitization"] |
Detect and block injection attacks using ARI's 27-pattern detection system across 6 categories.
const SQL_PATTERNS = [
/(\b(SELECT|INSERT|UPDATE|DELETE|DROP|UNION|ALTER)\b)/gi,
/(--)|(\/\*.*\*\/)/g,
/(\bOR\b|\bAND\b).*[=<>]/gi,
/(;|\x00)/g
];
const COMMAND_PATTERNS = [
/(;|\||`|\$\()/g,
/(\b(rm|mv|cp|cat|chmod|chown|sudo|wget|curl)\b)/gi,
/(>|>>|<)/g,
/(\bnull\b|\/dev\/)/gi
];
const PATH_PATTERNS = [
/(\.\.\/|\.\.\\)/g,
/(%2e%2e%2f|%252e%252e%252f)/gi,
/(\/etc\/|\/var\/|\/usr\/)/gi
];
const XSS_PATTERNS = [
/(<script|<\/script|javascript:)/gi,
/(on\w+\s*=)/gi,
/(<iframe|<object|<embed)/gi,
/(document\.|window\.|eval\()/gi
];
const PROMPT_PATTERNS = [
/(ignore previous|disregard|forget)/gi,
/(system prompt|new instructions)/gi,
/(jailbreak|bypass|override)/gi
];
const EXFIL_PATTERNS = [
/(api[_-]?key|secret|password|token)/gi,
/(base64|btoa|atob)/gi,
/(fetch|xmlhttp|websocket)/gi
];
function assessRisk(content: string): RiskAssessment {
let totalScore = 0;
const detections: Detection[] = [];
for (const category of CATEGORIES) {
for (const pattern of category.patterns) {
const matches = content.match(pattern);
if (matches) {
totalScore += category.weight * matches.length;
detections.push({
category: category.name,
pattern: pattern.source,
matches: matches.length
});
}
}
}
return {
score: Math.min(totalScore / 100, 1.0),
detections,
blocked: totalScore >= 80
};
}
| Category | Weight | Rationale |
|---|---|---|
| SQL Injection | 25 | Direct DB access |
| Command Injection | 30 | System execution |
| Path Traversal | 20 | File system access |
| XSS | 15 | Client-side risk |
| Prompt Injection | 20 | AI manipulation |
| Data Exfiltration | 20 | Data theft |
// In sanitizer.ts
const result = assessRisk(inputContent);
if (result.blocked) {
eventBus.emit('security:injection_detected', {
score: result.score,
detections: result.detections
});
throw new SecurityError('Injection attempt blocked');
}
// Apply trust multiplier
const finalRisk = result.score * trustMultipliers[trustLevel];
Per ARI's philosophy (Jung): Don't suppress, log and understand.
// Even low-risk detections are logged
if (result.detections.length > 0) {
eventBus.emit('audit:log', {
action: 'injection_patterns_detected',
score: result.score,
blocked: result.blocked,
detections: result.detections
});
}
# Run injection detection tests
npm test -- tests/security/injection-detection.test.ts
# Expected: 100% coverage on all 42 patterns