Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docs #142

Merged
merged 2 commits into from
Oct 17, 2024
Merged

Docs #142

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ _This is repository inspired by the great work of the Javascript [GraphQL Armor]

## Features

* [Trusted Documents (Persisted Operations)](docs/protections/trusted_documents)
* [Trusted Documents (Persisted Operations)](docs/protections/trusted_documents.md)
* [Block Field Suggestions](docs/protections/block_field_suggestions.md)
* [Obfuscate upstream errors](docs/protections/obfuscate_upstream_errors.md)
* [Max Aliases](docs/protections/max_aliases.md)
Expand Down
6 changes: 5 additions & 1 deletion docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,15 @@ Protect supports various running modes for different needs and purposes.
* `validate` runs as a CLI tool, validating your Persisted Operations against your schema and configured protections (see [this page](configuration.md#graphql-protect---validate-run-mode) for more info how to set this up)
* `version` outputs versioning info of protect

## HTTP configuration

* [HTTP Configuration](http.md)
*
## Protections

This section contains all the documentation about each protection feature.

* [Persisted Operations](protections/trusted_documents)
* [Persisted Operations](protections/trusted_documents.md)
* [Block Field Suggestions](protections/block_field_suggestions.md)
* [Max Aliases](protections/max_aliases.md)
* [Max Tokens](protections/max_tokens.md)
Expand Down
38 changes: 12 additions & 26 deletions docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,32 @@ The following outlines the structure of the yaml, as well as outlines the **defa

```yaml
web:
# Maximum duration to read the entire request
read_timeout: 5s
# Maximum duration before timing out writes of the response
write_timeout: 10s
# Maximum time to wait between idle requests for keep alive
idle_timeout: 120s
# Time to wait until forcibly shutting down protect, after receiving a shutdown signal
shutdown_timeout: 20s
# host and port to listen on
host: 0.0.0.0:8080
# path that receives GraphQL traffic
path: /graphql
# limit the maximum size of a request body that is allowed
# this helps prevent OOM attacks through excessively large request payloads.
# A limit of `0` disables this protection.
request_body_max_bytes: 102400

target:
# Target host and port to send traffic to after validating
host: http://localhost:8081
# Dial timeout waiting for a connection to complete with the target upstream
timeout: 10s
# Interval of keep alive probes
keep_alive: 180s
target:
tracing:
# Headers to redact when sending tracing information
redacted_headers: []

schema:
Expand Down Expand Up @@ -170,28 +180,4 @@ max_batch:
enabled: true
# The maximum number of operations within a single batched request.
max: 5
```

## HTTP Request Body Max Byte size

To prevent OOM attacks through excessively large request bodies, a default limit is posed on request body size of `100kb`. This limit is generally speaking ample space for GraphQL request bodies, while also providing solid protections.

You can modify this limit by changing the following configuration option

```yaml
web:
# limit the maximum size of a request body that is allowed
# this helps prevent OOM attacks through excessively large request payloads.
# A limit of `0` disables this protection.
request_body_max_bytes: 102400
```

### Metrics

A metric is exposed to track if and when a request is rejected that exceeds this limit.

```
graphql_protect_http_request_max_body_bytes_exceeded_count{}
```

No metrics are produced for requests that do not exceed this limit.
```
58 changes: 58 additions & 0 deletions docs/http.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# HTTP Configuration

## HTTP server configuration

```yaml
web:
# Maximum duration to read the entire request
read_timeout: 5s
# Maximum duration before timing out writes of the response
write_timeout: 10s
# Maximum time to wait between idle requests for keep alive
idle_timeout: 120s
# Time to wait until forcibly shutting down protect, after receiving a shutdown signal
shutdown_timeout: 20s
# host and port to listen on
host: 0.0.0.0:8080
# path that receives GraphQL traffic
path: /graphql
# limit the maximum size of a request body that is allowed
# this helps prevent OOM attacks through excessively large request payloads.
# A limit of `0` disables this protection.
request_body_max_bytes: 102400

target:
# Target host and port to send traffic to after validating
host: http://localhost:8081
# Dial timeout waiting for a connection to complete with the target upstream
timeout: 10s
# Interval of keep alive probes
keep_alive: 180s
tracing:
# Headers to redact when sending tracing information
redacted_headers: []
```

## HTTP Request Body Max Byte size

To prevent OOM attacks through excessively large request bodies, a default limit is posed on request body size of `100kb`. This limit is generally speaking ample space for GraphQL request bodies, while also providing solid protections.

You can modify this limit by changing the following configuration option

```yaml
web:
# limit the maximum size of a request body that is allowed
# this helps prevent OOM attacks through excessively large request payloads.
# A limit of `0` disables this protection.
request_body_max_bytes: 102400
```

### Metrics

A metric is exposed to track if and when a request is rejected that exceeds this limit.

```
graphql_protect_http_request_max_body_bytes_exceeded_count{}
```

No metrics are produced for requests that do not exceed this limit.
Loading