Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

api-security-checklist

БесплатноБез исполняемых скриптовНе проверен

Use when you add or change an endpoint, an auth check, a query by id, an outbound call to a user-supplied URL, file handling, or anything touching credentials…

makifbaysalот makifbaysal★ 123 звезды на GitHub

Об этом скилле

API Security Checklist

Overview

The OWASP API Security Top 10 (2023 edition, still current) orders API risk by how often it actually bites in production. This skill maps each category to a concrete Go/Java check instead of a paragraph of theory — see https://owasp.org/API-Security/editions/2023/en/0x11-t10/ for the source list.

Core principle: the most common API vulnerability is a lookup by id with no ownership check. Assume every id in a URL or body is adversarial.

API1: Broken Object-Level Authorization (BOLA)

The #1 API risk. A lookup that trusts the id alone instead of scoping it to the caller.

// ❌ anyone who guesses/enumerates an id can read or modify it
task, err := repo.Get(ctx, taskID)

// ✅ scoped to the caller/tenant exactly like its neighbours
task, err := repo.GetForOwner(ctx, taskID, ownerIDFromAuth(ctx))

Answer "not yours" the same way the endpoint's neighbours do — usually 404 (don't reveal existence to a non-owner) unless the repo already standardizes on 403. Test it: a second, different authenticated user requesting the first user's object must get the not-yours response, not the object.

API2: Broken Authentication

  • New routes go in the SAME middleware group as their neighbours (Fiber: api := app.Group("/api", authMW), never a bare app.Post outside it; Spring: match the route in the existing SecurityFilterChain; Quarkus: @RolesAllowed/@Authenticated).
  • Compare secrets/tokens with crypto/subtle.ConstantTimeCompare, never == (timing attack on string comparison).
  • Generate tokens with crypto/rand, never math/rand.

API3: Broken Object Property-Level Authorization (BOPLA — mass assignment / excessive data exposure)

  • The request DTO lists only the fields a client may set — never bind a request body directly onto a domain/entity struct that also has role, owner_id, is_admin, etc. If the DTO doesn't have the field, the client can't set it.
  • The response DTO lists only the fields a client may read — no password_hash, no internal ids, no other users' data riding along in a list response. Go: unexported fields or explicit response structs, never json:"-" as the only defense on a type that's also bound from requests. Java: a dedicated response record, never the JPA entity.

API4: Unrestricted Resource Consumption

  • Body size limit: fiber.Config{BodyLimit: ...} (default 4 MB) or http.MaxBytesReader — don't rely on the framework default alone for upload endpoints.
  • List endpoints have a maximum page size, not just a default (api-design-conventions).
  • Server read/write timeouts and outbound client timeouts are set explicitly (resilient-io-and-jobs) — an unbounded request or unbounded upstream call is a resource-consumption hole.
  • File uploads stream with a size cap rather than buffering the whole body in memory.

API5: Broken Function-Level Authorization

Admin/privileged routes are behind an explicit role check, not just "authenticated" — verify the route's authorization matches its actual privilege level, not just that some auth middleware ran.

API6: Unrestricted Access to Sensitive Business Flows

Rate-limit a sensitive flow (password reset, bulk export, payment) the same way its neighbours already do; don't ship a new sensitive endpoint with no rate limit when similar ones have one.

API7: Server-Side Request Forgery (SSRF)

Any endpoint that fetches a user-supplied URL (webhooks, image-by-URL, link previews):

  • Allowlist the scheme (https only, usually) and, where feasible, the host.
  • Resolve the host and reject private/loopback/link-local ranges (127.0.0.0/8, 10.0.0.0/8, 169.254.0.0/16, ::1, etc.) before connecting.
  • Disable automatic redirect following, or re-validate the target after each redirect: Go http.Client{CheckRedirect: func(...) error { return http.ErrUseLastResponse }}.

API8: Security Misconfiguration

  • No Access-Control-Allow-Origin: * combined with Access-Control-Allow-Credentials: true.
  • No stack traces, SQL errors, or internal paths in an error response (api-design-conventions — the error mapper owns this).
  • Debug/profiling endpoints (pprof, actuator internals) are not exposed the same way in a deployed environment as in dev.

API9: Improper Inventory Management

Keep the OpenAPI document in sync (api-contract-openapi) — an undocumented or "quietly removed" endpoint is still reachable until it's actually gone.

API10: Unsafe Consumption of APIs

Validate and size-limit third-party API responses before trusting them; apply the same timeout/retry discipline to outbound calls as to your own endpoints (resilient-io-and-jobs).

Beyond the Top 10

  • SQL/command injection: parameterized queries always; exec.Command(name, arg1, arg2) with separate arguments, never a shell string built from user input.
  • Path traversal: os.Root (Go ≥1.24) when serving files from a directory by user-supplied name.
  • Secrets: only from env or a secret man
Полный SKILL.md на GitHub

Установить api-security-checklist в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

FAQ

Что делает скилл api-security-checklist?

Use when you add or change an endpoint, an auth check, a query by id, an outbound call to a user-supplied URL, file handling, or anything touching credentials — the OWASP API Top 10 (2023) as concrete Go and Java checks

Как установить скилл api-security-checklist?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл api-security-checklist запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить api-security-checklist с