Skip to content

Commit d47a410

Browse files
Ihor MasechkoIhor Masechko
authored andcommitted
merge to main
2 parents c5db28a + 0f14736 commit d47a410

3 files changed

Lines changed: 62 additions & 5 deletions

File tree

‎Dockerfile‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,7 @@ FROM node:24-alpine
2020
# Create a non-root user and group
2121
RUN addgroup -S appgroup && adduser -S appuser -G appgroup
2222

23-
# Install dependencies needed for health checks
24-
RUN apk add --no-cache wget=1.25.0-r2
25-
26-
# Copy layer from build image
23+
# Copy layer wfrom build image
2724
COPY --chown=appuser:appgroup --from=build /app /app
2825

2926
# Switch to non-root user
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
const isProduction = process.env.NODE_ENV === 'production';
2+
3+
let localhostPart = '';
4+
if (!isProduction) {
5+
localhostPart = 'localhost:* ';
6+
}
7+
const connectSrcHosts = `'self' ${localhostPart}d3qlcaacmmrges.cloudfront.net px.ads.linkedin.com`;
8+
9+
/**
10+
* Extends @apostrophecms/security-headers for reCAPTCHA, GTM, GA, Hotjar,
11+
* Facebook Pixel, and LinkedIn Insight.
12+
*/
13+
module.exports = {
14+
improve: '@apostrophecms/security-headers',
15+
options: {
16+
policies: {
17+
recaptcha: {
18+
'script-src': '*.google.com *.gstatic.com',
19+
'frame-src': '*.google.com *.recaptcha.net',
20+
},
21+
inlineFonts: {
22+
'font-src': 'data:',
23+
},
24+
inlineScripts: {
25+
/* eslint-disable no-secrets/no-secrets -- CSP script hashes, not secrets */
26+
'script-src':
27+
"'sha256-oTA8qLsJHk9g+M1YNjqx2sHGYh6catTGwk9lmCk8hhs=' " +
28+
"'sha256-ZC4Ihfl+1sv3E25DQh090ITQKwffxiocyA9C1vaePKU=' " +
29+
"'sha256-Q/LPXhHka5/egcP/jMtr5hz7Sxemm+1q7K+bOgaJiMo=' " +
30+
"'sha256-3ZRDhT/4WJSTcMHjSSKp1/doi40daSfiQU6ZD395+DA=' " +
31+
"'sha256-huW3ylgdSqVTZdqsJoCPMlhbzwwaT0HRomNhtq49Beo=' " +
32+
"'sha256-zoD9yhjUIP539kmB7swNElD1S9L+cey6RvNjUnEcTU4='",
33+
/* eslint-enable no-secrets/no-secrets */
34+
},
35+
linkedin: {
36+
'script-src': 'snap.licdn.com',
37+
'connect-src': connectSrcHosts,
38+
'img-src': 'px.ads.linkedin.com',
39+
},
40+
googleAnalytics: {
41+
'connect-src': '*.google-analytics.com *.analytics.google.com',
42+
},
43+
hotjar: {
44+
'script-src': '*.hotjar.com *.hotjar.io',
45+
'connect-src':
46+
'https://*.hotjar.com https://*.hotjar.io wss://*.hotjar.com',
47+
'img-src':
48+
'https://static.hotjar.com https://script.hotjar.com ' +
49+
'https://survey-images.hotjar.com',
50+
'font-src': 'https://script.hotjar.com',
51+
'style-src': 'https://static.hotjar.com https://script.hotjar.com',
52+
},
53+
facebook: {
54+
'script-src': 'connect.facebook.net',
55+
'connect-src': 'https://www.facebook.com',
56+
'img-src': 'https://www.facebook.com',
57+
},
58+
},
59+
},
60+
};

‎website/package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"description": "Apostrophe CMS website",
55
"main": "app.js",
66
"scripts": {
7-
"start": "node scripts/generate_constants.js && node app @apostrophecms/asset:build && pm2-runtime app.js -i 2",
7+
"start": "node scripts/generate_constants.js && node app @apostrophecms/asset:build && node app.js",
88
"dev": "node scripts/generate_constants.js && nodemon",
99
"build": "node scripts/generate_constants.js && NODE_ENV=production node app.js apostrophe:generation",
1010
"serve": "NODE_ENV=production node app.js",

0 commit comments

Comments
 (0)