diff --git a/api-server.js b/api-server.js index 23f7c1d..e943835 100644 --- a/api-server.js +++ b/api-server.js @@ -79,7 +79,14 @@ async function get_api_server() { /* Serve static files from compiled front-end */ - app.use('/', express.static('/work/gui/dist/')); + app.use('/', express.static( + '/work/gui/dist/', + { + setHeaders: function (res, path, stat) { + res.set("Content-Security-Policy", "default-src 'none'; script-src 'self' 'unsafe-eval'; style-src 'self' 'unsafe-inline'; img-src 'self'; font-src 'none'; connect-src 'self'"); + } + } + )); app.use(async function(req, res, next) { const ENDPOINTS_NOT_REQUIRING_AUTH = [ @@ -342,14 +349,15 @@ async function get_api_server() { } function set_secure_headers(req, res) { + res.set("X-XSS-Protection", "mode=block"); + res.set("X-Content-Type-Options", "nosniff"); + res.set("X-Frame-Options", "deny"); + if (req.path.startsWith(API_BASE_PATH)) { res.set("Content-Security-Policy", "default-src 'none'; script-src 'none'"); res.set("Content-Type", "application/json"); + return } - - res.set("x-xss-protection", "mode=block"); - res.set("x-content-type-options", "nosniff"); - res.set("x-frame-options", "deny"); } module.exports = { diff --git a/docker-compose.yaml b/docker-compose.yaml index bc3a3f8..7952cef 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -14,6 +14,7 @@ services: build: . volumes: - ./ssl:/work/cassl + - ./api-server.js:/work/api-server.js depends_on: - db - redis diff --git a/gui/public/img/background.png b/gui/public/img/background.png new file mode 100644 index 0000000..7bf501c Binary files /dev/null and b/gui/public/img/background.png differ diff --git a/gui/src/App.vue b/gui/src/App.vue index cc815f1..05b5171 100644 --- a/gui/src/App.vue +++ b/gui/src/App.vue @@ -22,6 +22,7 @@ body { } body { - background-color: #f5f5f5 !important; + /*background-color: #f5f5f5 !important;s*/ + background-image: url("../public/img/background.png"); }