Install
openclaw skills install dataguard-dlpRuntime Data Loss Prevention (DLP) for OpenClaw agents. Multi-layer defense against credential exfiltration, PII leakage, and sensitive data transfer. Intercepts outbound tool calls, scans for patterns, and blocks unauthorized data transfers. First ClawHub plugin with real-time data flow protection.
openclaw skills install dataguard-dlpYou have the DataGuard security skill. This is a runtime enforcement layer that actively prevents data exfiltration.
AI agents can be tricked into sending sensitive data through:
SecureClaw provides behavioral rules. DataGuard provides runtime enforcement.
┌─────────────────────────────────────────────────────────────────┐
│ TOOL EXECUTION FLOW │
├─────────────────────────────────────────────────────────────────┤
│ Agent calls tool (web_fetch, sessions_send, exec) │
│ ↓ │
│ ┌─────────────────────────────────────────────────────────┐ │
│ │ DATA GUARD PRE-HOOK │ │
│ │ ───────────────────────────────────────────────────── │ │
│ │ 1. Extract outbound data (URL params, body, message) │ │
│ │ 2. Run pattern scanner (API keys, PII, paths) │ │
│ │ 3. Check context (sensitive file read this session?) │ │
│ │ 4. Verify domain allowlist │ │
│ │ 5. Calculate risk score │ │
│ └─────────────────────────────────────────────────────────┘ │
│ ↓ │
│ ┌──────────────┬──────────────┬──────────────┐ │
│ │ LOW RISK │ MEDIUM RISK │ HIGH RISK │ │
│ │ (0-2) │ (3-5) │ (6-10) │ │
│ └──────────────┴──────────────┴──────────────┘ │
│ ↓ ↓ ↓ │
│ ALLOW WARN + LOG BLOCK + ALERT │
│ ↓ ↓ │
│ ALLOW REQUIRE APPROVAL │
│ │
└─────────────────────────────────────────────────────────────────┘
| Layer | Name | Function | Enforcement |
|---|---|---|---|
| L1 | Pattern Scanner | Detects credentials, PII, secrets | Automatic block |
| L2 | Context Heuristics | Tracks read→send patterns | Score increase |
| L3 | Domain Allowlist | Only approved external domains | Block unknown |
| L4 | Risk Scoring | Aggregates signals into decision | Tiered response |
| L5 | User Confirmation | High-risk requires approval | Explicit consent |
| L6 | Audit Logging | Records all decisions | Review trail |
Before ANY tool that sends data externally:
echo "$OUTBOUND_DATA" | bash $SKILL_DIR/scripts/dlp-scan.sh
If exit code is non-zero, STOP and alert.
The following patterns trigger immediate block:
CRITICAL (Score: 10)
sk-*, xoxb-*, ghp_*, AKIA*, API keys in generalpassword=, passwd=, pwd=, secret=-----BEGIN.*PRIVATE KEY-----mysql://user:pass@, postgres://...aws_access_key_id, aws_secret_access_keyHIGH (Score: 8)
XXX-XX-XXXX format192.168.*, 10.*, 172.16-31.*.local, .internal, .corp/home/, /root/, /etc/, ~/.ssh/MEDIUM (Score: 5)
LOW (Score: 2)
DataGuard maintains a session context file:
$SKILL_DIR/context/sensitive-reads.json
When you read a file containing credentials or PII, DataGuard logs it:
{
"timestamp": "2026-04-07T16:52:00Z",
"file": "/home/user/.env",
"patterns": ["AWS_KEY", "DB_PASSWORD"],
"risk_level": "HIGH"
}
If you then try to send data externally, DataGuard checks this log:
By default, these domains are ALLOWED:
api.openai.comapi.anthropic.comapi.brave.comdocs.openclaw.aiclawhub.aigithub.comBy default, these domains are BLOCKED:
All other domains: REQUIRE APPROVAL for data outbound.
| Score | Action |
|---|---|
| 0-2 | Allow — no sensitive patterns detected |
| 3-5 | Warn — log the attempt, allow with warning |
| 6+ | Block — require explicit user approval |
When blocked:
$SKILL_DIR/logs/blocked-attempts.logWhen DataGuard blocks an action, you MUST:
Never: Auto-approve, skip approval, or work around the block.
Every blocked attempt logs:
[2026-04-07T16:52:00Z] BLOCKED
Tool: web_fetch
Domain: example.com
Patterns: AWS_KEY, DB_PASSWORD
Risk Score: 12
Data: {"url": "https://example.com/api", "body": "[REDACTED]"}
User: approved / denied / pending
Review logs: bash $SKILL_DIR/scripts/audit-log.sh --recent
If a legitimate action is blocked:
bash $SKILL_DIR/scripts/report-false-positive.shThere is no "disable" switch. If you need to send sensitive data:
When DataGuard blocks something, explain:
Don't just say "blocked" — educate.
Replace $SKILL_DIR with the actual path:
~/.openclaw/skills/dataguard~/.openclaw/extensions/dataguard/skillecho "$DATA" | bash $SKILL_DIR/scripts/dlp-scan.sh
# Exit 0 = clean, Exit 1+ = risk score
# List allowed domains
bash $SKILL_DIR/scripts/domain-allowlist.sh --list
# Add domain (requires approval)
bash $SKILL_DIR/scripts/domain-allowlist.sh --add example.com
# Remove domain
bash $SKILL_DIR/scripts/domain-allowlist.sh --remove example.com
# Log a sensitive file read
bash $SKILL_DIR/scripts/context-track.sh --log "/path/to/.env" "AWS_KEY,DB_PASSWORD"
# Check recent sensitive reads
bash $SKILL_DIR/scripts/context-track.sh --check
# Clear session context
bash $SKILL_DIR/scripts/context-track.sh --clear
# Show recent blocks
bash $SKILL_DIR/scripts/audit-log.sh --recent
# Show all blocks today
bash $SKILL_DIR/scripts/audit-log.sh --today
# Export for review
bash $SKILL_DIR/scripts/audit-log.sh --export
DataGuard and SecureClaw work together:
| Layer | SecureClaw | DataGuard |
|---|---|---|
| Approach | Behavioral rules (follow these instructions) | Runtime enforcement (block at execution) |
| When | Before agent acts | When tool is called |
| Type | Preventive guidance | Active interception |
Use both. SecureClaw teaches good behavior. DataGuard enforces it.
Note: MITRE ATLAS is an attack knowledge base for threat modeling, not a control standard. The techniques below describe what attacks look like. Control requirements come from NIST AI RMF 1.0, NIST SP 800-53 Rev. 5, ISO/IEC 42001, and ISO/IEC 27001 (see Standards Alignment section).
| ATLAS ID | Technique | Attack Pattern | DataGuard Mitigation |
|---|---|---|---|
| T-EXFIL-001 | Data Theft via web_fetch | Agent sends credentials/PII to external URL | L1 pattern scan + L3 domain allowlist + L5 approval |
| T-EXFIL-002 | Unauthorized Message Sending | Agent messages sensitive data to unauthorized recipients | L2 context tracking + session monitoring |
| T-EXFIL-003 | Credential Harvesting | Prompt injection extracts credentials from files/memory | L1 credential patterns + L2 file read tracking |
| T-EXEC-001 | Command Injection via exec | Malicious input triggers dangerous shell commands | L1 output scanning + L2 context awareness |
| T-EXEC-002 | Dangerous Command Chains | Chained commands exfiltrate data (curl | base64) |
| T-MEMORY-001 | Memory Poisoning | Attacker injects malicious data into agent memory | L1 scan memory files, L2 track memory reads |
| T-CONTEXT-001 | Context Injection | Attacker injects instructions via external content | L2 context heuristics, L4 risk scoring |
Threat Modeling vs Control Mapping:
| OWASP ID | Risk | DataGuard Mitigation |
|---|---|---|
| LLM01 | Prompt Injection | L2 context heuristics detect injection patterns, L4 scoring |
| LLM06 | Sensitive Information Disclosure | L1 pattern scanner blocks credential/PII exfiltration |
Edit $SKILL_DIR/config/config.json to adjust behavior:
| Setting | Default | Description |
|---|---|---|
risk_thresholds.low | 2 | Below this score → allow (no warning) |
risk_thresholds.medium | 5 | Warn level → log but allow |
risk_thresholds.high | 6 | Block level → require explicit approval |
auto_block_critical | true | Auto-block any CRITICAL pattern match |
auto_block_high | true | Auto-block any HIGH pattern match |
require_approval_medium | false | Medium-risk requires approval (usually too noisy) |
log_all_attempts | false | Log allowed requests too (for audit trail) |
log_data_previews | false | Store truncated data previews in audit logs (keep off by default to avoid persisting sensitive snippets on disk) |
domain_policy | "allowlist" | allowlist = only approved domains, blocklist = only block bad ones |
context_tracking.enabled | true | Track sensitive file reads across session |
context_tracking.max_age_minutes | 30 | How long a read boosts your risk score |
context_tracking.score_boost_recent_read | 3 | Score bonus for recent sensitive reads |
Edit $SKILL_DIR/scripts/dlp-scan.sh and add a new if block in the appropriate tier:
CRITICAL (score 10) — secrets that should never leave:
if echo "$DATA" | grep -qiE 'your-custom-pattern-here'; then
PATTERNS_FOUND+=("CRITICAL:YourPattern")
RISK_SCORE=$((RISK_SCORE + 10))
fi
HIGH (score 8) — sensitive data like internal identifiers:
if echo "$DATA" | grep -qiE 'your-custom-pattern-here'; then
PATTERNS_FOUND+=("HIGH:YourPattern")
RISK_SCORE=$((RISK_SCORE + 8))
fi
MEDIUM (score 5) — context-dependent data:
if echo "$DATA" | grep -qiE 'your-custom-pattern-here'; then
PATTERNS_FOUND+=("MEDIUM:YourPattern")
RISK_SCORE=$((RISK_SCORE + 5))
fi
Custom pattern examples:
EMP-[0-9]{6}(project-alpha|project-beta)https://internal\.company\.comorg_[a-zA-Z0-9]{24}Comment out or delete the corresponding if block in dlp-scan.sh. Example — disable phone number detection if too noisy:
# Disabled — too many false positives in our context
# if echo "$DATA" | grep -qE '(phone pattern)'; then
# PATTERNS_FOUND+=("MEDIUM:Phone")
# RISK_SCORE=$((RISK_SCORE + 5))
# fi
# Add a trusted domain
bash $SKILL_DIR/scripts/domain-allowlist.sh --add internal.company.com
# Block a known exfil target
bash $SKILL_DIR/scripts/domain-allowlist.sh --block pastebin.com
# List all rules
bash $SKILL_DIR/scripts/domain-allowlist.sh --list
# Check if a domain is allowed
bash $SKILL_DIR/scripts/domain-allowlist.sh --check example.com
Some patterns may behave differently across Linux distros depending on grep version. Run the test suite after any changes:
# Unit tests (41 pattern tests)
bash $SKILL_DIR/tests/test-all.sh
# Integration tests (15+ real-world scenarios)
bash $SKILL_DIR/tests/test-integration.sh
If a pattern fails on your system, simplify the regex — avoid \s, character classes like [:space:], and complex quantifiers. Use literal spaces and simple character ranges instead.
If DataGuard is blocking legitimate critical operations:
bash $SKILL_DIR/scripts/emergency-override.shEMERGENCY_OVERRIDE flagUse sparingly. Every override is logged.
# Scan data for patterns
echo "$DATA" | bash $SKILL_DIR/scripts/dlp-scan.sh
# Check if domain is allowed
bash $SKILL_DIR/scripts/domain-allowlist.sh --check example.com
# View recent blocks
bash $SKILL_DIR/scripts/audit-log.sh --recent
# Report false positive
bash $SKILL_DIR/scripts/report-false-positive.sh
# Emergency override (5 min)
bash $SKILL_DIR/scripts/emergency-override.sh
DataGuard DLP v1.2.0 — Runtime DLP for AI agents. Because rules are only as good as their enforcement.
Author: Jeff Cyprien (github.com/jeffcGit) License: MIT — See LICENSE for details.
DataGuard controls are mapped to established security and AI governance frameworks.
These frameworks provide concrete controls for AI data leakage prevention:
| Framework | Control Domain | DataGuard Implementation |
|---|---|---|
| NIST AI RMF 1.0 | AI governance, data provenance, human oversight | L4 Risk Scoring, L5 User Confirmation, audit logging |
| NIST SP 800-53 Rev. 5 | Access control (AC), audit logging (AU), boundary protection (SC), least privilege | L1 Pattern Scanner, L3 Domain Allowlist, L6 Audit Logging |
| NIST SP 800-207 | Zero Trust Architecture — identity-based access, never trust network location | L3 Domain Allowlist, L5 explicit approval for external sends |
| NIST SP 800-218 (SSDF) | Secure SDLC — secrets handling, dependency security, deployment practices | L1 credential detection, context tracking for CI/CD secrets |
| ISO/IEC 42001 | AI management systems — governance, risk treatment, operational controls | Full L1-L6 stack with audit trail |
| ISO/IEC 27001 | ISMS — classification, access control, incident response, supplier management | L1 classification via pattern matching, L6 incident logging |
| ISO/IEC 27701 | Privacy extension — PII handling, retention, processing controls | L1 PII patterns (SSN, phone, email), L2 context tracking |
| NIST SP 800-171 Rev. 3 | CUI protection in non-federal systems | L1-L6 for controlled unclassified information |
| PCI DSS v4.0.1 | Cardholder data protection — scope, encryption, access logging | L1 credit card patterns, L6 audit logging (supplement, not replace PCI controls) |
| HIPAA Security Rule | ePHI protection — access controls, audit trails, minimum necessary | L1 PII patterns, L2 context tracking for PHI exposure |
| EU AI Act (2024/1689) | Transparency, documentation for GPAI models | L6 audit logging provides compliance evidence |
These are useful for understanding attack patterns, but are not control standards:
| Taxonomy | Purpose | DataGuard Use |
|---|---|---|
| MITRE ATLAS | AI attack knowledge base | Threat model mapping (T-EXFIL-001, T-EXFIL-002, T-EXFIL-003) |
| NIST AI 100-2 | Adversarial ML terminology | Threat categorization, not control requirements |
| OWASP LLM Top 10 | LLM-specific risks | LLM01 (Prompt Injection), LLM06 (Sensitive Disclosure) mitigation |
These are specifications, not security standards:
| Reference | Purpose | DataGuard Use |
|---|---|---|
| RFC 1918 | Private IPv4 address ranges | L1 internal IP detection (10.x, 172.16-31.x, 192.168.x) |
| ISO/IEC 7812 | Card number issuer identification | L1 credit card pattern prefixes (Visa=4, MC=5, Amex=34/37) |
| GDPR Article 4 | PII definitions | L1 PII pattern identification (supplement with ISO/IEC 27701 for controls) |
NIST AI RMF 1.0 and ISO/IEC 42001 are the primary governance frameworks for AI systems. DataGuard's risk scoring and approval workflow directly implement their human oversight requirements.
NIST SP 800-53 and ISO/IEC 27001 provide the control catalog — DataGuard implements AU (Audit), SC (Boundary Protection), and AC (Access Control) controls at the AI agent layer.
PCI DSS and HIPAA are domain-specific — DataGuard patterns help, but domain controls (encryption, access management) are still required.
MITRE ATLAS and NIST AI 100-2 help us understand what attacks look like — but they don't tell us what controls to implement. Use them for threat modeling, not compliance.