fix(mindspace): guard published pages against blocked CDN scripts

Pre-bundle Chart.js, auto-rewrite common CDN references at publish and serve time, and block unknown external script src during publication scans so interactive dashboards keep working under CSP.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
john
2026-07-10 10:27:42 +08:00
parent eea14c1855
commit aede1e6fcb
12 changed files with 392 additions and 5 deletions
+9
View File
@@ -92,6 +92,15 @@ const HTML_RULES = [
mask: () => '<script>…</script>',
replacement: () => '',
},
{
type: 'html_external_script',
label: '外部 CDN 脚本',
riskLevel: 'high',
blocking: true,
pattern: /<script\b[^>]*\bsrc\s*=\s*(['"])((?:https?:)?\/\/[^'"]+)\1/gi,
mask: (_value, _quote, src) => String(src).slice(0, 72),
replacement: () => '',
},
{
type: 'html_inline_handler',
label: '内联事件',