graphql-security
>
Works with
--- name: graphql-security description: > license: Apache-2.0 --- # GraphQL Security GraphQL APIs introduce a threat surface distinct from REST. The flexible query language enables clients to request arbitrary data shapes, which can be abused for data exfiltration, denial of service, and authorization bypass if not constrained. ## Authorization Authorization logic MUST live in the business-logic layer, not in individual resolvers. Scattering authorization checks across resolvers creates gaps as the schema grows. Any resolver that forgets a check becomes an exploitable authorization flaw. - Implement a single authorization layer beneath the GraphQL API - Resolvers should delegate to this layer for every data access decision - Apply the same authorization rules regardless of which query or mutation is used to reach the data - See [GraphQL.org authorization guidance](https://graphql.org/learn/authorization/) ## Disable Introspection GraphQL introspection exposes your full schema, including types, queries, mutations, and subscriptions. This is valuable for attackers mapping your attack surface. - Disable introspection in staging and production environments - Use the [graphql-disable-introspection](https://github.com/helfer/graphql-disable-introspection) plugin or equivalent validation rule - Keep introspection enabled only in local development ## Depth Limiting Deeply nested queries can trigger expensive recursive resolution, leading to resource exhaustion. - Set a maximum query depth (typically 7-10 levels for most applications) - Reject queries exceeding the depth limit before execution - Use [graphql-depth-limit](https://github.com/stems/graphql-depth-limit) or equivalent ## Query Cost Analysis Even within depth limits, queries can request expensive combinations of fields and connections. - Assign a cost to each field and connection based on computational expense - Set a maximum cost budget per query - Reject queries exceeding the budget before execution - Use [graphql-cost-analysis](https://github.com/pa-bru/graphql-cost-analysis) or equivalent ## Rate Limiting GraphQL's single-endpoint design concentrates all operations on one URL, making rate limiting essential. - Apply rate limits per client and per operation - Use tighter limits on sensitive mutations (login, password reset, account creation) - Use wider limits on read queries - Use [graphql-rate-limit](https://github.com/teamplanes/graphql-rate-limit) or equivalent ## Implementation Checklist - [ ] Authorization is enforced in the business-logic layer, not in resolvers - [ ] Introspection is disabled in staging and production - [ ] Query depth limit is configured and enforced - [ ] Query cost analysis is enabled with per-field costs and a maximum budget - [ ] Rate limiting is applied, with tighter limits on sensitive mutations - [ ] Error messages do not leak schema details or internal structure - [ ] Input validation is applied to all mutation arguments ## References - [GraphQL.org best practices](https://graphql.org/learn/best-practices/) - [OWASP GraphQL Security](https://owasp.org/www-chapter-vancouver/assets/presentations/2020-06_GraphQL_Security.pdf)
More API Design skills
lark-event
larksuite/cli
Lark/Feishu real-time event listening / subscribing / consuming: stream events as NDJSON via `lark-cli event consume <EventKey>` (covers IM messages/reactions/chat changes, Approval status changes, Task updates, VC meeting started/joined/ended, Minutes generated, Whiteboard updated, etc.). Use for Lark bots, real-time message processing, long-running subscribers, streaming webhook/push handlers. Supports `--max-events` / `--timeout` bounded runs and a stderr ready-marker contract — designed for AI agents running as subprocesses.
lark-contact
larksuite/cli
飞书 / Lark 通讯录:按姓名 / 邮箱解析成 open_id,或按 open_id 反查姓名 / 部门 / 邮箱 / 联系方式 / 个人状态 / 签名,以及按关键词搜索当前用户可见的机器人 / 智能体(agent)。当用户提到一个名字要下一步发消息 / 排日程,或拿到 open_id 想查具体信息时使用。不负责部门树遍历、按部门列员工、组织架构图,这类需求走原生 OpenAPI。
lark-openapi-explorer
larksuite/cli
飞书/Lark 原生 OpenAPI 探索:从官方文档库中挖掘未经 CLI 封装的原生 OpenAPI 接口。当用户的需求无法被现有 lark-* skill 或 lark-cli 已注册命令满足,需要查找并调用原生飞书 OpenAPI 时使用。

