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

[WEB-3294] secure CSP updates #1476

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
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
26 changes: 13 additions & 13 deletions server.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
const http = require('http');
const https = require('https');
const fs = require('fs');
const path = require('path');
const http = require('node:http');
const https = require('node:https');
const fs = require('node:fs');
const path = require('node:path');
const express = require('express');
const helmet = require('helmet');
const bodyParser = require('body-parser');
const crypto = require('crypto');
const crypto = require('node:crypto');

const config = require('./config.server.js');

Expand Down Expand Up @@ -86,7 +86,7 @@ app.use(nonceMiddleware, helmet.contentSecurityPolicy({
objectSrc: ['blob:'],
workerSrc: ["'self'", 'blob:'],
childSrc: ["'self'", 'blob:', 'https://docs.google.com', 'https://app.pendo.io'],
frameSrc: ['https://docs.google.com', 'https://app.pendo.io', '*.tidepool.org', 'localhost:*', 'tidepooluploader://*'],
frameSrc: ['https://docs.google.com', 'https://app.pendo.io', 'https://*.tidepool.org', 'localhost:*', 'tidepooluploader://*'],
connectSrc: [].concat([
process.env.API_HOST || 'localhost:*',
process.env.REALM_HOST,
Expand All @@ -97,16 +97,16 @@ app.use(nonceMiddleware, helmet.contentSecurityPolicy({
'wss://tidepoolsupport.zendesk.com',
'https://api.rollbar.com',
'wss://*.zopim.com',
'*.tidepool.org',
'*.development.tidepool.org',
'*.integration.tidepool.org',
'http://*.integration-test.tidepool.org',
'https://*.tidepool.org',
'https://*.development.tidepool.org',
'https://*.integration.tidepool.org',
'https://*.integration-test.tidepool.org',
'https://app.pendo.io',
'https://data.pendo.io',
'https://pendo-static-5707274877534208.storage.googleapis.com',
'https://*.launchdarkly.com',
]).filter(src => src !== undefined),
frameAncestors: ['https://app.pendo.io', '*.tidepool.org', 'localhost:*']
frameAncestors: ['https://app.pendo.io', 'https://*.tidepool.org', 'localhost:*']
},
reportOnly: false,
}));
Expand Down Expand Up @@ -143,14 +143,14 @@ if (!(config.httpPort || config.httpsPort)) {
if (config.httpPort) {
app.server = http.createServer(app).listen(config.httpPort, () => {
console.log('Connect server started on port', config.httpPort);
console.log('Serving static directory "' + staticDir + '/"');
console.log(`Serving static directory "${staticDir}/"`);
});
}

if (config.httpsPort) {
https.createServer(config.httpsConfig, app).listen(config.httpsPort, () => {
console.log('Connect server started on HTTPS port', config.httpsPort);
console.log('Serving static directory "' + staticDir + '/"');
console.log(`Serving static directory "${staticDir}/"`);
});
}

Expand Down