Skip to content

Commit 5b0d5c0

Browse files
committed
docs: move perf section down (keep warning up top)
1 parent c40ea66 commit 5b0d5c0

File tree

1 file changed

+19
-19
lines changed

1 file changed

+19
-19
lines changed

README.md

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4,25 +4,7 @@
44

55
Adds a powerful suite of filtering capabilities to a PostGraphile schema.
66

7-
> **Warning:** Use of this plugin with the default options may make it **astoundingly trivial** for a malicious actor (or a well-intentioned application that generates complex GraphQL queries) to overwhelm your database with expensive queries. See the Performance and Security section below for details.
8-
9-
## Performance and Security
10-
11-
By default, this plugin:
12-
13-
- Exposes a large number of filter operators, including some that can perform expensive pattern matching.
14-
- Allows filtering on [computed columns](https://www.graphile.org/postgraphile/computed-columns/), which can result in expensive operations.
15-
- Allows filtering on functions that return `setof`, which can result in expensive operations.
16-
- Allows filtering on List fields (Postgres arrays), which can result in expensive operations.
17-
18-
To protect your server, you can:
19-
20-
- Use the `connectionFilterAllowedFieldTypes` and `connectionFilterAllowedOperators` options to limit the filterable fields and operators exposed through GraphQL.
21-
- Set `connectionFilterComputedColumns: false` to prevent filtering on [computed columns](https://www.graphile.org/postgraphile/computed-columns/).
22-
- Set `connectionFilterSetofFunctions: false` to prevent filtering on functions that return `setof`.
23-
- Set `connectionFilterArrays: false` to prevent filtering on List fields (Postgres arrays).
24-
25-
Also see the [Production Considerations](https://www.graphile.org/postgraphile/production) page of the official PostGraphile docs, which discusses query whitelisting.
7+
> **Warning:** Use of this plugin with the default options may make it **astoundingly trivial** for a malicious actor (or a well-intentioned application that generates complex GraphQL queries) to overwhelm your database with expensive queries. See the [Performance and Security](https://github.com/graphile-contrib/postgraphile-plugin-connection-filter#performance-and-security) section below for details.
268
279
## Usage
2810

@@ -51,6 +33,24 @@ const middleware = postgraphile(DATABASE_URL, SCHEMAS, {
5133
});
5234
```
5335

36+
## Performance and Security
37+
38+
By default, this plugin:
39+
40+
- Exposes a large number of filter operators, including some that can perform expensive pattern matching.
41+
- Allows filtering on [computed columns](https://www.graphile.org/postgraphile/computed-columns/), which can result in expensive operations.
42+
- Allows filtering on functions that return `setof`, which can result in expensive operations.
43+
- Allows filtering on List fields (Postgres arrays), which can result in expensive operations.
44+
45+
To protect your server, you can:
46+
47+
- Use the `connectionFilterAllowedFieldTypes` and `connectionFilterAllowedOperators` options to limit the filterable fields and operators exposed through GraphQL.
48+
- Set `connectionFilterComputedColumns: false` to prevent filtering on [computed columns](https://www.graphile.org/postgraphile/computed-columns/).
49+
- Set `connectionFilterSetofFunctions: false` to prevent filtering on functions that return `setof`.
50+
- Set `connectionFilterArrays: false` to prevent filtering on List fields (Postgres arrays).
51+
52+
Also see the [Production Considerations](https://www.graphile.org/postgraphile/production) page of the official PostGraphile docs, which discusses query whitelisting.
53+
5454
## Handling `null` and empty objects
5555

5656
By default, this plugin will throw an error when `null` literals or empty objects (`{}`) are included in `filter` input objects. This prevents queries with ambiguous semantics such as `filter: { field: null }` and `filter: { field: { equalTo: null } }` from returning unexpected results. For background on this decision, see https://github.com/graphile-contrib/postgraphile-plugin-connection-filter/issues/58.

0 commit comments

Comments
 (0)