Declarative .mdcCursor/Claude/Windsurf 规则和 n8n 工作流程IDE规则零秘密泄漏审计
GraphQL 架构安全、查询深度限制和零 N+1 规则
声明性 .mdc 和 CLAUDE.md 规则集强制执行 DataLoader 批处理、有界分页限制、查询复杂性上限和非空架构演变。
声明性代理和 IDE 规则文件
---
description: Prevent GraphQL N+1 queries, unbounded list fetches, and breaking schema removals
globs: **/*.{graphql,graphqls,gql,go,ts}
alwaysApply: false
---
# GraphQL Zero N+1 & Query Hardening Rules
- Enforce a hard server-side maximum ceiling (e.g. `maxLimit = 1000`) on every GraphQL list query regardless of client-supplied `limit` arguments.
- Eliminate per-row SQL queries inside nested field resolvers using single-roundtrip SQL joins/JSONB aggregation or request-scoped DataLoaders.
- Restrict nested query depth (`<= 8`) and reject oversized POST bodies (`> 256 KB`) at the HTTP handler layer.
- Evolve GraphQL schemas additively: mark superseded fields `@deprecated(reason: "...")` instead of deleting or narrowing field types.
- Sanitize resolver errors before returning GraphQL `errors[]` so internal SQL DSNs and stack traces are never leaked to clients.
## Verification Check
```bash
grep -rn 'SELECT ' graph/ && echo 'Move raw SQL into internal/db batch methods'
```社区设置说明和制作评论 (0)
还没有社区笔记。下面分享您的生产配置技巧。
公开的 MCP 工具和资源架构检查器
| 工具/资源标识符 | 输入参数 | 执行行为 |
|---|---|---|
| bounded_list_pagination | **/*.graphqls | Requires explicit limit ceilings and batched relation loading on all list fields. |