// CSP for presentHtml's print-mode iframe. Ported from MulmoClaude's
// src/utils/html/previewCsp.ts so the View travels with its own policy (no host
// import). Keep the CDN allowlist audited — every entry is a supply-chain
// surface. The host's Files-explorer keeps its own copy of the broader preview
// policy; this package only needs the print path.
export const HTML_PREVIEW_CSP_ALLOWED_CDNS: readonly string[] = [
"https://cdn.jsdelivr.net",
"https://unpkg.com",
"https://cdnjs.cloudflare.com",
"https://fonts.googleapis.com",
"https://fonts.gstatic.com",
// Plotly's official CDN — the LLM defaults to this URL for Sankey / other
// Plotly charts, and historical artifacts bake it in.
"https://cdn.plot.ly",
];
function buildCsp(connectSrc: string, imgSelf: string, cdns: readonly string[]): string {
const cdnList = cdns.join(" ");
return [
"default-src 'none'",
// LLM-authored HTML almost always uses inline