Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 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
6 changes: 6 additions & 0 deletions server/routes/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -339,4 +339,10 @@ router.get(
router.post('/reminders/cancel', cancelReminderHandler);
router.post('/reminders/reactivate', reactivateReminderHandler);

router.post('/csp-audit-report-endpoint', (req, res) => {
const parsedBody = JSON.parse(req.body.toString());
log.warn(JSON.stringify(parsedBody));
res.status(204).end();
});

export { router };
10 changes: 10 additions & 0 deletions server/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,16 @@ if (conf.DOMAIN === 'thegulocal.com') {

server.use(helmet());

server.use(function (_: Request, res: Response, next: NextFunction) {
res.set({
'Report-To':
'{ "group": "csp-endpoint", "endpoints": [ { "url": "/api/csp-audit-report-endpoint" } ] }',
'Content-Security-Policy-Report-Only':
'report-uri /api/csp-audit-report-endpoint; report-to csp-endpoint; default-src https:',
});
next();
});

const serveStaticAssets: RequestHandler = express.static(__dirname + '/static');

/** static asses are cached by fastly */
Expand Down
1 change: 1 addition & 0 deletions shared/requiresSignin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const publicPaths = [
'/api/reminders/cancel/',
'/api/public/reminders/',
'/api/help-centre/',
'/api/csp-audit-report-endpoint/',
'/cancel-reminders/',
'/create-reminder/',
'/help-centre/',
Expand Down