# Agent security hardening

> Agent security hardening is an open-source agent skill for security. Gives agents a hardening checklist and enforceable controls for untrusted input, tools. It is available on Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf and Goose.

- **Kind:** Skill
- **Pricing:** Open source
- **Platforms:** Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf, Goose
- **Website:** https://github.com/smartworldarafath/REA_Skill/tree/main/.agents/skills/agent-security-hardening
- **Repository:** https://github.com/smartworldarafath/rea_skill
- **GitHub stars:** 66
- **License:** MIT
- **Skill name:** agent-security-hardening
- **Collection:** https://github.com/smartworldarafath/REA_Skill
- **Categories:** [security](https://ai-powered.com/categories/security)
- **Listing updated:** 2026-12-01

## About

This skill guides the review and hardening of AI agent runtimes, tool gateways, memory services and multi-tenant deployments. It asks the agent to map each trust boundary from source through parser and validator to side effect, recording the authorizing identity, the validator that runs just before the action, size limits and recovery paths for every write, command, network mutation or credential use.

The guidance comes with concrete Python patterns: an agent identifier allowlist with a 64-character ceiling, environment value checks, URL and redirect rules that resist DNS rebinding and credential leakage, and a workspace path resolver that blocks traversal, Windows-reserved names and alternate data stream syntax. It also covers owner-only temp files, secret redaction before logging, and byte-limited tool output handling.

The skill expects the agent to write tests that run through the real entry point and to report commands, exit codes and confirmed absence of side effects. It states that mock-only tests do not verify OS permissions, symlink handling or egress controls, and it points to separate skills for ordinary application security review and repository scanning.

## When your agent uses it

> Security hardening guidance for AI agent frameworks that process untrusted content, invoke tools, write workspace files, manage runtime identifiers, or handle credentials. Use when building or reviewing an agent runtime, autonomous worker, tool gateway, memory service, or multi-tenant agent deployment. Do not use for general web application security or offensive testing.

## What it can access

From a static check of the files on GitHub; nothing was run.

- [Instructions only, no scripts](https://github.com/smartworldarafath/REA_Skill/tree/HEAD/.agents/skills/agent-security-hardening)
- [License: MIT](https://github.com/smartworldarafath/REA_Skill/tree/HEAD/.agents/skills/agent-security-hardening)

## Features

- **Trust boundary mapping:** Traces each input from source through validator to side effect and names the authorization for every write or command.
- **Identifier and URL validation:** Allowlists agent IDs, checks environment values and restricts schemes, hosts and redirects for outbound calls.
- **Filesystem containment:** Resolves workspace paths and rejects traversal, symlink escapes, reserved device names and alternate data streams.
- **Secret and temp file protection:** Sets owner-only permissions, cleans up in finally blocks and keeps credentials out of logs and arguments.
- **Bounded tool output:** Caps tool output size, strips control characters and returns typed failures instead of silent empty results.
- **Verification gate:** Lists behaviors to prove through the real entry point before calling a framework hardened.

## Good for

- Review an agent runtime for unsafe file writes from model output
- Add path containment checks to a tool gateway that writes workspace files
- Validate agent IDs and tenant identifiers in a multi-tenant agent service
- Audit how an agent handles credentials, logs and temporary files
- Check outbound URL handling for SSRF and credential forwarding on redirects

## Install

### Claude Code

This skill ships in the `rea-skills` plugin. In Claude Code, add the marketplace and install the plugin (it may include other skills too):

```sh
/plugin marketplace add smartworldarafath/REA_Skill
/plugin install rea-skills@smartworldarafath
```

Or copy only this skill to `~/.claude/skills/agent-security-hardening`:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/smartworldarafath/REA_Skill.git "$tmp" &&
mkdir -p ~/.claude/skills &&
rm -rf ~/.claude/skills/agent-security-hardening &&
cp -R "$tmp/.agents/skills/agent-security-hardening" ~/.claude/skills/agent-security-hardening &&
rm -rf "$tmp"
```

For one project only, put the folder in `.claude/skills/agent-security-hardening` inside it instead.

### Codex

Copy the skill folder to `~/.agents/skills/agent-security-hardening` to use it in every repository:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/smartworldarafath/REA_Skill.git "$tmp" &&
mkdir -p ~/.agents/skills &&
rm -rf ~/.agents/skills/agent-security-hardening &&
cp -R "$tmp/.agents/skills/agent-security-hardening" ~/.agents/skills/agent-security-hardening &&
rm -rf "$tmp"
```

For one repository only, put the folder in `.agents/skills/agent-security-hardening` inside it instead.

### Cursor

Copy the skill folder to `~/.cursor/skills/agent-security-hardening` to use it in every project:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/smartworldarafath/REA_Skill.git "$tmp" &&
mkdir -p ~/.cursor/skills &&
rm -rf ~/.cursor/skills/agent-security-hardening &&
cp -R "$tmp/.agents/skills/agent-security-hardening" ~/.cursor/skills/agent-security-hardening &&
rm -rf "$tmp"
```

For one project only, put the folder in `.cursor/skills/agent-security-hardening` inside it instead.

### Gemini CLI

Run in a terminal (add `--scope workspace` to install it for the current workspace only):

```sh
gemini skills install https://github.com/smartworldarafath/REA_Skill.git --path .agents/skills/agent-security-hardening
```

Or copy the folder to `~/.gemini/skills/agent-security-hardening` yourself.

### VS Code

For GitHub Copilot in VS Code, copy the skill folder to `~/.copilot/skills/agent-security-hardening`:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/smartworldarafath/REA_Skill.git "$tmp" &&
mkdir -p ~/.copilot/skills &&
rm -rf ~/.copilot/skills/agent-security-hardening &&
cp -R "$tmp/.agents/skills/agent-security-hardening" ~/.copilot/skills/agent-security-hardening &&
rm -rf "$tmp"
```

For one project only, put the folder in `.github/skills/agent-security-hardening` inside it instead.

### Other agents

Get the folder:

```sh
git clone --depth 1 https://github.com/smartworldarafath/REA_Skill.git
```

Then copy `REA_Skill/.agents/skills/agent-security-hardening` into your agent's skills folder as `agent-security-hardening`. Agents that support SKILL.md read one folder per skill.

## FAQ

### When should Agent security hardening trigger?

It applies when building or reviewing an agent runtime, autonomous worker, tool gateway, memory service or multi-tenant agent deployment. It is not meant for general web application security or offensive testing.

### Does Agent security hardening include runnable scripts?

No scripts are included. It provides Python code snippets for identifier validation, environment checks and workspace path containment inside the SKILL.md.

### What does Agent security hardening expect from the developer?

It expects the framework under review to be available so tests can run through its real entry points. It asks for command output, exit status and evidence that side effects did not occur.

### Does Agent security hardening replace general security review?

No. The skill says ordinary application security such as SQL injection or XSS belongs to a separate security-review skill, and repository-wide scanning to security-scan.

### How do I install Agent security hardening in Claude Code?

Copy the skill folder from GitHub to ~/.claude/skills/agent-security-hardening to use it in all your projects, or to .claude/skills/agent-security-hardening in one project. Or install the rea-skills plugin, which includes it: /plugin marketplace add smartworldarafath/REA_Skill, then /plugin install rea-skills@smartworldarafath.

### Does Agent security hardening run scripts?

No. It is instructions only, with no scripts. This comes from a static check of the files on GitHub; nothing was run. Read the files before you install it.

### Which AI agents can use Agent security hardening?

Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf and Goose. Each reads skills in the SKILL.md format from its own folder; the install steps on this page list them.

### What are the best alternatives to Agent security hardening?

The closest alternatives to Agent security hardening are Agent action safety, Security, Security review, Security reasoning and Skill scanner.

## Where this comes from

- Description: from the skill's own SKILL.md.

## Alternatives

- [Agent action safety](https://ai-powered.com/skills/agent-action-safety): Agent action safety is an open-source agent skill for security.
- [Security](https://ai-powered.com/skills/security-jasgujral): Security is an open-source agent skill for security.
- [Security review](https://ai-powered.com/skills/security-review-getsentry): Security review is an open-source agent skill for security.
- [Security reasoning](https://ai-powered.com/skills/security-reasoning): Security reasoning is an open-source agent skill for security.
- [Skill scanner](https://ai-powered.com/skills/skill-scanner): Skill scanner is an open-source agent skill for security.
- [Agent governance](https://ai-powered.com/skills/agent-governance): Agent governance is an open-source agent skill for ai models and llm tooling.
- [Security review](https://ai-powered.com/skills/security-review): Security review is an open-source agent skill for security.
- [Agent owasp compliance](https://ai-powered.com/skills/agent-owasp-compliance): Agent owasp compliance is an open-source agent skill for security.

---
Source: https://ai-powered.com/skills/agent-security-hardening
