Skip to content

Commit 65b5bce

Browse files
Merge pull request #2713 from BigGillyStyle/patch-1
Update helmet.md to work with Apollo v4 and Apollo Sandbox
2 parents 6ceac55 + 21fd0b2 commit 65b5bce

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

content/security/helmet.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,21 @@ import helmet from 'helmet';
2020
app.use(helmet());
2121
```
2222

23+
> warning **Warning** When using `helmet`, `@apollo/server` (4.x), and the [Apollo Sandbox](https://docs.nestjs.com/graphql/quick-start#apollo-sandbox), there may be a problem with [CSP](https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP) on the Apollo Sandbox. To solve this issue configure the CSP as shown below:
24+
>
25+
> ```typescript
26+
> app.use(helmet({
27+
> crossOriginEmbedderPolicy: false,
28+
> contentSecurityPolicy: {
29+
> directives: {
30+
> imgSrc: [`'self'`, 'data:', 'apollo-server-landing-page.cdn.apollographql.com'],
31+
> scriptSrc: [`'self'`, `https: 'unsafe-inline'`],
32+
> manifestSrc: [`'self'`, 'apollo-server-landing-page.cdn.apollographql.com'],
33+
> frameSrc: [`'self'`, 'sandbox.embed.apollographql.com'],
34+
> },
35+
> },
36+
> }));
37+
2338
#### Use with Fastify
2439
2540
If you are using the `FastifyAdapter`, install the [@fastify/helmet](https://github.com/fastify/fastify-helmet) package:

0 commit comments

Comments
 (0)