feat(api): add debug logging for security headers in response (#59070)

Co-authored-by: Shaun Hamilton <shauhami020@gmail.com>
This commit is contained in:
Sem Bauke
2025-03-10 12:57:23 -05:00
committed by GitHub
co-authored by Shaun Hamilton
parent 19501eea73
commit d071676ae7
+5 -1
View File
@@ -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'")