Skip to content

Commit da2056a

Browse files
danny-avilatimmanik
authored andcommitted
🛡️ fix: Temporarily Remove CSP until Configurable (danny-avila#7419)
1 parent 6a35c5b commit da2056a

File tree

1 file changed

+1
-40
lines changed

1 file changed

+1
-40
lines changed

api/server/index.js

Lines changed: 1 addition & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ require('dotenv').config();
22
const path = require('path');
33
require('module-alias')({ base: path.resolve(__dirname, '..') });
44
const cors = require('cors');
5-
const helmet = require('helmet');
65
const axios = require('axios');
76
const express = require('express');
87
const compression = require('compression');
@@ -23,15 +22,7 @@ const staticCache = require('./utils/staticCache');
2322
const noIndex = require('./middleware/noIndex');
2423
const routes = require('./routes');
2524

26-
const {
27-
PORT,
28-
HOST,
29-
ALLOW_SOCIAL_LOGIN,
30-
DISABLE_COMPRESSION,
31-
TRUST_PROXY,
32-
SANDPACK_BUNDLER_URL,
33-
SANDPACK_STATIC_BUNDLER_URL,
34-
} = process.env ?? {};
25+
const { PORT, HOST, ALLOW_SOCIAL_LOGIN, DISABLE_COMPRESSION, TRUST_PROXY } = process.env ?? {};
3526

3627
const port = Number(PORT) || 3080;
3728
const host = HOST || 'localhost';
@@ -64,36 +55,6 @@ const startServer = async () => {
6455
app.use(mongoSanitize());
6556
app.use(cors());
6657
app.use(cookieParser());
67-
app.use(
68-
helmet({
69-
contentSecurityPolicy: {
70-
useDefaults: false,
71-
directives: {
72-
defaultSrc: ["'self'"],
73-
scriptSrc: ["'self'", "'unsafe-inline'", 'https://challenges.cloudflare.com'],
74-
styleSrc: ["'self'", "'unsafe-inline'"],
75-
fontSrc: ["'self'", 'data:'],
76-
objectSrc: ["'none'"],
77-
imgSrc: ["'self'", 'data:'],
78-
mediaSrc: ["'self'", 'data:', 'blob:'],
79-
connectSrc: ["'self'"],
80-
frameSrc: [
81-
"'self'",
82-
'https://challenges.cloudflare.com',
83-
'https://codesandbox.io',
84-
...(SANDPACK_BUNDLER_URL ? [SANDPACK_BUNDLER_URL] : []),
85-
...(SANDPACK_STATIC_BUNDLER_URL ? [SANDPACK_STATIC_BUNDLER_URL] : []),
86-
],
87-
frameAncestors: [
88-
"'self'",
89-
'https://codesandbox.io',
90-
...(SANDPACK_BUNDLER_URL ? [SANDPACK_BUNDLER_URL] : []),
91-
...(SANDPACK_STATIC_BUNDLER_URL ? [SANDPACK_STATIC_BUNDLER_URL] : []),
92-
],
93-
},
94-
},
95-
}),
96-
);
9758

9859
if (!isEnabled(DISABLE_COMPRESSION)) {
9960
app.use(compression());

0 commit comments

Comments
 (0)