Skip to content

Commit

Permalink
feat: CSRF plugin (#1006)
Browse files Browse the repository at this point in the history
This Pull request does a couple of things:

- Add a CSRF protection plugin, that is now enabled by default.
- Changes the default CORS `allow_headers` behavior from allow only `Content-Type`, `apollographql-client-name` and `apollographql-client-version` to mirror the received `access-control-request-headers`

Co-authored-by: Simon Sapin <[email protected]>
  • Loading branch information
o0Ignition0o and SimonSapin authored May 13, 2022
1 parent cc55e5b commit 253e2f0
Show file tree
Hide file tree
Showing 12 changed files with 552 additions and 76 deletions.
29 changes: 6 additions & 23 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 18 additions & 0 deletions NEXT_CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,26 @@ telemetry:
endpoint: default
```
### CSRF Protection is enabled by default [PR #1006](https://github.com/apollographql/router/pull/1006)
A [Cross-Site Request Forgery protection plugin](https://developer.mozilla.org/en-US/docs/Glossary/CSRF) is enabled by default.
This means [simple requests](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS#simple_requests) will be rejected from now on (they represent a security risk).
The plugin can be customized as explained in the [CORS and CSRF example](https://github.com/apollographql/router/tree/main/examples/cors-and-csrf/custom-headers.router.yaml)
### CORS default behavior update [PR #1006](https://github.com/apollographql/router/pull/1006)
The CORS allow_headers default behavior changes from:
- allow only `Content-Type`, `apollographql-client-name` and `apollographql-client-version`
to:
- mirror the received `access-control-request-headers`

This change loosens the CORS related headers restrictions, so it shouldn't have any impact on your setup.

## 🚀 Features ( :rocket: )

### CSRF Protection [PR #1006](https://github.com/apollographql/router/pull/1006)
The router now embeds a CSRF protection plugin, which is enabled by default. Have a look at the [CORS and CSRF example](https://github.com/apollographql/router/tree/main/examples/cors-and-csrf/custom-headers.router.yaml) to learn how to customize it. [Documentation](https://www.apollographql.com/docs/router/configuration/cors/) will be updated soon!

### helm chart now supports prometheus metrics [PR #1005](https://github.com/apollographql/router/pull/1005)
The router has supported exporting prometheus metrics for a while. This change updates our helm chart to enable router deployment prometheus metrics.

Expand Down
1 change: 1 addition & 0 deletions apollo-router-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ tracing = "0.1.34"
tracing-opentelemetry = "0.17.2"
typed-builder = "0.10.0"
urlencoding = "2.1.0"
mime = "0.3.16"

[dev-dependencies]
insta = "1.12.0"
Expand Down
Loading

0 comments on commit 253e2f0

Please sign in to comment.