graphql-security

仓库创建 2026年7月1日最近提交 23 天前SkillHot 收录 22 天前
▸ 精选理由

针对 GraphQL 典型滥用场景,给出成本与深度防护策略。

这个 Skill 做什么

保护 GraphQL API:限制查询深度/复杂度、禁用生产 introspection 与字段级授权。

帮你把对外的 GraphQL 接口护起来:在服务端限制查询深度和复杂度,关掉生产环境的 introspection,防止通过批量/别名滥用把数据库打挂。适合对外或给 agent 提供接口时用,还能做字段级授权和 persisted queries,既防止资源耗尽又减少被侦查的风险。

▸ 展开 SKILL.md 英文原文

Defend GraphQL APIs: depth/complexity limits, introspection in production, batching/aliasing abuse, field-level authorization, persisted queries

开发编程GraphQL查询复杂度字段授权通用
2
Stars
0
Forks
40
仓库内 Skill
+0
7 日增星
安装 / 使用
给你的 Agent 一句话(通用)
帮我安装这个 skill:https://raw.githubusercontent.com/ShieldNet-360/secure-vibe/main/skills/graphql-security/SKILL.md
或 curl 直取 SKILL.md
curl -fsSL "https://raw.githubusercontent.com/ShieldNet-360/secure-vibe/main/skills/graphql-security/SKILL.md"
SKILL.MD 节选查看完整文件 ↗
# GraphQL Security

## Rules (for AI agents)

### ALWAYS
- Enforce a maximum **query depth** (typical: 7–10) and **query
  complexity** (cost) at the server. A 5-level nested query against a
  many-to-many relationship can return billions of nodes; without a
  cost limit, one client crashes the database.
- Disable **introspection** in production. Introspection makes
  reconnaissance trivial; legitimate clients have the schema baked in
  via codegen or a `.graphql` artifact.
- Use **persisted queries** (allowlisted operation hashes) for any
  high-traffic / public API. Anonymous arbitrary GraphQL is the GraphQL
  equivalent of `eval(req.body)`.
- Apply **field-level authorization** in resolve
via SKILL·HOT · 数据来自 GitHub 公开信息 · 原文版权归作者所有