|
5 | 5 | Please report security vulnerabilities through [GitHub's private vulnerability reporting](https://github.com/webonyx/graphql-php/security/advisories/new). |
6 | 6 |
|
7 | 7 | Do not open public issues for security vulnerabilities. |
| 8 | + |
| 9 | +## Scope |
| 10 | + |
| 11 | +This library is a low-level GraphQL engine. |
| 12 | +It parses, validates, and executes GraphQL documents against a schema you define. |
| 13 | +The security boundary is between the library and the GraphQL document it receives — we consider bugs that allow a crafted document to crash the PHP process, exhaust resources disproportionate to document size, or bypass validation to be vulnerabilities. |
| 14 | + |
| 15 | +The following are **intentional design decisions** and are **not** considered vulnerabilities: |
| 16 | + |
| 17 | +### Introspection enabled by default |
| 18 | + |
| 19 | +Introspection is part of the [GraphQL specification](https://spec.graphql.org/October2021/#sec-Introspection). |
| 20 | +Disabling it by default would break spec compliance and tooling (GraphiQL, IDE plugins, code generators). |
| 21 | +The library provides [`DisableIntrospection`](docs/security.md#disabling-introspection) for applications that choose to restrict it. |
| 22 | + |
| 23 | +### No default query depth or complexity limits |
| 24 | + |
| 25 | +The library provides [`QueryDepth`](docs/security.md#limiting-query-depth) and [`QueryComplexity`](docs/security.md#query-complexity-analysis) validation rules, but does not enable them by default. |
| 26 | +Sensible limits depend entirely on your schema shape and use case — a generic default would either break legitimate queries or be too high to matter. |
| 27 | +Applying these limits is the responsibility of the application, just as rate limiting and authentication are. |
| 28 | + |
| 29 | +### Error messages containing user input |
| 30 | + |
| 31 | +GraphQL error messages include the invalid values that caused them (e.g. `Int cannot represent non-integer value: "foo"`). |
| 32 | +This is standard behavior matching graphql-js and the expectations of GraphQL tooling. |
| 33 | +Error messages are returned as JSON — the library does not render HTML. |
| 34 | +If your application renders error messages as raw HTML, that is an XSS vulnerability in your application, not in this library. |
| 35 | + |
| 36 | +### General hardening advice |
| 37 | + |
| 38 | +Reports that recommend enabling security features we already provide as opt-in, or that describe theoretical attack scenarios that require the application to be misconfigured, will be closed as informational. |
| 39 | +See [docs/security.md](docs/security.md) for guidance on hardening your GraphQL endpoint. |
0 commit comments