Fix CSP errors, font preload 404, and theme-toggle.js deployment#741
Draft
Fix CSP errors, font preload 404, and theme-toggle.js deployment#741
Conversation
- Remove frame-ancestors directive from CSP meta tags (not supported in meta elements) - Add 'unsafe-eval' to script-src for d3-dsv CSV parsing compatibility - Remove stale hardcoded Inter font preload links (404 errors) - Copy theme-toggle.js to public/js/ for Vite static asset deployment - Update article and news index templates with same fixes Co-authored-by: pethers <1726836+pethers@users.noreply.github.com>
- Use PapaParse (already a project dependency) as primary CSV parser in coalition-dashboard, risk-dashboard, and shared data-loader - PapaParse is CSP-compatible (no new Function() / eval usage) - Remove unsafe-eval from CSP meta tags in all HTML files and templates - d3.csvParse kept as fallback in risk-dashboard and data-loader Co-authored-by: pethers <1726836+pethers@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix Content Security Policy directive issues
Fix CSP errors, font preload 404, and theme-toggle.js deployment
Mar 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Multiple browser console errors: CSP
frame-ancestorsignored in meta tags, hardcoded Inter font preload returning 404,theme-toggle.jsmissing from build output (MIME type error), and d3-dsvcsvParseblocked by CSP due tonew Function()requiringunsafe-eval.CSP meta tag cleanup
frame-ancestors 'none'— only valid as HTTP header, ignored in<meta>elementsFont preload removal
UcC73FwrK3iLTeHuS_fvQtMwCp50KnMa2JL7.woff2(stale URL, 404)preconnecthints are sufficienttheme-toggle.js static asset fix
public/js/theme-toggle.jsso Vite copies it todist/js/unchangedtype="module"scripts during bundling — file was silently missing from build outputCSV parsing: d3-dsv → PapaParse
d3.csvParse()with PapaParse (already a dependency) as primary parser incoalition-dashboard.ts,risk-dashboard.ts, andshared/data-loader.tsnew Function(), eliminating theunsafe-evalCSP requirement entirely💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.