Skip to content

Commit 83e6780

Browse files
committed
added sentry to csp
1 parent 101d7bb commit 83e6780

File tree

1 file changed

+11
-16
lines changed

1 file changed

+11
-16
lines changed

server.js

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { fileURLToPath } from 'node:url';
55
import path from 'node:path';
66
import dotenv from 'dotenv';
77
import proxy from './server/app.js';
8-
import envPlugin from "./server/config/env.js";
8+
import envPlugin from './server/config/env.js';
99
import { copyFileSync } from 'node:fs';
1010
import * as Sentry from '@sentry/node';
1111

@@ -27,9 +27,7 @@ const isLocalDev = process.argv.includes('--local-dev');
2727

2828
const __filename = fileURLToPath(import.meta.url);
2929
const __dirname = path.dirname(__filename);
30-
const frontendConfigLocation = isLocalDev
31-
? 'public/frontend-config.json'
32-
: 'dist/client/frontend-config.json';
30+
const frontendConfigLocation = isLocalDev ? 'public/frontend-config.json' : 'dist/client/frontend-config.json';
3331

3432
if (process.env.FRONTEND_CONFIG_PATH !== undefined && process.env.FRONTEND_CONFIG_PATH.length > 0) {
3533
console.log('FRONTEND_CONFIG_PATH is specified. Will copy the frontend-config from there.');
@@ -44,18 +42,15 @@ const fastify = Fastify({
4442
Sentry.setupFastifyErrorHandler(fastify);
4543
await fastify.register(envPlugin);
4644

47-
fastify.register(
48-
helmet,
49-
{
50-
contentSecurityPolicy: {
51-
directives: {
52-
"connect-src": ["'self'", "sdk.openui5.org"],
53-
"script-src": isLocalDev ? ["'self'", "'unsafe-inline'"] : ["'self'"],
54-
"frame-ancestors": [fastify.config.FRAME_ANCESTORS]
55-
},
56-
}
57-
}
58-
)
45+
fastify.register(helmet, {
46+
contentSecurityPolicy: {
47+
directives: {
48+
'connect-src': ["'self'", 'sdk.openui5.org', 'o1240783.ingest.us.sentry.io'],
49+
'script-src': isLocalDev ? ["'self'", "'unsafe-inline'"] : ["'self'"],
50+
'frame-ancestors': [fastify.config.FRAME_ANCESTORS],
51+
},
52+
},
53+
});
5954

6055
fastify.register(proxy, {
6156
prefix: '/api',

0 commit comments

Comments
 (0)