Skip to content

Commit 590dc30

Browse files
author
Matthew Bryant (mandatory)
committed
Added background image and CSP
1 parent 6c9d707 commit 590dc30

File tree

4 files changed

+16
-6
lines changed

4 files changed

+16
-6
lines changed

api-server.js

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,14 @@ async function get_api_server() {
7979
/*
8080
Serve static files from compiled front-end
8181
*/
82-
app.use('/', express.static('/work/gui/dist/'));
82+
app.use('/', express.static(
83+
'/work/gui/dist/',
84+
{
85+
setHeaders: function (res, path, stat) {
86+
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'");
87+
}
88+
}
89+
));
8390

8491
app.use(async function(req, res, next) {
8592
const ENDPOINTS_NOT_REQUIRING_AUTH = [
@@ -342,14 +349,15 @@ async function get_api_server() {
342349
}
343350

344351
function set_secure_headers(req, res) {
352+
res.set("X-XSS-Protection", "mode=block");
353+
res.set("X-Content-Type-Options", "nosniff");
354+
res.set("X-Frame-Options", "deny");
355+
345356
if (req.path.startsWith(API_BASE_PATH)) {
346357
res.set("Content-Security-Policy", "default-src 'none'; script-src 'none'");
347358
res.set("Content-Type", "application/json");
359+
return
348360
}
349-
350-
res.set("x-xss-protection", "mode=block");
351-
res.set("x-content-type-options", "nosniff");
352-
res.set("x-frame-options", "deny");
353361
}
354362

355363
module.exports = {

docker-compose.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ services:
1414
build: .
1515
volumes:
1616
- ./ssl:/work/cassl
17+
- ./api-server.js:/work/api-server.js
1718
depends_on:
1819
- db
1920
- redis

gui/public/img/background.png

8.38 KB
Loading

gui/src/App.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ body {
2222
}
2323
2424
body {
25-
background-color: #f5f5f5 !important;
25+
/*background-color: #f5f5f5 !important;s*/
26+
background-image: url("../public/img/background.png");
2627
}
2728
</style>

0 commit comments

Comments
 (0)