api-security
Skill2 starsChanged 3 months agoMITView on GitHub
Use when hardening APIs: HTTPS, HMAC 签名, timestamp+nonce 防重放, CORS, 脱敏, JWT none 算法, 密钥不进 URL. For SQL injection and resource 越权 WHERE, use backend-safe-check.
24 other projects use a version of this.
Adopted by
Most recently taken up by
- z91772524-ai/pojia-next-mactheir own version, first seen Sep 28, 2026
- jim60105/copilot-prompttheir own version, first seen Sep 28, 2026
- zhaoxuya520/reverse-skilltheir own version, first seen Sep 22, 2026
- awarexone/AXguardtheir own version, first seen Sep 15, 2026
- conjure-3301/skillstheir own version, first seen Aug 17, 2026
- blamejs/exceptd-skillstheir own version, first seen Aug 16, 2026
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.
xAmirHamza77Skillsrc-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
JeremyMorganSkilldatabase-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
xAmirHamza77Skillattack-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
Other versions24 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 24
- zhaoxuya520/reverse-skill★ 40ksame name
- transilienceai/communitytools★ 555same name
- hardw00t/ai-security-arsenal★ 104same name
- UnitOneAI/SecuritySkills★ 78same name
- jefflester/claude-skills-supercharged★ 42same name
- ShieldNet-360/secure-vibe★ 22same name
- ShulkwiSEC/bb-huge★ 22same name
- jim60105/copilot-prompt★ 21same name
- GoldenWing-360/claude-security-skills★ 19same name
- awarexone/AXguard★ 18same name
14 more not listed
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository50 other files it gives its agents.
- api-contractSkill
- cache-trapSkill
- cartSkill
- concurrency-sellSkill
- consistent-hashSkill
- delay-jobSkill
- distributed-idSkill
- distributed-lockSkill
- distributed-sessionSkill
- distributed-transactionSkill
- file-ossSkill
- file-uploadSkill
- finance-ledgerSkill
- finance-settlementSkill
- finance-statsSkill
- ha-drSkill
- hot-accountSkill
- idempotentSkill
- inventory-occupySkill
- jvm-prodSkill
- mq-reliabilitySkill
- multi-liveSkill
- mysql-indexSkill
- mysql-mvccSkill
- mysql-replicationSkill
- observabilitySkill
- optimistic-lockSkill
- order-stateSkill
- pay-duplicateSkill
- pay-notifySkill
- pay-querySkill
- pay-refund-channelSkill
- pay-split-accountSkill
- pay-tradeSkill
- perf-apiSkill
- product-detailSkill
- promo-couponSkill
- rate-limitSkill
- reconciliationSkill
- redis-opsSkill
- refund-aftersaleSkill
- rpc-remoteSkill
- safe-checkSkill
- schedule-jobSkill
- seckillSkill
- shardingSkill
- java-backend-guardrailsSkill
- split-orderSkill
- table-designSkill
- thread-poolSkill
The file
Files
接口安全
When to Invoke
开放平台、App 签名、防抓包重放、敏感字段、CORS、面试「怎么防重放」「水平越权」「HMAC 和 SHA256 区别」。
When NOT
SQL ${}、订单必须带 user_id → safe-check(本文件点过去,不写归属 SQL)。限流数值 → rate-limit。支付回调验签细节 → pay-notify。登录态存储 → distributed-session。上传类型/路径/SSRF → file-upload。
风险(面试考点)
认证 ≠ 授权。登录了仍能改别人 orderId(水平越权 / IDOR);普通用户打管理接口(垂直越权)。签名过了 ≠ 有权碰这张单。
签名防 篡改+身份;timestamp+nonce 防 重放。只有签名、窗口内同一包可打无数次。只有 timestamp 一秒内可重放。nonce 必须不可预测,秒级时间戳当 nonce 不够。
HMAC-SHA256(带密钥)≠ 裸 SHA256/MD5。 哈希只能校验内容没被改,任何人都能重算;HMAC 证明持有 secret。HMAC 不是加密,报文明文仍要 HTTPS。
Secret 不进 URL、不进日志、不进前端包、不进 Git。GET query 会被浏览器/CDN/access log 全文记下。
JWT:禁止信任客户端 alg。alg=none 可去签;alg 从 RS256 改成 HS256 会用公钥当 HMAC 密钥(CVE-2015-9235)。服务端 写死允许算法。JWT 签的是 token,不签这次 HTTP body——改订单金额要靠业务授权或 HMAC,不能只验 Bearer。
HTTPS 强制。Cookie HttpOnly+SameSite。Cookie 会话还要防 CSRF;CORS 不要 * 加凭证。日志脱敏:手机、证件、卡号、token。密码不可逆哈希+盐,不是可逆 AES 存密码。
IP 白名单、设备指纹是加分项,不能替代签名和授权。
方案选型(轻量优先)
| 场景 | 默认 |
| C 端登录接口 | HTTPS + JWT/Session;写操作要登录 |
| 开放/服务间 | HMAC-SHA256 + timestamp + nonce |
| 资金写 | 签名防重放 还要 业务幂等(idempotent) |
| 浏览器跨域 | 白名单 Origin,不 *+cookie |
防重放:
|now - timestamp| <= 60s~5min // 对时;过宽等于没防
Redis SETNX nonce TTL=窗口*2
canonical = METHOD\nPATH\nsortedQuery\nbodyHash\ntimestamp\nnonce
sign = HMAC_SHA256(secret, canonical) // 双方拼串必须完全一致比较签名用常量时间(MessageDigest.isEqual),防时序侧信道。密钥按 kid 轮换,旧密钥宽限期后再下线。
越权:查改删都 WHERE id=? AND user_id=?(或商户),见 safe-check。不能只信 body 里的 userId。
默认方案
网关:TLS、鉴权、限流、CORS。服务内:资源级 WHERE。开放 API:签名过滤器。
if (Math.abs(now - ts) > 300_000) reject();
if (!Boolean.TRUE.equals(redis.opsForValue()
.setIfAbsent("nonce:" + nonce, "1", Duration.ofMinutes(10)))) reject();
if (!MessageDigest.isEqual(hmac, expected)) reject();
// 再鉴权:这个身份能不能碰这个 orderId反例
错误:签名过了就当授权过了。 正确:签名只证明没被改;仍要验这个用户能不能碰这张单。
错误:nonce 用时间戳;或只校验 ±5 分钟不存 nonce。 正确:随机 16+ 字节 + SETNX。
错误:GET 把 token、secret 放 query;日志打印完整 Authorization。 正确:头或 body;日志打码。
错误:CORS Access-Control-Allow-Origin: * 且允许 cookie。
正确:精确 Origin。
错误:JWT 按 header 里的 alg 选验证器。
正确:服务端允许列表,拒绝 none。
验证
- 改 body 不改 sign → 拒。
- 合法包重放第二次 → 拒。
- 用户 A token + 用户 B orderId → 403。
- 日志无完整手机号/token。
alg=none/ 改 HS256 的 JWT → 拒。
评审清单
- 写接口有认证;开放接口 HMAC+时间窗+nonce
- 资源级授权(配合 safe-check)
- JWT 算法写死;密钥与敏感日志不泄露
- CORS 白名单;HTTPS
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
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.

