mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-10-24 23:49:06 +08:00
feat(api): add debug logging for security headers in response (#59070)
Co-authored-by: Shaun Hamilton <shauhami020@gmail.com>
This commit is contained in:
co-authored by
Shaun Hamilton
parent
19501eea73
commit
d071676ae7
@@ -5,7 +5,11 @@ import { FREECODECAMP_NODE_ENV } from '../utils/env';
|
||||
|
||||
const securityHeaders: FastifyPluginCallback = (fastify, _options, done) => {
|
||||
// OWASP recommended headers
|
||||
fastify.addHook('onRequest', async (_request, reply) => {
|
||||
fastify.addHook('onRequest', async (req, reply) => {
|
||||
const logger = fastify.log.child({ req });
|
||||
|
||||
logger.debug('Adding security headers to response');
|
||||
|
||||
void reply
|
||||
.header('Cache-Control', 'no-store')
|
||||
.header('Content-Security-Policy', "frame-ancestors 'none'")
|
||||
|
||||
Reference in New Issue
Block a user