agentsec
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chineseagentsec
agentsec
agentsecagentsecWhen to Use
适用场景
Use when the user asks to:
agentsec- Audit, scan, or check agent skills for security issues
- Verify installed skills are safe before running them
- Check OWASP compliance of an agent setup
- Gate a CI/CD pipeline on skill security
- Generate a security report for stakeholders
当用户有以下需求时,可使用 :
agentsec- 审计、扫描或检查Agent技能的安全问题
- 在运行已安装的技能前验证其安全性
- 检查Agent配置是否符合OWASP合规要求
- 基于技能安全性管控CI/CD流水线
- 为相关方生成安全审计报告
Quick Start
快速开始
The fastest path to a result — no install, no flags:
bash
npx agentsecThis scans every default skills directory on the machine — grouped by platform — plus any folder in the current project (up to two levels deep), and audits each installed skill against the OWASP Agentic Skills Top 10. Always try this first.
./skills无需安装、无需参数,最快获得扫描结果:
bash
npx agentsec该命令会扫描机器上所有默认技能目录(按平台分组),以及当前项目中所有文件夹(最多两层深度),并对照OWASP Agentic Skills Top 10审计每个已安装的技能。建议首先尝试此命令。
./skillsAuto-discovery locations
自动发现路径
| Platform | Paths scanned |
|---|---|
| Claude Code | |
| OpenClaw / ClawHub | |
| Codex / skills.sh | |
| Other (generic) | Any |
| 平台 | 扫描路径 |
|---|---|
| Claude Code | |
| OpenClaw / ClawHub | |
| Codex / skills.sh | |
| 其他(通用) | 当前项目中找到的所有 |
Core Commands
核心命令
Every workflow starts from one of four commands. Run them with — no install needed.
npx agentsecbash
undefined所有工作流均从以下四个命令开始。无需安装,直接通过运行。
npx agentsecbash
undefinedFull audit (scan + policy evaluation). Default command.
完整审计(扫描+策略评估)。默认命令。
npx agentsec
npx agentsec
Scan only (no policy evaluation)
仅扫描(无策略评估)
npx agentsec scan
npx agentsec scan
Generate a report from a previously saved audit JSON
从已保存的审计JSON文件生成报告
npx agentsec report audit.json
npx agentsec report audit.json
Manage and inspect policy presets
管理和查看策略预设
npx agentsec policy list
undefinednpx agentsec policy list
undefinedInstallation
安装方式
npx agentsecbash
undefinednpx agentsecbash
undefinedbun (recommended)
bun(推荐)
bun add -g agentsec
bun add -g agentsec
npm
npm
npm install -g agentsec
npm install -g agentsec
pnpm
pnpm
pnpm add -g agentsec
pnpm add -g agentsec
yarn
yarn
yarn global add agentsec
Then drop the `npx` prefix:
```bash
agentsec
agentsec scan --path ./my-skillsyarn global add agentsec
安装后即可省略`npx`前缀:
```bash
agentsec
agentsec scan --path ./my-skillsFlags
参数说明
All flags work with any command.
| Flag | Short | Values | Default | Purpose |
|---|---|---|---|---|
| | | | Output format |
| | path | stdout | Write report to file |
| | preset name or path | | Apply a policy preset |
| | auto | Narrow to one agent platform | |
| path | auto | Custom skill directory to scan | |
| | | Rule profile. | |
| | off | Show detailed findings | |
| off | Disable colored output | ||
| | Show help | ||
| | Print version |
所有参数可搭配任意命令使用。
| 参数 | 简写 | 可选值 | 默认值 | 用途 |
|---|---|---|---|---|
| | | | 输出格式 |
| | 文件路径 | 标准输出 | 将报告写入文件 |
| | 预设名称或文件路径 | | 应用策略预设 |
| | 自动检测 | 限定扫描单个Agent平台 | |
| 目录路径 | 自动检测 | 指定要扫描的自定义技能目录 | |
| | | 规则配置文件。 | |
| | 关闭 | 显示详细检测结果 | |
| 关闭 | 禁用彩色输出 | ||
| | 显示帮助信息 | ||
| | 输出版本号 |
Common Recipes
常用操作示例
Show detailed findings and remediation
显示详细检测结果与修复建议
bash
npx agentsec --verbosebash
npx agentsec --verboseScan a specific directory
扫描指定目录
bash
npx agentsec scan --path ./my-skillsbash
npx agentsec scan --path ./my-skillsTarget a specific agent platform
针对特定Agent平台扫描
bash
npx agentsec --platform claude
npx agentsec --platform codexbash
npx agentsec --platform claude
npx agentsec --platform codexAudit with a strict policy and save JSON
使用严格策略审计并保存为JSON文件
bash
npx agentsec --policy strict --format json --output audit.jsonbash
npx agentsec --policy strict --format json --output audit.jsonGenerate an HTML report for stakeholders
为相关方生成HTML报告
bash
npx agentsec --format html --output report.htmlbash
npx agentsec --format html --output report.htmlGenerate a SARIF report for IDE / code-scanning integration
生成SARIF报告用于IDE/代码扫描集成
bash
npx agentsec --format sarif --output report.sarifbash
npx agentsec --format sarif --output report.sarifList available policy presets
查看可用的策略预设
bash
npx agentsec policy listbash
npx agentsec policy listInspect the rules in a preset
查看预设中的规则
bash
npx agentsec policy show strictbash
npx agentsec policy show strictValidate a custom policy config file
验证自定义策略配置文件
bash
npx agentsec policy validate ./my-policy.jsonbash
npx agentsec policy validate ./my-policy.jsonReplay a previous audit as an HTML report
从之前的审计JSON文件重新生成HTML报告
bash
npx agentsec report audit.json --format html --output report.htmlbash
npx agentsec report audit.json --format html --output report.htmlPolicy Presets
策略预设
| Name | Use Case |
|---|---|
| Balanced policy. Blocks critical findings. |
| Enterprise-grade. Blocks high and critical findings, enforces tests. |
| Lenient. Only blocks critical CVEs. Good for development. |
| Built directly from the OWASP Agentic Skills Top 10. |
| 名称 | 适用场景 |
|---|---|
| 平衡策略,阻止严重级别的检测结果。 |
| 企业级策略,阻止高风险和严重级别的检测结果,并强制要求测试。 |
| 宽松策略,仅阻止严重级别的CVE漏洞。适用于开发环境。 |
| 完全基于OWASP Agentic Skills Top 10构建。 |
Configuration File
配置文件
agentsec.agentsecrc.agentsecrc.jsonagentsec.config.jsonjson
{
"format": "text",
"output": null,
"policy": "strict",
"verbose": false
}CLI flags always override config file values. Omit and to keep the default auto-discovery behavior — agentsec will scan every known platform's default locations.
"platform""path"agentsec.agentsecrc.agentsecrc.jsonagentsec.config.jsonjson
{
"format": "text",
"output": null,
"policy": "strict",
"verbose": false
}CLI参数优先级始终高于配置文件。省略和可保留默认自动发现行为——agentsec会扫描所有已知平台的默认路径。
"platform""path"OWASP Agentic Skills Top 10
OWASP Agentic Skills Top 10
Every audit checks all ten risk categories:
| ID | Risk |
|---|---|
| AST01 | Malicious Skills |
| AST02 | Supply Chain Compromise |
| AST03 | Over-Privileged Skills |
| AST04 | Insecure Metadata |
| AST05 | Unsafe Deserialization |
| AST06 | Weak Isolation |
| AST07 | Update Drift |
| AST08 | Poor Scanning |
| AST09 | No Governance |
| AST10 | Cross-Platform Reuse |
每次审计都会检查以下十大风险类别:
| ID | 风险类型 |
|---|---|
| AST01 | 恶意技能 |
| AST02 | 供应链攻击 |
| AST03 | 权限过度的技能 |
| AST04 | 不安全的元数据 |
| AST05 | 不安全的反序列化 |
| AST06 | 隔离性薄弱 |
| AST07 | 更新偏差 |
| AST08 | 扫描不充分 |
| AST09 | 缺乏治理 |
| AST10 | 跨平台复用 |
AST-10 Web3 Annex (auto-detected)
AST-10 Web3附加规则(自动检测)
Web3-touching skills are detected automatically and audited against twelve additional rules — no flag required. A skill is detected as Web3 when its manifest declares a block, when its source imports a Web3 client library (, , , , , , , , ), when it references a Web3 RPC method (, , , ), or when it ships a file. Detected skills are tagged in the output:
web3:viemethersweb3wagmi@solana/web3.js@coinbase/onchainkit@privy-io@biconomy@zerodeveth_*wallet_*personal_signsignTypedData.sol[Web3]text
✔ scoped-trader v1.4.0 [Web3] C (62)
✔ helpful-summarizer v1.2.0 A (95)--profile web3bash
npx agentsec audit --profile web3 --path ./my-skills| ID | Risk |
|---|---|
| AST-W01 | Unbounded Signing Authority |
| AST-W02 | Implicit Permit / Permit2 Signature Capture |
| AST-W03 | Delegation Hijack via EIP-7702 |
| AST-W04 | Blind / Opaque Signing Surface |
| AST-W05 | RPC Endpoint Substitution & Mempool Leakage |
| AST-W06 | Unverified Contract Call Targets |
| AST-W07 | Cross-Chain / Bridge Action Replay |
| AST-W08 | MCP Chain-Tool Drift / Capability Smuggling |
| AST-W09 | Session-Key / Permission-Caveat Erosion |
| AST-W10 | Slippage / Oracle Manipulation by Agent Loop |
| AST-W11 | Key Material in Agent Memory / Logs |
| AST-W12 | No On-Chain Action Audit / Kill-Switch |
Skills can declare a block in their manifest (chains, signers, policy caps, session-key scopes, MCP server pinning, audit sink, kill-switch) so the annex can verify scoping without flagging well-bounded skills. See for full per-rule detection signals.
web3docs/plans/ast10-web3-annex-rules.md工具会自动检测涉及Web3的技能,并针对额外12条规则进行审计——无需额外参数。当技能的清单文件中声明了块、源码中导入了Web3客户端库(、、、、、、、、)、引用了Web3 RPC方法(、、、),或包含文件时,会被判定为Web3技能。检测到的技能会在输出中标记为:
web3:viemethersweb3wagmi@solana/web3.js@coinbase/onchainkit@privy-io@biconomy@zerodeveth_*wallet_*personal_signsignTypedData.sol[Web3]text
✔ scoped-trader v1.4.0 [Web3] C (62)
✔ helpful-summarizer v1.2.0 A (95)仍可使用参数——它会对所有技能强制应用附加规则,无论是否检测到Web3属性(有助于跨团队CI流程的一致性):
--profile web3bash
npx agentsec audit --profile web3 --path ./my-skills| ID | 风险类型 |
|---|---|
| AST-W01 | 无限制的签名权限 |
| AST-W02 | 隐式Permit/Permit2签名捕获 |
| AST-W03 | 通过EIP-7702劫持授权 |
| AST-W04 | 盲签/不透明签名界面 |
| AST-W05 | RPC端点替换与内存池泄露 |
| AST-W06 | 未验证的合约调用目标 |
| AST-W07 | 跨链/桥接操作重放 |
| AST-W08 | MCP链工具偏差/能力走私 |
| AST-W09 | 会话密钥/权限约束弱化 |
| AST-W10 | Agent循环导致滑点/预言机操纵 |
| AST-W11 | 密钥材料存储在Agent内存/日志中 |
| AST-W12 | 无链上操作审计/终止开关 |
技能可在清单文件中声明块(包含链信息、签名者、策略限制、会话密钥范围、MCP服务器固定、审计接收端、终止开关),以便附加规则验证其范围,不会误判边界清晰的技能。完整的规则检测信号可查看。
web3docs/plans/ast10-web3-annex-rules.mdUnderstanding the Output
输出结果说明
Default output is compact: each skill shows its grade and score, followed by a one-line finding summary and a PASS/WARN/FAIL status.
✔ Found 6 skills
✔ fetch-data v1.0.0 D (42)
✔ deploy-helper v2.3.0 C (68)
✔ code-review v1.1.0 A (95)
6 skills scanned • avg score 78 • 4 certified
Findings: 2 critical, 1 high, 2 medium
⚠ WARN 3 high/critical finding(s) detectedUse for score breakdowns, rule IDs, file/line locations, and remediation for each finding.
--verbose默认输出为紧凑格式:每个技能显示等级和分数,随后是一行检测结果摘要以及PASS/WARN/FAIL状态。
✔ Found 6 skills
✔ fetch-data v1.0.0 D (42)
✔ deploy-helper v2.3.0 C (68)
✔ code-review v1.1.0 A (95)
6 skills scanned • avg score 78 • 4 certified
Findings: 2 critical, 1 high, 2 medium
⚠ WARN 3 high/critical finding(s) detected使用参数可查看分数明细、规则ID、文件/行位置以及每个检测结果的修复建议。
--verboseExit Codes
退出码
- — audit passed the active policy
0 - — policy violation or fatal error
1
Use the exit code directly to gate CI pipelines — no special flag required:
bash
npx agentsec --policy strict || exit 1- — 审计符合当前策略要求
0 - — 违反策略或发生致命错误
1
可直接使用退出码管控CI流水线——无需额外参数:
bash
npx agentsec --policy strict || exit 1Tips
使用技巧
- Start with — no install, no flags. Iterate from there.
npx agentsec - Add whenever you need to act on specific findings.
--verbose - Pipe into
--format jsonor a custom script for programmatic handling.jq - is the most common preset for production repositories.
strict - Browse the agent skills ecosystem at skills.sh.
- 从开始——无需安装、无需参数,在此基础上逐步调整。
npx agentsec - 当需要针对具体检测结果采取行动时,添加参数。
--verbose - 将的输出通过管道传递给
--format json或自定义脚本,实现程序化处理。jq - 是生产环境仓库最常用的策略预设。
strict - 可访问skills.sh浏览Agent技能生态。