fix: csp preventing new documentation unable to display logo (@fehmer) (#5719)

!nuf
This commit is contained in:
Christian Fehmer 2024-08-05 10:38:06 +02:00 committed by GitHub
parent fb45f05c3f
commit 4a55db5284
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -146,6 +146,13 @@ function applyApiRoutes(app: Application): void {
recordClientVersion(clientVersion?.toString() ?? "unknown");
}
if (req.path.startsWith("/docs")) {
res.setHeader(
"Content-Security-Policy",
"default-src 'self';base-uri 'self';block-all-mixed-content;font-src 'self' https: data:;frame-ancestors 'self';img-src 'self' monkeytype.com cdn.redoc.ly data:;object-src 'none';script-src 'self' cdn.redoc.ly 'unsafe-inline'; worker-src blob: data;script-src-attr 'none';style-src 'self' https: 'unsafe-inline';upgrade-insecure-requests"
);
}
next();
}
);