Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

feat: add media-src directive to Content Security Policy for enhanced security

Victor Santos012c8d7b517c
diff --git a/backend/src/server/plugins/serve-ui.ts b/backend/src/server/plugins/serve-ui.ts
index 7a0f3934b2..2842e23852 100644
--- a/backend/src/server/plugins/serve-ui.ts
+++ b/backend/src/server/plugins/serve-ui.ts
@@ -68,7 +68,7 @@ export const registerServeUI = async (
.replace(/href="\/assets\//g, `href="${cdnHost}/assets/`);
// Inject CDN host into CSP directives that need it
- const cspDirectives = ["script-src", "style-src", "font-src", "connect-src"];
+ const cspDirectives = ["script-src", "style-src", "font-src", "connect-src", "media-src"];
for (const directive of cspDirectives) {
const regex = new RE2(`(${directive}\\s+'self')`, "g");
indexHtml = indexHtml.replace(regex, `$1 ${cdnHost}`);