Skip to content

Commit

Permalink
Merge pull request #174 from data-intuitive/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
Grifs authored Jan 5, 2023
2 parents f4c445f + 4d3ebfc commit bba5671
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 2 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# CHANGELOG

## Version 5.4.3

### Other

- Set the contentSecurityPolicy option in helmet to improve cross-site scripting security

### Deployment changes

- `serverConfiguration.js` should contain valid information matching the deployment infrastructure

## Version 5.4.2

## Minor changes
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "LuciusWeb",
"version": "5.4.2",
"version": "5.4.3",
"description": "Web interface for ComPass aka Lucius",
"repository": {
"type": "git",
Expand Down
5 changes: 4 additions & 1 deletion server.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Own module to contain deployment-specific server.js information
const serverConfiguration = require("./serverConfiguration.js");

const path = require("path");
const express = require("express");
const helmet = require("helmet");
Expand All @@ -10,7 +13,7 @@ const app = express();
app.use(express.static(DIST_DIR));

// Tweak rules so that it allows off-site logo & sourire images
// app.use(helmet.contentSecurityPolicy());
app.use(helmet.contentSecurityPolicy( serverConfiguration.contentSecurityPolicy ));
// app.use(helmet.crossOriginEmbedderPolicy());
// app.use(helmet.crossOriginOpenerPolicy());
app.use(helmet.crossOriginResourcePolicy({ policy: "cross-origin" }));
Expand Down
22 changes: 22 additions & 0 deletions serverConfiguration.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
"use strict"

const serverConfiguration = {

// Sets the content Security Policy in helmet
// Basically, define which sources are allowed to come from which locations
// This is a default value that works with a local host, Spark Jobserver and a Sourire instance
contentSecurityPolicy: {
directives: {
defaultSrc: ["'self'"],
scriptSrc: ["'self'", "'unsafe-inline'", "'unsafe-eval'"],
connectSrc: ["localhost:3080", "localhost:8090"],
styleSrc: ["'self'", "'unsafe-inline'", "fonts.googleapis.com"],
imgSrc: ["'self'", "localhost:9999", "www.data-intuitive.com"],
}
}
}

exports = serverConfiguration
module.exports = serverConfiguration

exports["default"] = serverConfiguration

0 comments on commit bba5671

Please sign in to comment.