/install apishield
\r \r
APIShield -- API Endpoint Security Auditor\r
\r APIShield scans your API route definitions for security vulnerabilities including missing authentication middleware, rate limiting gaps, input validation holes, CORS misconfigurations, and exposed debug endpoints. It supports Express, FastAPI, Flask, Django, Rails, and Next.js. All scanning happens locally using regex-based pattern matching -- no code is sent to external servers.\r \r
Commands\r
\r
Free Tier (No license required)\r
\r
apishield scan [file|directory]\r
One-shot security audit of API route files.\r \r How to execute:\r
bash "\x3CSKILL_DIR>/scripts/apishield.sh" scan [target]\r
```\r
\r
**What it does:**\r
1. Accepts a file path or directory (defaults to current directory)\r
2. Auto-detects the framework (Express, FastAPI, Flask, Django, Rails, Next.js)\r
3. Finds all route definition files (excluding .git/, node_modules/, dist/, build/, vendor/, __pycache__)\r
4. Runs 20+ security checks against each route file\r
5. Outputs findings with: file, line number, check name, severity, description\r
6. Calculates a security score (0-100)\r
7. Free tier: limited to scanning up to 5 route files\r
8. Exit code 0 if score >= 70, exit code 1 if score \x3C 70 or critical issues found\r
\r
**Example usage scenarios:**\r
- "Scan my API routes for security issues" -> runs `apishield scan .`\r
- "Check this Express app for missing auth" -> runs `apishield scan src/routes/`\r
- "Audit my FastAPI endpoints" -> runs `apishield scan app/`\r
- "Are my API endpoints secure?" -> runs `apishield scan .`\r
\r
### Pro Tier ($19/user/month -- requires APISHIELD_LICENSE_KEY)\r
\r
#### `apishield scan [file|directory]` (unlimited)\r
Full security audit with no file limit and all 20+ checks enabled.\r
\r
**How to execute:**\r
```bash\r
bash "\x3CSKILL_DIR>/scripts/apishield.sh" scan [target]\r
```\r
\r
**What it does (beyond free):**\r
1. Unlimited route file scanning\r
2. Full 20+ security checks including rate limit analysis, CORS validation, input validation, CSRF, SQL injection risk\r
3. Detailed remediation advice per finding\r
\r
#### `apishield hooks install`\r
Install git pre-commit hooks that scan staged route files for security issues before every commit.\r
\r
**How to execute:**\r
```bash\r
bash "\x3CSKILL_DIR>/scripts/apishield.sh" hooks install\r
```\r
\r
**What it does:**\r
1. Validates Pro+ license\r
2. Copies lefthook config to project root\r
3. Installs lefthook pre-commit hook\r
4. On every commit: scans staged route files (.js, .ts, .py, .rb) for security issues, blocks commit if critical issues found\r
\r
#### `apishield hooks uninstall`\r
Remove APIShield git hooks.\r
\r
```bash\r
bash "\x3CSKILL_DIR>/scripts/apishield.sh" hooks uninstall\r
```\r
\r
#### `apishield report [directory]`\r
Generate a markdown security audit report.\r
\r
```bash\r
bash "\x3CSKILL_DIR>/scripts/apishield.sh" report [directory]\r
```\r
\r
**What it does:**\r
1. Validates Pro+ license\r
2. Runs full scan of the directory\r
3. Generates a formatted markdown report with severity breakdown\r
4. Includes per-endpoint findings, security score, and remediation steps\r
5. Output written to APISHIELD-REPORT.md\r
\r
### Team Tier ($39/user/month -- requires APISHIELD_LICENSE_KEY with team tier)\r
\r
#### `apishield inventory [directory]`\r
Generate a complete API endpoint inventory/catalog.\r
\r
```bash\r
bash "\x3CSKILL_DIR>/scripts/apishield.sh" inventory [directory]\r
```\r
\r
**What it does:**\r
1. Validates Team+ license\r
2. Discovers all API endpoints across the codebase\r
3. Catalogs: HTTP method, path, framework, auth status, rate limiting, validation\r
4. Outputs a markdown table of all endpoints\r
5. Useful for API documentation and security reviews\r
\r
#### `apishield compliance [directory]`\r
Map findings to OWASP Top 10 API Security Risks.\r
\r
```bash\r
bash "\x3CSKILL_DIR>/scripts/apishield.sh" compliance [directory]\r
```\r
\r
**What it does:**\r
1. Validates Team+ license\r
2. Runs full security scan\r
3. Maps each finding to relevant OWASP API Security Top 10 categories\r
4. Produces a compliance report showing coverage and gaps\r
5. Categories: Broken Object-Level Auth, Broken Authentication, Excessive Data Exposure, Lack of Resources & Rate Limiting, Broken Function-Level Auth, Mass Assignment, Security Misconfiguration, Injection, Improper Asset Management, Insufficient Logging\r
\r
## Detected Security Issues\r
\r
APIShield checks for 20+ security issues across 6 frameworks:\r
\r
| Check | Description | Severity |\r
|-------|-------------|----------|\r
| Missing Auth Middleware | Routes without authentication middleware | Critical |\r
| Debug Endpoints Exposed | /debug, /test, /admin without auth | Critical |\r
| SQL Injection Risk | String interpolation in SQL queries | Critical |\r
| Sensitive Data Exposure | Routes returning passwords/tokens/secrets | High |\r
| Missing Rate Limiting | Public endpoints without rate limit middleware | High |\r
| CORS Misconfiguration | Access-Control-Allow-Origin: * or overly permissive CORS | High |\r
| Missing Input Validation | Routes accepting req.body/params without validation | High |\r
| Missing CSRF Protection | State-changing endpoints without CSRF tokens | High |\r
| Overly Permissive Methods | app.all() or wildcard method handlers | Medium |\r
| Error Handling Leaks | Routes that might expose stack traces | Medium |\r
| Missing HTTP Security Headers | No helmet/security headers middleware | Medium |\r
| Insecure Direct Object Refs | Route params used directly in DB queries | Medium |\r
\r
## Configuration\r
\r
Users can configure APIShield in `~/.openclaw/openclaw.json`:\r
\r
```json\r
{\r
"skills": {\r
"entries": {\r
"apishield": {\r
"enabled": true,\r
"apiKey": "YOUR_LICENSE_KEY_HERE",\r
"config": {\r
"severityThreshold": "high",\r
"excludePatterns": ["**/node_modules/**", "**/dist/**", "**/.git/**"],\r
"reportFormat": "markdown"\r
}\r
}\r
}\r
}\r
}\r
```\r
\r
## Important Notes\r
\r
- **Free tier** works immediately with no configuration (limited to 5 route files)\r
- **All scanning happens locally** -- no code is sent to external servers\r
- **License validation is offline** -- no phone-home or network calls\r
- Supports Express, FastAPI, Flask, Django, Rails, and Next.js\r
- Git hooks use **lefthook** which must be installed (see install metadata above)\r
- Exit codes: 0 = secure (score >= 70), 1 = issues found (for CI/CD integration)\r
\r
## Error Handling\r
\r
- If lefthook is not installed and user tries `hooks install`, prompt to install it\r
- If license key is invalid or expired, show clear message with link to https://apishield.pages.dev/renew\r
- If a file is binary, skip it automatically with no warning\r
- If no route files found in target, report clean scan with info message\r
- If framework cannot be auto-detected, try all framework patterns\r
\r
## When to Use APIShield\r
\r
The user might say things like:\r
- "Scan my API routes for security issues"\r
- "Check if my endpoints have authentication"\r
- "Are my Express routes secure?"\r
- "Audit my FastAPI endpoints for vulnerabilities"\r
- "Generate an API security report"\r
- "Check for CORS misconfigurations"\r
- "Find endpoints missing rate limiting"\r
- "Map my API security to OWASP Top 10"\r
- "Generate an API inventory"\r
- "Set up security checks on my commits"\r
- "Check for SQL injection risks in my routes"\r
- "Find debug endpoints that are exposed"\r
- 确保已安装 OpenClaw(本地或 Docker 部署)
- 在对话框中输入安装命令:
/install apishield - 安装完成后,直接呼叫该 Skill 的名称或使用
/apishield触发 - 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
apishield 是什么?
API endpoint security auditor — scans route definitions for missing auth, rate limiting, CORS issues, and input validation holes. 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 91 次。
如何安装 apishield?
在 OpenClaw 或 Claude Code 对话框中运行命令「/install apishield」即可一键安装,无需额外配置。
apishield 是免费的吗?
是的,apishield 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。
apishield 支持哪些平台?
apishield 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(darwin, linux, win32)。
谁开发了 apishield?
由 suhteevah(@suhteevah)开发并维护,当前版本 v1.0.1。