[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M733AZ72A1CJA40VM7CPECEB":3,"skill-same:01M733AZ72A1CJA40VM7CPECEB":48},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":24,"commitSha":25,"skillDirectory":26,"forksCount":27,"repositoryHtmlUrl":28,"repositoryHomepageUrl":29,"ownerHtmlUrl":30,"ownerBlogUrl":31,"ownerDescription":32,"updatedAt":33,"install":34,"resources":47},"01M733AZ72A1CJA40VM7CPECEB","api-security",null,"Apply the OWASP API Security Top 10 to REST and GraphQL endpoints. Covers broken object-level authorization (BOLA), mass assignment, excessive data exposure, unrestricted resource consumption, SSRF, broken function-level authorization, and GraphQL depth and complexity limits. Invoke when designing a new API, reviewing one before scaling, or after API abuse (scraping, account takeover).","Horonomos-laps\u002FYana-AI","Horonomos-laps","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F355299122?v=4","01M76B3QPXE88ET2SQPDPVATZT"," Horonomos-laps","01M72ZQRJPCYPSSWT4D00VJR2A",13,"Apache-2.0","https:\u002F\u002Fgithub.com\u002FHoronomos-laps\u002FYana-AI\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fgw360--api-security\u002FSKILL.md",[],[],"2026-11-11 15:11:14",false,"---\nname: api-security\ndescription: Apply the OWASP API Security Top 10 to REST and GraphQL endpoints. Covers broken object-level authorization (BOLA), mass assignment, excessive data exposure, unrestricted resource consumption, SSRF, broken function-level authorization, and GraphQL depth and complexity limits. Invoke when designing a new API, reviewing one before scaling, or after API abuse (scraping, account takeover).\n---\n\n# API Security\n\nWeb-app and API security overlap but are not the same. APIs ship with different defaults (CORS-permissive, no CSRF tokens, often no rate-limiting), different consumers (mobile apps, integrations, scripts — not just browsers), and a different attack surface (object IDs in URLs, JSON bodies, scoped tokens). The **OWASP API Security Top 10 (2023 edition)** is the canonical reference; this skill walks each item with concrete detection and fix patterns.\n\n## When to invoke\n\n- Designing a new REST or GraphQL API\n- Reviewing an existing API before scaling user count\n- After abuse — scraping, account takeover, suspicious 4xx\u002F5xx patterns\n- Adding a public-facing endpoint to a previously internal service\n- An API is feeding a mobile or single-page app where the client cannot be trusted\n- Periodic API audit (quarterly is reasonable)\n\n## API01:2023 — Broken Object Level Authorization (BOLA)\n\n**The #1 API vulnerability and not even close.** Every endpoint that takes an ID and returns the corresponding resource must check the caller is allowed to see *that specific* object.\n\n```ts\n\u002F\u002F Bad — any authenticated user reads any invoice\napp.get('\u002Fapi\u002Finvoices\u002F:id', requireAuth, async (req, res) => {\n  const invoice = await db.invoices.findUnique({ where: { id: req.params.id }});\n  res.json(invoice);\n});\n\n\u002F\u002F Good — scoped to the requester's ownership\napp.get('\u002Fapi\u002Finvoices\u002F:id', requireAuth, async (req, res) => {\n  const invoice = await db.invoices.findFirst({\n    where: { id: req.params.id, userId: req.user.id }\n  });\n  if (!invoice) return res.status(404).json({ error: 'not found' });\n  res.json(invoice);\n});\n```\n\nDetection in a codebase:\n\n```bash\n# Every parameterized route is a BOLA candidate. Walk them.\ngrep -rEn \":id|:slug|:uuid\" src\u002Froutes src\u002Fapi app 2>\u002Fdev\u002Fnull\n\n# Routes that fetch by primary key alone — high-suspicion pattern\ngrep -rEn 'findUnique\\\\(\\\\{\\\\s*where:\\\\s*\\\\{\\\\s*id:' --include='*.{ts,js}' . | head\n```\n\nPatterns that make BOLA harder to introduce:\n\n- **Always include `userId` or `tenantId` in the `where` clause**, not just the resource ID\n- **Use database row-level security (RLS)** as a backstop — Postgres RLS plus per-request `SET LOCAL app.current_user`. See [`postgres-hardening`](..\u002Fpostgres-hardening\u002FSKILL.md).\n- **Use opaque IDs** (UUIDs or hashids), not sequential integers. Doesn't fix BOLA but slows enumeration if it slips through.\n\n## API02:2023 — Broken Authentication\n\nAuth on APIs has its own failure modes beyond web-app auth.\n\n- **Token validation skipped on health\u002Finfo\u002Fdebug endpoints** that grew to leak data\n- **JWTs validated for signature but not for `iss`, `aud`, `exp`** — pin all three\n- **No revocation path** for issued tokens — long-lived JWTs are session cookies you cannot recall\n- **API keys with no expiry, no rotation, no scope** — issued once, lives forever, total power\n- **Bearer tokens in URLs** (showing up in access logs, referer headers) — always in `Authorization` header\n\nFor password-based API auth specifically:\n\n- Same patterns as web auth — see [`auth-hardening`](..\u002Fauth-hardening\u002FSKILL.md)\n- Per-IP and per-account rate-limiting on `\u002Fapi\u002Fauth\u002Flogin`\n- MFA flow that works over API (TOTP code as a field; WebAuthn via session)\n- Generic error on auth failure — never \"user not found\"\n\n## API03:2023 — Broken Object Property Authorization\n\nTwo flavors:\n\n### Mass assignment\n\n```ts\n\u002F\u002F Bad — user can set their own role to admin\napp.patch('\u002Fapi\u002Fusers\u002Fme', requireAuth, async (req, res) => {\n  const updated = await db.users.update({\n    where: { id: req.user.id },\n    data: req.body,                    \u002F\u002F ☠️ accepts arbitrary keys including 'role'\n  });\n  res.json(updated);\n});\n\n\u002F\u002F Good — explicit allowlist of editable fields\nconst PROFILE_FIELDS = ['displayName', 'avatarUrl', 'timezone'];\n\napp.patch('\u002Fapi\u002Fusers\u002Fme', requireAuth, async (req, res) => {\n  const data = Object.fromEntries(\n    Object.entries(req.body).filter(([k]) => PROFILE_FIELDS.includes(k))\n  );\n  const updated = await db.users.update({ where: { id: req.user.id }, data });\n  res.json(updated);\n});\n```\n\nBetter: validate with a schema library (Zod, Valibot, class-validator) and let it reject unknown keys.\n\n### Excessive data exposure\n\nAPI returns the whole DB row when the consumer needs three fields. Browser-facing this leaks PII; mobile-app-facing the same leak is in production traffic forever.\n\n```ts\n\u002F\u002F Bad\nconst user = await db.users.findUnique({ where: { id }});\nreturn user;   \u002F\u002F includes password_hash, email_verified_at, internal_notes, ...\n\n\u002F\u002F Good — explicit projection\nconst user = await db.users.findUnique({\n  where: { id },\n  select: { id: true, displayName: true, avatarUrl: true },\n});\n```\n\nFor GraphQL: the schema *is* the contract. Treat every field on every type as \"is this safe to expose to this kind of caller?\"\n\n## API04:2023 — Unrestricted Resource Consumption\n\nDoS via expensive operations. APIs are easier to DoS than web apps because each request can deliberately ask for more work.\n\nDefenses, all of which you need:\n\n- **Rate limiting** — per IP, per user, per endpoint. Cheap to add, eliminates the easy attacks.\n\n  ```ts\n  \u002F\u002F Express + express-rate-limit\n  import rateLimit from 'express-rate-limit';\n  app.use('\u002Fapi\u002F', rateLimit({\n    windowMs: 60_000, max: 100,\n    standardHeaders: 'draft-7', legacyHeaders: false,\n  }));\n  app.use('\u002Fapi\u002Fauth\u002Flogin', rateLimit({ windowMs: 60_000, max: 5, skipSuccessfulRequests: true }));\n  ```\n\n- **Body size limits** — `app.use(express.json({ limit: '100kb' }))`. The default of 1MB is too generous for most APIs.\n- **Request timeout** — 10–30s max for any endpoint. Long-running work goes to a queue.\n- **Pagination caps** — `limit=10000` is not pagination, it is \"give me everything.\" Cap server-side at 100 or so.\n- **Query complexity for GraphQL** — `graphql-depth-limit` + `graphql-query-complexity`. Without these, `{ user { friends { friends { friends { ... } } } } }` brings the DB down.\n- **Cost-aware operations** — anything that touches an external paid API (email send, SMS, AI) needs its own budget cap per user per time window.\n\n## API05:2023 — Broken Function Level Authorization\n\nAdmin \u002F privileged endpoints reachable by non-admins. Common when:\n\n- Admin routes are nested under `\u002Fapi\u002Fadmin\u002F` but the auth check is at middleware level only — and a route was added later that bypasses middleware\n- Mobile-app endpoints hide admin features client-side; the API still serves them to anyone with a token\n\nDetection:\n\n```bash\ngrep -rE '\u002Fapi\u002Fadmin' src 2>\u002Fdev\u002Fnull\ngrep -rE 'role.*admin|isAdmin|requireAdmin' src 2>\u002Fdev\u002Fnull\n# Every admin route should have the role check in the handler, not just middleware\n```\n\nSame rule as elsewhere in this repo: **never rely on middleware alone**. Each privileged handler does its own check.\n\n## API06:2023 — Unrestricted Access to Sensitive Business Flows\n\nA specific subclass of resource consumption: even with rate limits, an attacker can scrape your \"show me product X price\" endpoint at 1 RPS for weeks. The data eventually leaves your system.\n\nExamples in the wild:\n\n- Booking sites scraped for hotel inventory\n- E-commerce APIs scraped for product catalogs\n- Review\u002Fratings APIs scraped for user data\n- \"Refer a friend\" flows automated for promo abuse\n\nMitigations require business-context decisions:\n\n- **CAPTCHAs \u002F proof of work** for high-value flows after first hit\n- **Behavioral signals** (user-agent diversity, mouse movement patterns, ASN reputation) — Cloudflare Bot Fight \u002F Turnstile is a free starting point\n- **Account-level rate limiting** beyond IP — one user creating 1000 referrals per hour is suspicious even if from 1000 IPs\n- **Pricing \u002F catalog data** served via signed, time-limited URLs after auth, not as free GET endpoints\n\n## API07:2023 — Server-Side Request Forgery (SSRF)\n\n```ts\n\u002F\u002F Bad — fetches whatever the user says, including internal services\napp.get('\u002Fapi\u002Fpreview', async (req, res) => {\n  const url = req.query.url as string;\n  const r = await fetch(url);\n  res.send(await r.text());\n});\n```\n\nAttacker submits `http:\u002F\u002F169.254.169.254\u002Flatest\u002Fmeta-data\u002F` (AWS metadata) or `http:\u002F\u002Flocalhost:6379\u002F` (your Redis) and your server happily proxies.\n\nFix:\n\n- **Allowlist destination hostnames** — only `https:\u002F\u002Fknown-customer-domains.example.com\u002F*`\n- **Resolve and validate the IP** before fetching — reject private ranges (`10.0.0.0\u002F8`, `172.16.0.0\u002F12`, `192.168.0.0\u002F16`, `127.0.0.0\u002F8`, `169.254.0.0\u002F16`, `::1`, `fc00::\u002F7`)\n- **Disable redirects** or revalidate at each hop — an allowed domain can 302 to a bad one\n- **Run the fetcher in a network-isolated process** without access to internal services\n\nFor URL-fetching features, consider routing through a dedicated proxy service (e.g. Cloudflare Workers) that enforces the rules outside the app's trust boundary.\n\n## API08:2023 — Security Misconfiguration\n\nA grab bag, but the high-frequency ones:\n\n- **CORS too permissive** — `Access-Control-Allow-Origin: *` on endpoints that return user data, or echoing back the `Origin` header unchanged\n- **Verbose errors in production** — stack traces, DB errors, internal paths in 500 responses\n- **`OPTIONS` \u002F `TRACE` enabled** when not needed\n- **Missing security headers** — `Strict-Transport-Security`, `X-Content-Type-Options`, etc. See [`site-server-audit`](..\u002Fsite-server-audit\u002FSKILL.md).\n- **Default credentials** somewhere in the stack (admin tools, DB admin UI, etc.)\n- **Debug endpoints accessible** in production (`\u002Fdebug`, `\u002F__profile__`, `\u002F_admin\u002Finspect`)\n\nDetection:\n\n```bash\ngrep -rEn 'cors.*\\\\*|Access-Control-Allow-Origin.*\\\\*' --include='*.{js,ts,py}' .\ngrep -rEn 'NODE_ENV.*development|DEBUG.*True|app\\\\.debug' --include='*.{js,ts,py}' .\ncurl -sI https:\u002F\u002Fapi.example.com | grep -iE 'strict-transport|x-content-type|x-frame'\n```\n\n## API09:2023 — Improper Inventory Management\n\nThe API you forgot about is the one that gets exploited:\n\n- **Old `\u002Fv1\u002F*` endpoints** still live after the app moved to `\u002Fv2\u002F*`\n- **Staging environments** with prod-like data accessible from the internet\n- **Mobile-app endpoints** still serving older app versions long after they're deprecated, with weaker auth\n- **Internal endpoints** that became externally reachable when networking changed\n\nMitigations:\n\n- **Inventory all hosts and endpoints** quarterly. `dig`, `subfinder`, your DNS records, your reverse-proxy config\n- **Sunset old API versions** with concrete dates communicated to consumers\n- **Stage-prod separation** at the network layer, not just hope\n- **Robots\u002Fsitemap discipline** — your sitemap should not list `\u002Fapi\u002F*`\n\n## API10:2023 — Unsafe Consumption of APIs\n\nYour API calls third-party APIs (Stripe, SendGrid, OpenAI, weather, etc.). Treat third-party responses as untrusted input.\n\n- **Validate the response** — schema-check, range-check, length-check. Do not blindly pipe into your DB.\n- **TLS verification on** — never `rejectUnauthorized: false` in production\n- **Timeouts** — third-party slowness becomes your outage if you wait forever\n- **Circuit breakers** for repeatedly-failing third parties — fail fast, fall back gracefully\n- **Secret hygiene** — third-party API keys are secrets, treat them as such ([`secret-hygiene`](..\u002Fsecret-hygiene\u002FSKILL.md))\n\n## GraphQL-specific patterns\n\nGraphQL adds attack surface even when REST patterns are addressed:\n\n- **Introspection on in production** — turn off unless you need the playground for a reason\n- **Field-level authorization** is the explicit responsibility of resolvers — `@auth` directives are good\n- **N+1 query patterns** become DoS — `DataLoader` is essentially mandatory\n- **Query depth limit** — most schemas should cap at 8–10 levels\n- **Query complexity limit** — assign cost per field; total cap per request\n- **Aliasing for amplification** — one query can request the same expensive field 100 times with aliases; limit alias count too\n\n```ts\nimport depthLimit from 'graphql-depth-limit';\nimport { createComplexityRule } from 'graphql-query-complexity';\n\nconst server = new ApolloServer({\n  schema,\n  validationRules: [\n    depthLimit(10),\n    createComplexityRule({ maximumComplexity: 1000, \u002F* ... *\u002F }),\n  ],\n  introspection: process.env.NODE_ENV !== 'production',\n});\n```\n\n## API design patterns that prevent classes of issues\n\n- **Resource scoping in URLs** — `\u002Fusers\u002Fme\u002Finvoices\u002F:id` instead of `\u002Finvoices\u002F:id`. Forces the design to think about who owns the resource.\n- **Standard pagination** — cursor-based, server-controlled page size, with documented limits\n- **Consistent error format** — `{ error: { code, message } }` with sanitized messages, codes mapped to client behavior\n- **Versioning explicit in the URL** — `\u002Fapi\u002Fv1\u002F`, `\u002Fapi\u002Fv2\u002F`. Forces deprecation discipline.\n- **OpenAPI \u002F GraphQL schema as contract** — every endpoint is documented; what isn't documented isn't supposed to be reachable.\n- **`Content-Type: application\u002Fjson` enforced** on POST\u002FPUT\u002FPATCH — rejects naive form-encoded probes\n\n## Quick audit checklist\n\nWalk every endpoint against:\n\n- [ ] Auth required? Owner\u002Frole check in the handler (not just middleware)?\n- [ ] Input validated against a schema?\n- [ ] Output projection explicit — no leaking internal fields?\n- [ ] Rate limit applied at per-endpoint or per-user level?\n- [ ] Body size capped?\n- [ ] Timeouts set?\n- [ ] No SSRF: user-supplied URLs allowlisted before fetching?\n- [ ] CORS scoped to known origins, not `*`?\n- [ ] Errors are generic in production?\n- [ ] If GraphQL: depth + complexity limits, introspection off in prod?\n- [ ] Versioned and dated for sunset?\n- [ ] Documented in your API catalog?\n\nAnything you cannot answer → finding.\n\n## What this skill will not do\n\n- Help test or exploit APIs you do not own\n- Recommend disabling auth, CORS, or rate-limiting \"for the dev environment that's also publicly reachable\"\n- Endorse trusting the client (browser, mobile app) for security-relevant checks\n","# API Security\n\nWeb-app and API security overlap but are not the same. APIs ship with different defaults (CORS-permissive, no CSRF tokens, often no rate-limiting), different consumers (mobile apps, integrations, scripts — not just browsers), and a different attack surface (object IDs in URLs, JSON bodies, scoped tokens). The **OWASP API Security Top 10 (2023 edition)** is the canonical reference; this skill walks each item with concrete detection and fix patterns.\n\n## When to invoke\n\n- Designing a new REST or GraphQL API\n- Reviewing an existing API before scaling user count\n- After abuse — scraping, account takeover, suspicious 4xx\u002F5xx patterns\n- Adding a public-facing endpoint to a previously internal service\n- An API is feeding a mobile or single-page app where the client cannot be trusted\n- Periodic API audit (quarterly is reasonable)\n\n## API01:2023 — Broken Object Level Authorization (BOLA)\n\n**The #1 API vulnerability and not even close.** Every endpoint that takes an ID and returns the corresponding resource must check the caller is allowed to see *that specific* object.\n\n```ts\n\u002F\u002F Bad — any authenticated user reads any invoice\napp.get('\u002Fapi\u002Finvoices\u002F:id', requireAuth, async (req, res) => {\n  const invoice = await db.invoices.findUnique({ where: { id: req.params.id }});\n  res.json(invoice);\n});\n\n\u002F\u002F Good — scoped to the requester's ownership\napp.get('\u002Fapi\u002Finvoices\u002F:id', requireAuth, async (req, res) => {\n  const invoice = await db.invoices.findFirst({\n    where: { id: req.params.id, userId: req.user.id }\n  });\n  if (!invoice) return res.status(404).json({ error: 'not found' });\n  res.json(invoice);\n});\n```\n\nDetection in a codebase:\n\n```bash\n# Every parameterized route is a BOLA candidate. Walk them.\ngrep -rEn \":id|:slug|:uuid\" src\u002Froutes src\u002Fapi app 2>\u002Fdev\u002Fnull\n\n# Routes that fetch by primary key alone — high-suspicion pattern\ngrep -rEn 'findUnique\\\\(\\\\{\\\\s*where:\\\\s*\\\\{\\\\s*id:' --include='*.{ts,js}' . | head\n```\n\nPatterns that make BOLA harder to introduce:\n\n- **Always include `userId` or `tenantId` in the `where` clause**, not just the resource ID\n- **Use database row-level security (RLS)** as a backstop — Postgres RLS plus per-request `SET LOCAL app.current_user`. See [`postgres-hardening`](..\u002Fpostgres-hardening\u002FSKILL.md).\n- **Use opaque IDs** (UUIDs or hashids), not sequential integers. Doesn't fix BOLA but slows enumeration if it slips through.\n\n## API02:2023 — Broken Authentication\n\nAuth on APIs has its own failure modes beyond web-app auth.\n\n- **Token validation skipped on health\u002Finfo\u002Fdebug endpoints** that grew to leak data\n- **JWTs validated for signature but not for `iss`, `aud`, `exp`** — pin all three\n- **No revocation path** for issued tokens — long-lived JWTs are session cookies you cannot recall\n- **API keys with no expiry, no rotation, no scope** — issued once, lives forever, total power\n- **Bearer tokens in URLs** (showing up in access logs, referer headers) — always in `Authorization` header\n\nFor password-based API auth specifically:\n\n- Same patterns as web auth — see [`auth-hardening`](..\u002Fauth-hardening\u002FSKILL.md)\n- Per-IP and per-account rate-limiting on `\u002Fapi\u002Fauth\u002Flogin`\n- MFA flow that works over API (TOTP code as a field; WebAuthn via session)\n- Generic error on auth failure — never \"user not found\"\n\n## API03:2023 — Broken Object Property Authorization\n\nTwo flavors:\n\n### Mass assignment\n\n```ts\n\u002F\u002F Bad — user can set their own role to admin\napp.patch('\u002Fapi\u002Fusers\u002Fme', requireAuth, async (req, res) => {\n  const updated = await db.users.update({\n    where: { id: req.user.id },\n    data: req.body,                    \u002F\u002F ☠️ accepts arbitrary keys including 'role'\n  });\n  res.json(updated);\n});\n\n\u002F\u002F Good — explicit allowlist of editable fields\nconst PROFILE_FIELDS = ['displayName', 'avatarUrl', 'timezone'];\n\napp.patch('\u002Fapi\u002Fusers\u002Fme', requireAuth, async (req, res) => {\n  const data = Object.fromEntries(\n    Object.entries(req.body).filter(([k]) => PROFILE_FIELDS.includes(k))\n  );\n  const updated = await db.users.update({ where: { id: req.user.id }, data });\n  res.json(updated);\n});\n```\n\nBetter: validate with a schema library (Zod, Valibot, class-validator) and let it reject unknown keys.\n\n### Excessive data exposure\n\nAPI returns the whole DB row when the consumer needs three fields. Browser-facing this leaks PII; mobile-app-facing the same leak is in production traffic forever.\n\n```ts\n\u002F\u002F Bad\nconst user = await db.users.findUnique({ where: { id }});\nreturn user;   \u002F\u002F includes password_hash, email_verified_at, internal_notes, ...\n\n\u002F\u002F Good — explicit projection\nconst user = await db.users.findUnique({\n  where: { id },\n  select: { id: true, displayName: true, avatarUrl: true },\n});\n```\n\nFor GraphQL: the schema *is* the contract. Treat every field on every type as \"is this safe to expose to this kind of caller?\"\n\n## API04:2023 — Unrestricted Resource Consumption\n\nDoS via expensive operations. APIs are easier to DoS than web apps because each request can deliberately ask for more work.\n\nDefenses, all of which you need:\n\n- **Rate limiting** — per IP, per user, per endpoint. Cheap to add, eliminates the easy attacks.\n\n  ```ts\n  \u002F\u002F Express + express-rate-limit\n  import rateLimit from 'express-rate-limit';\n  app.use('\u002Fapi\u002F', rateLimit({\n    windowMs: 60_000, max: 100,\n    standardHeaders: 'draft-7', legacyHeaders: false,\n  }));\n  app.use('\u002Fapi\u002Fauth\u002Flogin', rateLimit({ windowMs: 60_000, max: 5, skipSuccessfulRequests: true }));\n  ```\n\n- **Body size limits** — `app.use(express.json({ limit: '100kb' }))`. The default of 1MB is too generous for most APIs.\n- **Request timeout** — 10–30s max for any endpoint. Long-running work goes to a queue.\n- **Pagination caps** — `limit=10000` is not pagination, it is \"give me everything.\" Cap server-side at 100 or so.\n- **Query complexity for GraphQL** — `graphql-depth-limit` + `graphql-query-complexity`. Without these, `{ user { friends { friends { friends { ... } } } } }` brings the DB down.\n- **Cost-aware operations** — anything that touches an external paid API (email send, SMS, AI) needs its own budget cap per user per time window.\n\n## API05:2023 — Broken Function Level Authorization\n\nAdmin \u002F privileged endpoints reachable by non-admins. Common when:\n\n- Admin routes are nested under `\u002Fapi\u002Fadmin\u002F` but the auth check is at middleware level only — and a route was added later that bypasses middleware\n- Mobile-app endpoints hide admin features client-side; the API still serves them to anyone with a token\n\nDetection:\n\n```bash\ngrep -rE '\u002Fapi\u002Fadmin' src 2>\u002Fdev\u002Fnull\ngrep -rE 'role.*admin|isAdmin|requireAdmin' src 2>\u002Fdev\u002Fnull\n# Every admin route should have the role check in the handler, not just middleware\n```\n\nSame rule as elsewhere in this repo: **never rely on middleware alone**. Each privileged handler does its own check.\n\n## API06:2023 — Unrestricted Access to Sensitive Business Flows\n\nA specific subclass of resource consumption: even with rate limits, an attacker can scrape your \"show me product X price\" endpoint at 1 RPS for weeks. The data eventually leaves your system.\n\nExamples in the wild:\n\n- Booking sites scraped for hotel inventory\n- E-commerce APIs scraped for product catalogs\n- Review\u002Fratings APIs scraped for user data\n- \"Refer a friend\" flows automated for promo abuse\n\nMitigations require business-context decisions:\n\n- **CAPTCHAs \u002F proof of work** for high-value flows after first hit\n- **Behavioral signals** (user-agent diversity, mouse movement patterns, ASN reputation) — Cloudflare Bot Fight \u002F Turnstile is a free starting point\n- **Account-level rate limiting** beyond IP — one user creating 1000 referrals per hour is suspicious even if from 1000 IPs\n- **Pricing \u002F catalog data** served via signed, time-limited URLs after auth, not as free GET endpoints\n\n## API07:2023 — Server-Side Request Forgery (SSRF)\n\n```ts\n\u002F\u002F Bad — fetches whatever the user says, including internal services\napp.get('\u002Fapi\u002Fpreview', async (req, res) => {\n  const url = req.query.url as string;\n  const r = await fetch(url);\n  res.send(await r.text());\n});\n```\n\nAttacker submits `http:\u002F\u002F169.254.169.254\u002Flatest\u002Fmeta-data\u002F` (AWS metadata) or `http:\u002F\u002Flocalhost:6379\u002F` (your Redis) and your server happily proxies.\n\nFix:\n\n- **Allowlist destination hostnames** — only `https:\u002F\u002Fknown-customer-domains.example.com\u002F*`\n- **Resolve and validate the IP** before fetching — reject private ranges (`10.0.0.0\u002F8`, `172.16.0.0\u002F12`, `192.168.0.0\u002F16`, `127.0.0.0\u002F8`, `169.254.0.0\u002F16`, `::1`, `fc00::\u002F7`)\n- **Disable redirects** or revalidate at each hop — an allowed domain can 302 to a bad one\n- **Run the fetcher in a network-isolated process** without access to internal services\n\nFor URL-fetching features, consider routing through a dedicated proxy service (e.g. Cloudflare Workers) that enforces the rules outside the app's trust boundary.\n\n## API08:2023 — Security Misconfiguration\n\nA grab bag, but the high-frequency ones:\n\n- **CORS too permissive** — `Access-Control-Allow-Origin: *` on endpoints that return user data, or echoing back the `Origin` header unchanged\n- **Verbose errors in production** — stack traces, DB errors, internal paths in 500 responses\n- **`OPTIONS` \u002F `TRACE` enabled** when not needed\n- **Missing security headers** — `Strict-Transport-Security`, `X-Content-Type-Options`, etc. See [`site-server-audit`](..\u002Fsite-server-audit\u002FSKILL.md).\n- **Default credentials** somewhere in the stack (admin tools, DB admin UI, etc.)\n- **Debug endpoints accessible** in production (`\u002Fdebug`, `\u002F__profile__`, `\u002F_admin\u002Finspect`)\n\nDetection:\n\n```bash\ngrep -rEn 'cors.*\\\\*|Access-Control-Allow-Origin.*\\\\*' --include='*.{js,ts,py}' .\ngrep -rEn 'NODE_ENV.*development|DEBUG.*True|app\\\\.debug' --include='*.{js,ts,py}' .\ncurl -sI https:\u002F\u002Fapi.example.com | grep -iE 'strict-transport|x-content-type|x-frame'\n```\n\n## API09:2023 — Improper Inventory Management\n\nThe API you forgot about is the one that gets exploited:\n\n- **Old `\u002Fv1\u002F*` endpoints** still live after the app moved to `\u002Fv2\u002F*`\n- **Staging environments** with prod-like data accessible from the internet\n- **Mobile-app endpoints** still serving older app versions long after they're deprecated, with weaker auth\n- **Internal endpoints** that became externally reachable when networking changed\n\nMitigations:\n\n- **Inventory all hosts and endpoints** quarterly. `dig`, `subfinder`, your DNS records, your reverse-proxy config\n- **Sunset old API versions** with concrete dates communicated to consumers\n- **Stage-prod separation** at the network layer, not just hope\n- **Robots\u002Fsitemap discipline** — your sitemap should not list `\u002Fapi\u002F*`\n\n## API10:2023 — Unsafe Consumption of APIs\n\nYour API calls third-party APIs (Stripe, SendGrid, OpenAI, weather, etc.). Treat third-party responses as untrusted input.\n\n- **Validate the response** — schema-check, range-check, length-check. Do not blindly pipe into your DB.\n- **TLS verification on** — never `rejectUnauthorized: false` in production\n- **Timeouts** — third-party slowness becomes your outage if you wait forever\n- **Circuit breakers** for repeatedly-failing third parties — fail fast, fall back gracefully\n- **Secret hygiene** — third-party API keys are secrets, treat them as such ([`secret-hygiene`](..\u002Fsecret-hygiene\u002FSKILL.md))\n\n## GraphQL-specific patterns\n\nGraphQL adds attack surface even when REST patterns are addressed:\n\n- **Introspection on in production** — turn off unless you need the playground for a reason\n- **Field-level authorization** is the explicit responsibility of resolvers — `@auth` directives are good\n- **N+1 query patterns** become DoS — `DataLoader` is essentially mandatory\n- **Query depth limit** — most schemas should cap at 8–10 levels\n- **Query complexity limit** — assign cost per field; total cap per request\n- **Aliasing for amplification** — one query can request the same expensive field 100 times with aliases; limit alias count too\n\n```ts\nimport depthLimit from 'graphql-depth-limit';\nimport { createComplexityRule } from 'graphql-query-complexity';\n\nconst server = new ApolloServer({\n  schema,\n  validationRules: [\n    depthLimit(10),\n    createComplexityRule({ maximumComplexity: 1000, \u002F* ... *\u002F }),\n  ],\n  introspection: process.env.NODE_ENV !== 'production',\n});\n```\n\n## API design patterns that prevent classes of issues\n\n- **Resource scoping in URLs** — `\u002Fusers\u002Fme\u002Finvoices\u002F:id` instead of `\u002Finvoices\u002F:id`. Forces the design to think about who owns the resource.\n- **Standard pagination** — cursor-based, server-controlled page size, with documented limits\n- **Consistent error format** — `{ error: { code, message } }` with sanitized messages, codes mapped to client behavior\n- **Versioning explicit in the URL** — `\u002Fapi\u002Fv1\u002F`, `\u002Fapi\u002Fv2\u002F`. Forces deprecation discipline.\n- **OpenAPI \u002F GraphQL schema as contract** — every endpoint is documented; what isn't documented isn't supposed to be reachable.\n- **`Content-Type: application\u002Fjson` enforced** on POST\u002FPUT\u002FPATCH — rejects naive form-encoded probes\n\n## Quick audit checklist\n\nWalk every endpoint against:\n\n- [ ] Auth required? Owner\u002Frole check in the handler (not just middleware)?\n- [ ] Input validated against a schema?\n- [ ] Output projection explicit — no leaking internal fields?\n- [ ] Rate limit applied at per-endpoint or per-user level?\n- [ ] Body size capped?\n- [ ] Timeouts set?\n- [ ] No SSRF: user-supplied URLs allowlisted before fetching?\n- [ ] CORS scoped to known origins, not `*`?\n- [ ] Errors are generic in production?\n- [ ] If GraphQL: depth + complexity limits, introspection off in prod?\n- [ ] Versioned and dated for sunset?\n- [ ] Documented in your API catalog?\n\nAnything you cannot answer → finding.\n\n## What this skill will not do\n\n- Help test or exploit APIs you do not own\n- Recommend disabling auth, CORS, or rate-limiting \"for the dev environment that's also publicly reachable\"\n- Endorse trusting the client (browser, mobile app) for security-relevant checks\n",{"name":5,"description":7},"main","481dcd7dd2e288b9d627a2bd017db70e64e6c6fa",".claude\u002Fskills\u002Fgw360--api-security",2,"https:\u002F\u002Fgithub.com\u002FHoronomos-laps\u002FYana-AI","https:\u002F\u002Fyana.vutam.link\u002F","https:\u002F\u002Fgithub.com\u002FHoronomos-laps","https:\u002F\u002Fyana.vutam.link","An open-source governed runtime & execution environment for multi-agent AI systems.","2026-11-14 13:24:09",{"source":8,"skillName":5,"commands":35,"prompt":45,"zipAvailable":46},[36,39,42],{"tool":37,"command":38},"npx","npx skills add Horonomos-laps\u002FYana-AI --skill api-security",{"tool":40,"command":41},"bunx","bunx skills add Horonomos-laps\u002FYana-AI --skill api-security",{"tool":43,"command":44},"pnpm","pnpm dlx skills add Horonomos-laps\u002FYana-AI --skill api-security","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FHoronomos-laps\u002FYana-AI\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fgw360--api-security\u002FSKILL.md",true,[],[49,57,64,72,80,88],{"skillNo":50,"name":51,"nameZh":6,"description":52,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":53,"licenseFileUrl":6,"sourceHtmlUrl":54,"categories":55,"keywords":56,"publishedAt":19},"01M735GKET5YVYKAY62W2P5YXB","openai--sentry--sentry","Use when the user asks to inspect Sentry issues or events, summarize recent production errors, or pull basic Sentry health data via the Sentry API; perform read-only queries with the bundled script and require `SENTRY_AUTH_TOKEN`.","MIT","https:\u002F\u002Fgithub.com\u002FHoronomos-laps\u002FYana-AI\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fopenai--sentry--sentry\u002FSKILL.md",[],[],{"skillNo":58,"name":59,"nameZh":6,"description":60,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":61,"categories":62,"keywords":63,"publishedAt":19},"01M73DCAP83T17HY7SMGK7MGFE","ito-basket-compare","Compare Itô prediction-market baskets against a user's knowledge base, portfolio notes, financial context, watchlist, or research thesis. Use for read-only basket comparison and gap analysis without investment advice or live trading.","https:\u002F\u002Fgithub.com\u002FHoronomos-laps\u002FYana-AI\u002Fblob\u002Fmain\u002Fcore\u002Fskills\u002Fito-basket-compare\u002FSKILL.md",[],[],{"skillNo":65,"name":66,"nameZh":6,"description":67,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":68,"sourceHtmlUrl":69,"categories":70,"keywords":71,"publishedAt":19},"01M734CYEMZFDR3KH6SW0JP8TD","implementing-network-traffic-baselining","Build network traffic baselines from NetFlow\u002FIPFIX data using Python pandas for statistical analysis, z-score anomaly detection, and hourly\u002Fdaily traffic pattern profiling","https:\u002F\u002Fgithub.com\u002Fyanacuti1121\u002FYana-AI\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fimplementing-network-traffic-baselining\u002FLICENSE","https:\u002F\u002Fgithub.com\u002FHoronomos-laps\u002FYana-AI\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fimplementing-network-traffic-baselining\u002FSKILL.md",[],[],{"skillNo":73,"name":74,"nameZh":6,"description":75,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":76,"sourceHtmlUrl":77,"categories":78,"keywords":79,"publishedAt":19},"01M73ASZ6NJRJM44Z2P84NGQ3Q","detecting-evasion-techniques-in-endpoint-logs","Detects defense evasion techniques used by adversaries in endpoint logs including log tampering, timestomping, process injection, and security tool disabling. Use when investigating suspicious endpoint behavior, building detection rules for evasion tactics, or conducting threat hunting for stealthy adversary activity. Activates for requests involving evasion detection, defense evasion analysis, log tampering detection, or MITRE ATT&CK TA0005.","https:\u002F\u002Fgithub.com\u002Fyanacuti1121\u002FYana-AI\u002Fblob\u002Fmain\u002Fcore\u002Fskills\u002Fdetecting-evasion-techniques-in-endpoint-logs\u002FLICENSE","https:\u002F\u002Fgithub.com\u002FHoronomos-laps\u002FYana-AI\u002Fblob\u002Fmain\u002Fcore\u002Fskills\u002Fdetecting-evasion-techniques-in-endpoint-logs\u002FSKILL.md",[],[],{"skillNo":81,"name":82,"nameZh":6,"description":83,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":84,"sourceHtmlUrl":85,"categories":86,"keywords":87,"publishedAt":19},"01M734AFNXD06Z78QRK0VKGT7Q","implementing-microsegmentation-with-guardicore","Implementing microsegmentation using Akamai Guardicore Segmentation to map application dependencies, create granular network policies, visualize east-west traffic flows, and enforce least-privilege communication between workloads across data centers and cloud.","https:\u002F\u002Fgithub.com\u002Fyanacuti1121\u002FYana-AI\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fimplementing-microsegmentation-with-guardicore\u002FLICENSE","https:\u002F\u002Fgithub.com\u002FHoronomos-laps\u002FYana-AI\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fimplementing-microsegmentation-with-guardicore\u002FSKILL.md",[],[],{"skillNo":89,"name":90,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":91,"categories":92,"keywords":93,"publishedAt":19},"01M736TK27QMCXK0DVCH25SJN5","ramdisk-tmpfs-patterns","https:\u002F\u002Fgithub.com\u002FHoronomos-laps\u002FYana-AI\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Framdisk-tmpfs-patterns\u002FSKILL.md",[],[]]