'use strict'; const crypto = require('crypto'); const assert = require('assert'); const config = require('../lib/config'); const matrixServerUrl = config.get('matrixServerUrl'); assert(matrixServerUrl); function contentSecurityPolicyMiddleware(req, res, next) { const cspNonce = crypto.randomBytes(16).toString('hex'); // Based on https://web.dev/strict-csp/ const directives = [ // Default to fully-restrictive and only allow what's needed below `default-src 'none';`, // Only