The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.
feat(skills): add agent security hardening
vamc837459e0ab5
diff --git a/.claude-plugin/marketplace.json b/.claude-plugin/marketplace.jsonindex 3d2ff3e57..03b3f9f85 100644--- a/.claude-plugin/marketplace.json+++ b/.claude-plugin/marketplace.json@@ -11,7 +11,7 @@{"name": "ecc","source": "./",- "description": "Harness-native ECC operator layer - 68 agents, 291 skills, 94 legacy command shims, reusable hooks, rules, selective install profiles, and production-ready workflows for Claude Code, Codex, OpenCode, Cursor, and related agent harnesses",+ "description": "Harness-native ECC operator layer - 68 agents, 292 skills, 94 legacy command shims, reusable hooks, rules, selective install profiles, and production-ready workflows for Claude Code, Codex, OpenCode, Cursor, and related agent harnesses","version": "2.2.1","author": {"name": "Affaan Mustafa",diff --git a/.claude-plugin/plugin.json b/.claude-plugin/plugin.jsonindex 50a41a6f1..5f1e9a391 100644--- a/.claude-plugin/plugin.json+++ b/.claude-plugin/plugin.json@@ -1,7 +1,7 @@{"name": "ecc","version": "2.2.1",- "description": "Harness-native ECC plugin for engineering teams - 68 agents, 291 skills, 94 legacy command shims, reusable hooks, rules, MCP conventions, and operator workflows for Claude Code plus adjacent agent harnesses",+ "description": "Harness-native ECC plugin for engineering teams - 68 agents, 292 skills, 94 legacy command shims, reusable hooks, rules, MCP conventions, and operator workflows for Claude Code plus adjacent agent harnesses","author": {"name": "Affaan Mustafa","url": "https://x.com/affaanmustafa"diff --git a/AGENTS.md b/AGENTS.mdindex 33605f894..085342923 100644--- a/AGENTS.md+++ b/AGENTS.md@@ -1,6 +1,6 @@# Everything Claude Code (ECC) — Agent Instructions-This is a **production-ready AI coding plugin** providing 68 specialized agents, 291 skills, 94 commands, and automated hook workflows for software development.+This is a **production-ready AI coding plugin** providing 68 specialized agents, 292 skills, 94 commands, and automated hook workflows for software development.**Version:** 2.2.1@@ -154,7 +154,7 @@ Troubleshoot failures: check test isolation → verify mocks → fix implementat```agents/ — 68 specialized subagents-skills/ — 291 workflow skills and domain knowledge+skills/ — 292 workflow skills and domain knowledgecommands/ — 94 slash commandshooks/ — Trigger-based automationsrules/ — Always-follow guidelines (common + per-language)diff --git a/README.md b/README.mdindex 9e4126dd3..5bf27dbee 100644--- a/README.md+++ b/README.md@@ -136,12 +136,12 @@ Instead of rebuilding that process in every prompt, you install it once and makeECC is MIT-licensed open source. It works best with Claude Code today, has a supported Codex sync path, and provides capability-limited adapters for Cursor, OpenCode, Gemini, Zed, GitHub Copilot, Antigravity, Qwen, and other harnesses. See the [support status matrix](#platform-support) before assuming feature parity.-Access to 68 agents, 291 skills, and 94 legacy command shims, plus hooks, rules, memory, continuous learning, and AgentShield security scanning. The agents are specialized for planning, review, build repair, security, architecture, and domain work.+Access to 68 agents, 292 skills, and 94 legacy command shims, plus hooks, rules, memory, continuous learning, and AgentShield security scanning. The agents are specialized for planning, review, build repair, security, architecture, and domain work.| Included | Count | What it gives you || ---------------- | ----------: | ------------------------------------------------------------------------------------ || Agents | 68 agents | Planning, review, build repair, security, architecture, and domain work |-| Skills | 291 skills | TDD, research, security, docs, frontend, data, ML, operations, and more |+| Skills | 292 skills | TDD, research, security, docs, frontend, data, ML, operations, and more || Commands | 94 commands | Convenient entry points while ECC moves to a skills-first surface || Hooks and memory | Runtime | Enforcement, session summaries, continuous learning, instincts, and context controls || Rules | Selective | Always-loaded standards you choose by language or project |diff --git a/README.zh-CN.md b/README.zh-CN.mdindex 214b978f7..e01fd54e2 100644--- a/README.zh-CN.md+++ b/README.zh-CN.md@@ -196,7 +196,7 @@ Copy-Item -Recurse rules/typescript "$HOME/.claude/rules/"/plugin list ecc@ecc```-**完成!** 你现在可以使用 68 个代理、291 个技能和 94 个命令。+**完成!** 你现在可以使用 68 个代理、292 个技能和 94 个命令。### multi-* 命令需要额外配置diff --git a/docs/tr/AGENTS.md b/docs/tr/AGENTS.mdindex 791e7f98a..c49b9962a 100644--- a/docs/tr/AGENTS.md+++ b/docs/tr/AGENTS.md@@ -1,6 +1,6 @@# Everything Claude Code (ECC) — Agent Talimatları-Bu, yazılım geliştirme için 68 özel agent, 291 skill, 94 command ve otomatik hook iş akışları sağlayan **üretime hazır bir AI kodlama eklentisidir**.+Bu, yazılım geliştirme için 68 özel agent, 292 skill, 94 command ve otomatik hook iş akışları sağlayan **üretime hazır bir AI kodlama eklentisidir**.**Sürüm:** 2.2.1@@ -142,7 +142,7 @@ Başarısızlık sorunlarını giderin: test izolasyonunu kontrol edin → mockl```agents/ — 68 özel subagent-skills/ — 291 iş akışı skillleri ve alan bilgisi+skills/ — 292 iş akışı skillleri ve alan bilgisicommands/ — 94 slash commandhooks/ — Tetikleyici tabanlı otomasyonlarrules/ — Her zaman uyulması gereken kurallar (ortak + dile özel)diff --git a/docs/zh-CN/AGENTS.md b/docs/zh-CN/AGENTS.mdindex e9141f30b..2f5a18856 100644--- a/docs/zh-CN/AGENTS.md+++ b/docs/zh-CN/AGENTS.md@@ -1,6 +1,6 @@# Everything Claude Code (ECC) — 智能体指令-这是一个**生产就绪的 AI 编码插件**,提供 68 个专业代理、291 项技能、94 条命令以及自动化钩子工作流,用于软件开发。+这是一个**生产就绪的 AI 编码插件**,提供 68 个专业代理、292 项技能、94 条命令以及自动化钩子工作流,用于软件开发。**版本:** 2.2.1@@ -147,7 +147,7 @@```agents/ — 68 个专业子代理-skills/ — 291 个工作流技能和领域知识+skills/ — 292 个工作流技能和领域知识commands/ — 94 个斜杠命令hooks/ — 基于触发的自动化rules/ — 始终遵循的指导方针(通用 + 每种语言)diff --git a/docs/zh-CN/README.md b/docs/zh-CN/README.mdindex 691c31a23..422f22d5d 100644--- a/docs/zh-CN/README.md+++ b/docs/zh-CN/README.md@@ -260,7 +260,7 @@ Copy-Item -Recurse rules/typescript "$HOME/.claude/rules/"/plugin list ecc@ecc```-**搞定!** 你现在可以使用 68 个智能体、291 项技能和 94 个命令了。+**搞定!** 你现在可以使用 68 个智能体、292 项技能和 94 个命令了。***@@ -1174,7 +1174,7 @@ opencode|---------|---------------|----------|--------|| 智能体 | PASS: 68 个 | PASS: 12 个 | **Claude Code 领先** || 命令 | PASS: 94 个 | PASS: 35 个 | **Claude Code 领先** |-| 技能 | PASS: 291 项 | PASS: 37 项 | **Claude Code 领先** |+| 技能 | PASS: 292 项 | PASS: 37 项 | **Claude Code 领先** || 钩子 | PASS: 8 种事件类型 | PASS: 11 种事件 | **OpenCode 更多!** || 规则 | PASS: 29 条 | PASS: 13 条指令 | **Claude Code 领先** || MCP 服务器 | PASS: 14 个 | PASS: 完整 | **完全对等** |@@ -1282,7 +1282,7 @@ ECC 是**第一个最大化利用每个主要 AI 编码工具的插件**。以|---------|-----------------------|------------|-----------|----------|| **智能体** | 68 | 共享 (AGENTS.md) | 共享 (AGENTS.md) | 12 || **命令** | 94 | 共享 | 基于指令 | 35 |-| **技能** | 291 | 共享 | 10 (原生格式) | 37 |+| **技能** | 292 | 共享 | 10 (原生格式) | 37 || **钩子事件** | 8 种类型 | 15 种类型 | SessionStart(1 种类型) | 11 种类型 || **钩子脚本** | 20+ 个脚本 | 16 个脚本 (DRY 适配器) | 1 个 SessionStart 引导脚本 | 插件钩子 || **规则** | 34 (通用 + 语言) | 34 (YAML 前页) | 基于指令 | 13 条指令 |diff --git a/manifests/install-modules.json b/manifests/install-modules.jsonindex 92a73e08d..8c3839daa 100644--- a/manifests/install-modules.json+++ b/manifests/install-modules.json@@ -423,6 +423,7 @@"kind": "skills","description": "Security review and security-focused framework guidance.","paths": [+ "skills/agent-security-hardening","skills/defi-amm-security","skills/django-security","skills/healthcare-phi-compliance",diff --git a/package.json b/package.jsonindex b3508b59a..db102afdc 100644--- a/package.json+++ b/package.json@@ -149,6 +149,7 @@"skills/agent-architecture-audit/","skills/agent-harness-construction/","skills/agent-introspection-debugging/",+ "skills/agent-security-hardening/","skills/agent-sort/","skills/agentic-engineering/","skills/agentic-os/",diff --git a/skills/agent-security-hardening/SKILL.md b/skills/agent-security-hardening/SKILL.mdnew file mode 100644index 000000000..734461bec--- /dev/null+++ b/skills/agent-security-hardening/SKILL.md@@ -0,0 +1,152 @@+---+name: agent-security-hardening+description: 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.+metadata:+ origin: ECC+---++# Agent Security Hardening++Harden the boundaries where an agent turns untrusted data into filesystem, network, memory, or tool actions. Produce concrete controls and tests for the framework being reviewed; a checklist without enforcement evidence is incomplete.++## Important++- Treat model output, retrieved content, tool output, memory, and cross-agent messages as untrusted input.+- Default external integrations to read-only and grant each write capability separately.+- Validate at the action boundary even when an upstream prompt or schema already validated the value.+- Fail closed before a side effect when identity, destination, ownership, or containment cannot be proven.+- Use limits, schemes, domains, and retention periods verified from the deployment configuration. When a value is absent, mark it as a required decision and test that the implementation rejects an unbounded configuration; do not invent a plausible value.++## When to Activate++- Building an autonomous agent, tool gateway, memory service, or agent-to-agent protocol+- Reviewing code that maps model output into commands, paths, URLs, credentials, or API mutations+- Isolating tenants, projects, sessions, or workspaces in a long-running agent process+- Hardening temporary files, logs, tool responses, or external-content ingestion++## Hardening Workflow++### 1. Map Trust Boundaries++List every boundary as `source -> parser -> validator -> side effect`. Include direct user input, model output, retrieved documents, memory, environment variables, tool results, and messages from other agents.++For each side effect, record:++- the identity and scope authorizing it;+- the exact validator that runs immediately before it;+- the maximum input and output size;+- the audit evidence produced;+- the recovery path if the operation is interrupted.++This step is complete when every write, command, network mutation, and credential use has one named authorization boundary.++### 2. Validate Identifiers, Environment Values, and URLs++Use an allowlist for identifiers that become filenames, keys, selectors, or command arguments:++```python+import re++SAFE_AGENT_ID = re.compile(r"^[A-Za-z0-9_-]{1,64}$")++def require_agent_id(value: object) -> str:+ if not isinstance(value, str) or not SAFE_AGENT_ID.fullmatch(value):+ raise ValueError("invalid agent identifier")+ return value+```++Reject missing and whitespace-only environment values before constructing a client:++```python+def require_env(name: str, environ: dict[str, str]) -> str:+ value = environ.get(name)+ if value is None or not value.strip():+ raise RuntimeError(f"{name} is required")+ return value+```++Parse URLs, allow only schemes required by the deployment, require a host, reject embedded credentials, and resolve or block private-network destinations when the URL is attacker-controlled. Revalidate redirects because they can cross the original trust boundary.++This step is complete when tests reject empty, oversized, malformed, traversal-shaped, credential-bearing, and unauthorized-destination values before any side effect.++### 3. Contain Filesystem Access++Reject absolute user-controlled paths and traversal components before joining. Resolve both the workspace and candidate path, then prove containment:++```python+from pathlib import Path++def workspace_path(workspace: Path, requested: str) -> Path:+ relative = Path(requested)+ if relative.is_absolute() or ".." in relative.parts:+ raise ValueError("path must be workspace-relative")++ root = workspace.resolve(strict=True)+ candidate = (root / relative).resolve(strict=False)+ if not candidate.is_relative_to(root):+ raise ValueError("path escapes workspace")+ return candidate+```++Containment checks do not eliminate symlink races. For sensitive writes, open relative to a trusted directory handle where the platform supports it, reject symlink targets, create files exclusively, and verify ownership and permissions after opening.++This step is complete when tests cover sibling-prefix paths, nested `..`, absolute paths, symlink escapes, and a valid nested workspace path.++### 4. Protect Temporary Data and Credentials++- Create sensitive files with owner-only permissions such as `0o600`; create private directories with `0o700`.+- Prefer a user-private runtime directory over a shared temporary directory for credentials or tenant data.+- Create unpredictable names atomically; do not check-then-create.+- Remove temporary data in `finally`, while preserving a redacted error record when cleanup fails.+- Keep secrets out of command arguments, model context, logs, traces, exception text, and tool responses.+- Pass secrets through the platform's secret store or scoped environment injection and rotate exposed credentials.+- Treat zeroization as best effort: mutable byte buffers can be overwritten, but immutable language strings cannot be reliably erased.++This step is complete when file-mode checks, forced-error cleanup tests, and log-capture tests show that secret values never persist outside the approved boundary.++### 5. Bound and Sanitize Tool Output++Read tool output with a byte limit rather than collecting an unbounded stream. Preserve structured fields, remove disallowed control characters, and append an explicit truncation marker with the original byte count. Keep a content hash when later forensic comparison matters.++Do not silently turn malformed output into an empty success value. Return a typed failure that names the producing tool, boundary, and validation reason without echoing sensitive content.++This step is complete when oversized output, invalid encoding, terminal-control sequences, malformed structured data, and a normal response all have deterministic tests.++## Verification Gate++Before calling the framework hardened, verify all of these behaviors through its real entry point:++1. Untrusted instructions remain data and cannot trigger a tool or write.+2. Cross-tenant and cross-workspace identifiers are rejected at the action boundary.+3. Traversal and symlink escape attempts leave the filesystem unchanged.+4. Forced failures leave no credential-bearing temp files or logs.+5. Oversized or malformed tool output returns an explicit bounded error.++Report the command used, exit status, rejected input, and observed absence of the side effect. Mock-only tests do not prove operating-system permissions, symlink handling, subprocess isolation, or network egress controls.++## Common Issues++### Validation exists only in the prompt++Prompt instructions are advisory. Move the same invariant into deterministic code immediately before the side effect and test a model response that violates it.++### A normalized path still escapes++String prefix checks confuse sibling paths such as `/work/app` and `/work/application`. Resolve paths and use component-aware containment, then test symlinks separately.++### Redaction happens after logging++Redact before values enter the logger, tracer, exception, or model context. Add a capture test using a sentinel secret and assert the sentinel is absent from every emitted channel.++## When NOT to Use++- Use `security-review` for ordinary application authentication, authorization, SQL injection, XSS, CSRF, and API security.+- Use `security-scan` for repository-wide automated vulnerability scanning.+- Use infrastructure-specific guidance for host, container, firewall, or cloud hardening.+- Do not use this skill for penetration testing, exploit development, or unauthorized access.++## Related Skills++- `agent-harness-construction`+- `security-review`+- `security-scan`