360 Secure SkillHub
360 安全技能中心

Agent Firewall

为 Agent 通信提供实时输入/输出防火墙:输入侧做注入模式匹配、Unicode 与控制字符清理、编码载荷检测、角色混淆识别、速率与大小限制;输出侧做高熵密钥扫描、PII 脱敏、内部路径清理、恶意 URL 拦截与一致性检查,规则以 YAML 配置且对 Agent 只读。

arhadnane
arhadnane
热度 36.05
最近更新 2026-05-18 11:35:48
分类:安全依赖:代码执行 / 读写文件应用场景:工作流 / 数据处理

安装技能

复制下面的话术发给你的 Agent,它会通过 secure-skills 检索并安装该技能。

执行命令安装此 skill: npx secure-skills-cli add agent-firewall
Metadata
name
agent-firewall
description
Real-time input/output filtering for agent communications. Block prompt injection, data exfiltration, and unauthorized commands before they reach the model.
metadata
{"openclaw":{"emoji":"🧱","category":"blue-team"}}

Agent Firewall — Input/Output Guardian

Architecture

[Channel Input] → [INPUT FILTER] → [Agent/Model] → [OUTPUT FILTER] → [Channel Output]
                        ↓                                  ↓
                  ┌─────────────┐                  ┌──────────────┐
                  │ Block List  │                  │ Secret Scan  │
                  │ Pattern DB  │                  │ PII Redact   │
                  │ Rate Limit  │                  │ Path Scrub   │
                  │ Encoding Det│                  │ URL Checker  │
                  └─────────────┘                  └──────────────┘

Input Filters

# Filter Description
1 Injection patterns Regex + heuristic match for "ignore previous", "you are now", role confusion
2 Unicode sanitizer Strip zero-width chars, control characters, RTL overrides
3 Encoding detector Detect Base64, hex, ROT13 encoded payloads in user messages
4 Role confusion Detect fake system messages, assistant impersonation
5 Rate limiter Max messages per user per channel per minute
6 Size limiter Reject inputs exceeding token budget

Output Filters

# Filter Description
1 Secret scanner High-entropy strings + known patterns (AWS key, GitHub token)
2 PII redactor Email, phone, SSN, credit card → [REDACTED]
3 Path scrubber Remove internal filesystem paths from outputs
4 URL checker Block responses containing known malicious URLs
5 Consistency check Verify output doesn't contradict system prompt directives

Configuration

# .security/firewall-rules.yaml
input:
  injection_patterns:
    - pattern: "ignore (all )?previous instructions"
      action: BLOCK
      severity: CRITICAL
    - pattern: "you are now (?!helping)"
      action: BLOCK
      severity: HIGH
  rate_limit:
    max_per_minute: 30
    max_per_hour: 500
  max_input_tokens: 4096

output:
  secret_patterns:
    - name: aws_key
      pattern: "AKIA[0-9A-Z]{16}"
      action: REDACT
    - name: github_token
      pattern: "gh[ps]_[A-Za-z0-9_]{36,}"
      action: REDACT
  pii_redaction: true
  path_scrubbing: true

Guardrails

  • Firewall rules are append-only in production — deletion requires human approval
  • False positives → log, alert, pass through with warning (don't silently drop)
  • All blocks are logged with: timestamp, rule matched, full context, channel, user hash
  • Firewall itself cannot be disabled by agent instructions
  • Rules file is read-only from the agent's perspective