secure-agent

Locks down an AI agent by configuring platform-level tool restrictions (deniedTools) and Earl network egress rules. Use after Earl is working and templates are created, to make Earl's security guarantee enforceable rather than advisory.

111 stars

Best use case

secure-agent is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Locks down an AI agent by configuring platform-level tool restrictions (deniedTools) and Earl network egress rules. Use after Earl is working and templates are created, to make Earl's security guarantee enforceable rather than advisory.

Teams using secure-agent should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/secure-agent/SKILL.md --create-dirs "https://raw.githubusercontent.com/mathematic-inc/earl/main/skills/development/secure-agent/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/secure-agent/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How secure-agent Compares

Feature / Agentsecure-agentStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Locks down an AI agent by configuring platform-level tool restrictions (deniedTools) and Earl network egress rules. Use after Earl is working and templates are created, to make Earl's security guarantee enforceable rather than advisory.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# Secure Agent

After Earl is set up and working, this skill restricts the agent's ability to bypass Earl
and make raw API/CLI calls directly. Without this step, CLAUDE.md is just a suggestion.

## What This Does

1. **`deniedTools`**: Blocks specific bash commands (curl, gh, stripe-cli, etc.) at the
   platform level for Claude Code. Agents cannot run these commands at all.
2. **Egress rules**: Restricts which URLs Earl templates can contact, preventing Earl itself
   from being used as an open proxy.

## Important Limitation

`deniedTools` pattern matching can be bypassed via alternative tools (`python3 -c "import
urllib..."`, `node -e "fetch(...)"`, etc.). This blocks accidental or habitual CLI use — the
common case. For stronger containment, pair with OS-level firewall rules or a network proxy.

## Platform Support

| Platform               | Mechanism                                    | Hard restriction?                                       |
| ---------------------- | -------------------------------------------- | ------------------------------------------------------- |
| **Claude Code**        | `deniedTools` in `.claude/settings.json`     | Yes — platform enforced                                 |
| **Cursor**             | `.cursor/mcp.json` or Cursor settings UI     | Partial — check Cursor docs for per-tool restrictions   |
| **Windsurf**           | `.windsurf/mcp.json` or Windsurf settings UI | Partial — check Windsurf docs for per-tool restrictions |
| **Claude Desktop**     | No bash access                               | N/A                                                     |
| **Non-MCP CLI agents** | CLAUDE.md instructions only                  | No — advisory only                                      |

This skill primarily targets Claude Code. Instructions for other platforms are best-effort.

---

## Step 1: Check Coverage

Only deny tools for services that have Earl templates. Denying a tool for a service with no
Earl template would leave the agent unable to interact with that service at all.

```bash
earl templates list --json
```

Note which providers are covered. Map each to the CLI tools to deny:

| Earl template covers  | Deny these tools                                                 |
| --------------------- | ---------------------------------------------------------------- |
| `github`              | `Bash(gh *)`, `Bash(hub *)`                                      |
| `stripe`              | `Bash(stripe *)`                                                 |
| `slack`               | `Bash(slack *)`                                                  |
| `openai`              | `Bash(openai *)`                                                 |
| `vercel`              | `Bash(vercel *)`                                                 |
| Any HTTP API template | `Bash(curl *)`, `Bash(wget *)`, `Bash(http *)`, `Bash(httpie *)` |
| Any SQL template      | `Bash(psql *)`, `Bash(mysql *)`, `Bash(sqlite3 *)`               |
| Any gRPC template     | `Bash(grpcurl *)`                                                |

**Do NOT deny `Bash` entirely.** Earl's bash protocol and legitimate shell operations still
need it.

**Note on `Bash(curl *)` and `Bash(wget *)`:** Denying these also blocks all non-API curl
uses — downloading binaries, health probes (`curl http://localhost:8080/health`), fetching
install scripts, etc. If the agent legitimately needs curl for non-API tasks, add a narrow
`allowedTools` override for those specific patterns, or use `earl call` instead for all
HTTP operations.

**Note on `Bash(gh *)`:** Denying `gh` also blocks all gh CLI uses that are not API calls:
`gh pr create`, `gh release upload`, `gh repo clone`, branch management, etc. If the agent
needs gh for repository operations that don't have Earl templates, add narrow exceptions or
create templates for those commands before denying `Bash(gh *)`.

---

## Step 2: Generate and Present Denylist

Based on the covered providers, generate the `deniedTools` array. Show it to the user before
applying anything:

> "Based on your Earl templates, I'd add these restrictions to `.claude/settings.json`:
>
> ```json
> {
>   "deniedTools": [
>     "Bash(curl *)",
>     "Bash(wget *)",
>     "Bash(gh *)",
>     "Bash(stripe *)"
>   ]
> }
> ```
>
> This blocks the listed tools for this agent in this project. Other projects are unaffected.
> Shall I apply this?"

Do not apply until the user explicitly approves.

---

## Step 3: Apply Denylist

For Claude Code: read `.claude/settings.json`, merge the `deniedTools` array (do not overwrite
other keys), write it back.

If `deniedTools` already exists, merge arrays — do not duplicate entries.

---

## Step 4: Verify

**For Claude Code:** Attempt to run a denied command:

```bash
curl https://example.com
```

Claude Code will refuse to run this command. The "tool denied" or "not allowed" error message
from Claude Code **is the success signal** — it means the denylist is active. You cannot
distinguish success from failure by looking at the exit code; look at whether Claude Code
blocked it before the shell ran it.

If Claude Code runs `curl` without blocking it, the `deniedTools` pattern syntax is wrong.
Check the format against current Claude Code documentation (search "deniedTools settings" in
the Claude Code docs or at https://docs.anthropic.com/en/docs/claude-code) — the exact pattern
syntax may vary by version. Then re-apply with the corrected format.

**For other platforms:** Ask the user to attempt a denied command manually in their agent
session and confirm it is blocked.

Test that Earl still works:

```bash
earl templates list
```

Expected: succeeds and lists available templates (Earl is not in the denylist).

---

## Step 5: Configure Egress Rules (Strongly Recommended)

Without egress rules, Earl is an open proxy — any HTTP template with a parameterized URL can
reach any public endpoint. Add `[[network.allow]]` rules to
`~/.config/earl/config.toml` (macOS/Linux) or `%APPDATA%\earl\config.toml` (Windows)
to restrict which hosts Earl templates can contact.

**Note:** Egress rules are global — they apply to all projects using this Earl install.
Earl does not currently support per-project config files.

For each provider template, add a rule:

```toml
[[network.allow]]
hosts = ["api.github.com"]

[[network.allow]]
hosts = ["api.stripe.com"]

[[network.allow]]
hosts = ["api.slack.com", "slack.com"]
```

**Security note on environments:** If any template uses `allow_environment_protocol_switching
= true` in its annotations, an environment override can silently switch protocols (e.g. from
HTTP to bash). Review templates with this annotation carefully — a staging environment that
switches to bash bypasses the HTTP egress rules above. Prefer `vars.*` for environment
differences (e.g. different base URLs) over full protocol switching where possible.

After editing, verify:

```bash
earl doctor
```

Earl doctor checks that the config is valid. Any `[[network.allow]]` parse errors will be
reported.

---

## What This Does Not Cover

- **Bash templates**: The `bash` protocol runs user-defined scripts in Earl's sandbox. The
  denylist does not restrict what Earl's own bash protocol can do. Ensure bash templates
  explicitly set `sandbox.network = false` unless network access is required.
- **Agents without per-tool restriction**: For non-Claude-Code agents, the CLAUDE.md instruction
  is the only constraint. This is advisory, not enforced.
- **Alternative interpreters**: Python, Node, Ruby, and other interpreters are not blocked by
  a curl-specific denylist. Pair with OS-level firewall rules for stronger containment.

---

## Next Steps

- Earl is now the enforced channel for all covered API calls
- To add egress rules for a new provider: add `[[network.allow]]` blocks to
  `~/.config/earl/config.toml`
- If the agent is blocked from a call it needs: add an Earl template for that service, or
  remove the specific deny rule for that tool
- If something breaks: invoke `troubleshoot-earl`

Related Skills

earl

111
from mathematic-inc/earl

Use when you need to call an API, run a database query, or execute a shell command via Earl. Discovers available commands and calls them correctly. Do not use raw curl, gh, psql, or similar tools when Earl is available.

troubleshoot-earl

111
from mathematic-inc/earl

Diagnoses and fixes Earl problems including installation failures, template errors, authentication issues, MCP connectivity, and SSRF blocks. Use when Earl isn't working, when earl call returns errors, when MCP tools are not visible, or when earl doctor reports failures.

setup-earl

111
from mathematic-inc/earl

Installs Earl, configures MCP integration for your agent platform, writes CLAUDE.md instructions, and routes to template creation or migration. Use when setting up Earl for the first time, when a new developer is onboarding to a project that uses Earl, or when Earl needs to be connected to an agent platform.

migrate-to-earl

111
from mathematic-inc/earl

Scans a codebase for raw API/CLI calls (curl, gh, stripe-cli, psql, grpcurl, etc.) and replaces them with Earl templates — one provider at a time. Use when migrating a project from direct CLI tool usage to Earl, or when replacing raw HTTP calls with reviewed templates.

create-template

111
from mathematic-inc/earl

Creates a new Earl HCL template for a specific API, database, or shell command. Use when adding a new service to Earl's template library, or when a pre-built template doesn't cover a needed command.

recall_ai

111
from mathematic-inc/earl

Use recall.ai to record video meetings, retrieve transcripts, and access recordings. Use when the user wants to record a meeting, get a transcript, summarize a call, or access meeting audio/video.

exploiting-insecure-deserialization

4032
from mukul975/Anthropic-Cybersecurity-Skills

Identifying and exploiting insecure deserialization vulnerabilities in Java, PHP, Python, and .NET applications to achieve remote code execution during authorized penetration tests.

exploiting-insecure-data-storage-in-mobile

4032
from mukul975/Anthropic-Cybersecurity-Skills

Identifies and exploits insecure local data storage vulnerabilities in Android and iOS mobile applications including unencrypted databases, world-readable files, insecure SharedPreferences, plaintext credential storage, and improper keychain/keystore usage. Use when performing mobile penetration testing focused on OWASP M9 (Insecure Data Storage) or assessing compliance with MASVS-STORAGE requirements. Activates for requests involving mobile data storage security, local storage exploitation, SharedPreferences analysis, or mobile data leakage assessment.

configuring-tls-1-3-for-secure-communications

4032
from mukul975/Anthropic-Cybersecurity-Skills

TLS 1.3 (RFC 8446) is the latest version of the Transport Layer Security protocol, providing significant improvements over TLS 1.2 in both security and performance. It reduces handshake latency to 1-R

env-secure-manager

3891
from openclaw/skills

Secure environment variable & secret management with AES-256 encryption, auto-redaction, permission control, prevent credential leakage

insecure-defaults

3891
from openclaw/skills

Detects fail-open insecure defaults (hardcoded secrets, weak auth, permissive security) that allow apps to run insecurely in production. Use when auditing security, reviewing config management, or analyzing environment variable handling.

securevibes-scanner

3891
from openclaw/skills

Run AI-powered application security scans on codebases. Use when asked to scan code for security vulnerabilities, generate threat models, review code for security issues, run incremental security scans, or set up continuous security monitoring via cron. Supports full scans (one-shot) and incremental scans (cron-driven, only new commits).