api-security
БесплатноБез исполняемых скриптовНе проверенAPI security across REST, GraphQL and gRPC, organised around the OWASP API Security Top 10:2023. USE WHEN: designing, implementing, or auditing REST, GraphQL…
от claude-dev-suite★ 51 звезда на GitHubОб этом скилле
API Security Skill
USE WHEN: Designing, implementing, or auditing REST, GraphQL, or gRPC APIs for security vulnerabilities. DO NOT USE FOR: General API design patterns (use rest-api/graphql skills), authentication setup (use jwt/oauth2 skills).
OWASP API Security Top 10:2023
| Rank | Vulnerability | Description |
|---|---|---|
| API1 | Broken Object Level Authorization (BOLA) | IDOR, accessing other users' resources |
| API2 | Broken Authentication | Weak auth, token flaws |
| API3 | Broken Object Property Level Authorization | Mass assignment, excessive data exposure |
| API4 | Unrestricted Resource Consumption | No rate limiting, DoS |
| API5 | Broken Function Level Authorization | Admin functions exposed |
| API6 | Unrestricted Access to Sensitive Business Flows | Automated abuse |
| API7 | Server Side Request Forgery (SSRF) | Internal resource access |
| API8 | Security Misconfiguration | CORS, headers, verbose errors |
| API9 | Improper Inventory Management | Shadow APIs, outdated versions |
| API10 | Unsafe Consumption of APIs | Trusting third-party APIs |
API1: Broken Object Level Authorization (BOLA)
// Bad: No ownership check
app.get('/api/orders/:id', async (req, res) => {
const order = await Order.findById(req.params.id);
res.json(order);
});
// Good: Verify ownership
app.get('/api/orders/:id', authenticate, async (req, res) => {
const order = await Order.findOne({
_id: req.params.id,
userId: req.user.id // Filter by current user
});
if (!order) {
return res.status(404).json({ error: 'Order not found' });
}
res.json(order);
});
// Good: Use UUIDs instead of sequential IDs
// Harder to enumerate, though NOT a substitute for auth
GET /api/orders/550e8400-e29b-41d4-a716-446655440000
API3: Broken Object Property Level Authorization
// Bad: Mass assignment
app.put('/api/users/:id', async (req, res) => {
await User.findByIdAndUpdate(req.params.id, req.body); // Can set isAdmin!
});
// Good: Explicit field whitelist
const updateSchema = z.object({
name: z.string().optional(),
email: z.string().email().optional(),
// isAdmin NOT allowed
});
app.put('/api/users/:id', async (req, res) => {
const data = updateSchema.parse(req.body);
await User.findByIdAndUpdate(req.params.id, data);
});
// Bad: Excessive data exposure
app.get('/api/users/:id', async (req, res) => {
const user = await User.findById(req.params.id);
res.json(user); // Includes password hash, internal fields
});
// Good: DTOs with explicit fields
app.get('/api/users/:id', async (req, res) => {
const user = await User.findById(req.params.id);
res.json({
id: user.id,
name: user.name,
email: user.email
// Exclude: passwordHash, internalNotes, etc.
});
});
API4: Unrestricted Resource Consumption
// Good: Rate limiting
import rateLimit from 'express-rate-limit';
// Global rate limit
const globalLimiter = rateLimit({
windowMs: 15 * 60 * 1000, // 15 min
max: 100,
standardHeaders: true
});
// Stricter for auth endpoints
const authLimiter = rateLimit({
windowMs: 15 * 60 * 1000,
max: 5,
skipSuccessfulRequests: true
});
app.use('/api/', globalLimiter);
app.use('/api/auth/', authLimiter);
// Good: Pagination limits
const listSchema = z.object({
page: z.coerce.number().int().positive().default(1),
limit: z.coerce.number().int().min(1).max(100).default(20)
});
app.get('/api/items', async (req, res) => {
const { page, limit } = listSchema.parse(req.query);
const items = await Item.find()
.skip((page - 1) * limit)
.limit(limit);
res.json({ items, page, limit });
});
// Good: Request size limits
app.use(express.json({ limit: '100kb' }));
app.use(express.urlencoded({ limit: '100kb', extended: true }));
API7: Server Side Request Forgery (SSRF)
// Bad: Unvalidated URL fetch
app.post('/api/fetch', async (req, res) => {
const response = await fetch(req.body.url); // Can access internal services!
res.json(await response.json());
});
// Good: URL validation and allowlist
const ALLOWED_HOSTS = ['api.example.com', 'cdn.example.com'];
function validateUrl(urlString: string): URL {
const url = new URL(urlString);
if (!['http:', 'https:'].includes(url.protocol)) {
throw new Error('Invalid protocol');
}
if (!ALLOWED_HOSTS.includes(url.hostname)) {
throw new Error('Host not allowed');
}
// Block private IPs
const privateRanges = [
/^127\./,
/^10\./,
/^172\.(1[6-9]|2[0-9]|3[01])\./,
/^192\.168\./,
/^169\.254\./,
/^localhost$/i
];
if (privateRanges.some(r => r.test(url.hostname))) {
throw new Error('Private addresses not allowed');
}
return url;
}
API8: Security Misconfiguration
// Good: CORS configuration
import cors from 'cors';
const corsOptions = {
origin: (origin, callback) => {
const allowedOr
Установить api-security в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
ReadGrepGlobBashFAQ
Что делает скилл api-security?
API security across REST, GraphQL and gRPC, organised around the OWASP API Security Top 10:2023. USE WHEN: designing, implementing, or auditing REST, GraphQL, or gRPC APIs for security vulnerabilities DO NOT USE FOR: general API design patterns (use the `rest-api` / `graphql` skills), authentication setup (use the `jwt` / `oauth2` skills)
Как установить скилл api-security?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл api-security запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
от Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
от Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
от Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
от Anthropic