npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

clawguardian

v0.2.2

Published

Security plugin for OpenClaw - secret detection, PII filtering, and destructive command protection

Readme

ClawGuardian

Security plugin for OpenClaw that detects and filters sensitive data in tool calls.

Quick Start

openclaw plugins install clawguardian

Features

  • Secret Detection: API keys, tokens, cloud credentials, private keys
  • PII Filtering: SSN, credit cards, email addresses, phone numbers
  • Destructive Command Protection: rm -rf, git reset --hard, DROP TABLE, sudo, etc.
  • Configurable Actions: block, redact, confirm (user approval), agent-confirm (agent acknowledgment), warn, log
  • Severity-Based Rules: Different actions for critical/high/medium/low severity
  • Allowlists: Skip detection for specific tools, patterns, or sessions
  • Custom Patterns: Add your own regex patterns

Or for development:

Configuration

Add to your OpenClaw config (~/.openclaw/openclaw.json):

{
  "plugins": {
    "clawguardian": {
      "secrets": {
        "enabled": true,
        "action": "redact",
        "severityActions": {
          "critical": "block",
          "high": "redact",
          "medium": "redact",
          "low": "warn"
        },
        "categories": {
          "apiKeys": true,
          "cloudCredentials": true,
          "privateKeys": true,
          "tokens": true
        }
      },
      "pii": {
        "enabled": true,
        "action": "redact",
        "severityActions": {
          "critical": "block",
          "high": "redact",
          "medium": "warn",
          "low": "warn"
        },
        "categories": {
          "ssn": true,
          "creditCard": true,
          "email": true,
          "phone": true
        }
      },
      "destructive": {
        "enabled": true,
        "action": "confirm",
        "severityActions": {
          "critical": "block",
          "high": "confirm",
          "medium": "confirm",
          "low": "warn"
        },
        "categories": {
          "fileDelete": true,
          "gitDestructive": true,
          "sqlDestructive": true,
          "systemDestructive": true,
          "processKill": true,
          "networkDestructive": true,
          "privilegeEscalation": true
        }
      },
      "allowlist": {
        "tools": ["safe_tool"],
        "patterns": ["sk-test-.*"],
        "sessions": ["trusted-session"]
      },
      "customPatterns": [
        {
          "name": "internal_token",
          "pattern": "INTERNAL_[A-Z0-9]{32}",
          "severity": "high",
          "action": "block"
        }
      ],
      "logging": {
        "logDetections": true,
        "logLevel": "warn"
      }
    }
  }
}

Actions

| Action | Description | |--------|-------------| | block | Reject the tool call entirely | | redact | Replace sensitive data with [REDACTED] | | confirm | Require user approval (exec/bash tools only, via OpenClaw's approval flow) | | agent-confirm | Block until agent retries with _clawguardian_confirm: true in params | | warn | Log warning but allow execution | | log | Silent logging only |

Severity Levels

| Severity | Secrets | PII | Destructive | Default Action | |----------|---------|-----|-------------|----------------| | Critical | Private keys | - | rm -rf /, DROP DATABASE, dd | block | | High | API keys, tokens, cloud creds | SSN, credit cards | rm -rf, git reset --hard, sudo | redact / confirm | | Medium | - | Email, phone | kill, git checkout | warn / confirm | | Low | - | - | git branch -d | warn |

Agent Confirmation

When a tool call is blocked with agent-confirm, the agent receives a message instructing it to retry with the _clawguardian_confirm: true parameter:

{
  "tool": "some_tool",
  "params": {
    "data": "sensitive content",
    "_clawguardian_confirm": true
  }
}

ClawGuardian injects instructions into the agent's system prompt explaining this mechanism.

API

Hooks

ClawGuardian registers three hooks:

  1. before_agent_start (priority 50): Injects ClawGuardian context into the system prompt
  2. before_tool_call (priority 100): Filters tool inputs, detects destructive commands
  3. tool_result_persist (priority 100): Redacts/blocks sensitive data in tool outputs

Detection Functions

import { detectSecret } from "clawguardian/utils/matcher";
import { detectDestructive } from "clawguardian/destructive";

// Detect secrets/PII in text
const match = detectSecret(text, config);
// Returns: { type, index, length, severity, category, action } | undefined

// Detect destructive commands
const destructive = detectDestructive(toolName, params);
// Returns: { reason, severity, category } | undefined

Development

# Run tests
pnpm test extensions/clawguardian/index.test.ts

# Type check
pnpm build

# Lint
pnpm lint

Pattern Categories

Secrets

  • API Keys: OpenAI, Anthropic, GitHub, Stripe, AWS, GCP, Azure, Twilio, SendGrid, etc.
  • Cloud Credentials: AWS access/secret keys, GCP service accounts, Azure storage keys
  • Private Keys: PEM-encoded RSA/EC/DSA keys
  • Tokens: Bearer tokens, JWT, session tokens

PII

  • SSN: US Social Security Numbers (with and without dashes)
  • Credit Cards: 13-19 digit card numbers with Luhn validation
  • Email: Standard email format
  • Phone: International phone numbers (validated with libphonenumber-js)

Destructive Commands

  • File Deletion: rm -rf, find -delete, xargs rm
  • Git: reset --hard, clean -f, push --force, branch -D
  • SQL: DROP, TRUNCATE, DELETE without WHERE
  • System: shutdown, reboot, mkfs, dd
  • Process: kill -9, pkill, killall
  • Network: iptables, ufw, firewall-cmd
  • Privilege Escalation: sudo, doas, su, pkexec

License

MIT