agentleFS
hereshecodeshereshecodes/secureskills/skills/api-security/SKILL.md

api-security

Skill0 starsChanged 9 months agoMITView on GitHub

Use when building REST APIs, GraphQL endpoints, or webhooks

24 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use src-hunter, database-security and 10 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • xAmirHamza77Skill

    src-hunter

    实战 SRC / 众测 / Bug bounty vulnerability挖掘工作流 skill。包含:5 phasemethodology(intake → recon → enum → hunt → report)、19 个攻击类 playbook(SQLi/XSS/RCE/SSRF/IDOR/CSRF/Path Traversal/File Upload/SSTI/XXE/Race/HTTP Smuggling/OAuth/JWT/SAML/GraphQL/Mobile/LLM/DoS)、305 个结构化 payload、263 个 WAF/EDR bypass变体、2887 份 HackerOne 真实 High/Critical 已披露案例、77,000+ WooYun 案例统计、国产 OA / 中间件指纹库、银行 / 电信行业垂直 playbook。当用户提到 "src 挖洞 / src vulnerability挖掘 / bug bounty / 众测 / hackerone / vulnerability赏金 / SRC / 任意 X vulnerability / penetration testing" 或问"如何挖某个target / 怎么测某个 API / 如何bypass WAF" 时触发。

    Also in 5 projects that use this

  • JeremyMorganSkill

    database-security

    Examines all database interactions for injection, access control, encryption, and data-exposure risks. Use when auditing database and data-layer security.

    Also in 5 projects that use this

  • xAmirHamza77Skill

    attack-chain

    Use for authorized multi-stage attack-path planning and orchestration when a task spans reconnaissance, initial access, privilege escalation, lateral movement, or impact assessment. Route single-stage tasks directly to their specialist skill.

    Also in 4 projects that use this

  • +9 more from xAmirHamza77

The file

We split this skill into the rules it gives an agent

3 rules. 0 are common, 3 are distinctive, and 0 are very specific to this project.

  • 0

    Common

    Most of the 17 edited versions we read keep these.

  • 3

    Distinctive

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Every API endpoint needs authentication, rate limiting, input validation, and proper CORS configuration.

    line 8
  2. Distinctive:

    Default to requiring auth.

    line 14
  3. Distinctive:

    Never allow all origins in production.

    line 43

“Common” is measured: kept by at least 6 in 10 of the 17 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

API Security

Every API endpoint needs authentication, rate limiting, input validation, and proper CORS configuration.

Related: authentication, input-validation, access-control, security-context

Rule 1: Authenticate Every Endpoint

Default to requiring auth. Explicitly mark public endpoints.

// WRONG — endpoint is open to anyone
app.get('/api/users', async (req, res) => {
  res.json(await getUsers());
});

// RIGHT — require authentication
app.get('/api/users', requireAuth, async (req, res) => {
  res.json(await getUsers());
});

Rule 2: Rate Limit All Endpoints

Prevent abuse and brute force attacks. Apply stricter limits to auth endpoints.

// WRONG — no rate limiting
app.post('/api/login', loginHandler);

// RIGHT — rate limited (stricter on auth routes)
app.post('/api/login', rateLimit({ windowMs: 15 * 60 * 1000, max: 5 }), loginHandler);
app.use('/api/', rateLimit({ windowMs: 15 * 60 * 1000, max: 100 }));

Rule 3: Configure CORS Restrictively

Never allow all origins in production.

// WRONG — allows any website to call your API
app.use(cors({ origin: '*' }));

// RIGHT — whitelist specific origins
app.use(cors({
  origin: ['https://yourdomain.com', 'https://app.yourdomain.com'],
  methods: ['GET', 'POST', 'PUT', 'DELETE'],
  credentials: true
}));

Rule 4: Limit Request Size

Prevent denial-of-service via large payloads.

// WRONG — no size limit (default can be very large)
app.use(express.json());

// RIGHT — explicit size limit
app.use(express.json({ limit: '1mb' }));
app.use(express.urlencoded({ limit: '1mb', extended: true }));

Rule 5: Don't Leak Error Details in Production

Internal errors reveal architecture to attackers.

// WRONG — sends stack trace to client
app.use((err, req, res, next) => {
  res.status(500).json({ error: err.message, stack: err.stack });
});

// RIGHT — generic message to client, full details to logs
app.use((err, req, res, next) => {
  logger.error(err);
  res.status(500).json({ error: 'Internal server error' });
});

Rule 6: Validate Content-Type

Reject requests with unexpected content types.

// WRONG — accepts anything
app.post('/api/data', handler);

// RIGHT — enforce expected content type
app.post('/api/data', (req, res, next) => {
  if (!req.is('application/json')) {
    return res.status(415).json({ error: 'Content-Type must be application/json' });
  }
  next();
}, handler);

Quick Reference

DoDon't
Require auth on all endpoints by defaultLeave endpoints open accidentally
Rate limit (stricter on auth routes)Allow unlimited requests
Whitelist CORS originsUse origin: '*' in production
Limit request body sizeAccept unlimited payload sizes
Return generic errors to clientsSend stack traces to clients
Validate Content-Type headersAccept any content type

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.