Repository navigation
Remove inline scripts and styles to enable strict CSP - #9596
Conversation
Move keyframe animations from inline <style> in index.html into animation.less so they are compiled into main.css at build time. Replace the inline <script> that injected window.elmFlags with <meta> tags rendered server-side, and update elm-setup.js to read those values via document.querySelector. This eliminates 'unsafe-inline' from script-src, allowing a clean default-src 'self' CSP policy. Signed-off-by: Kump3r <[email protected]>
Signed-off-by: Kump3r <[email protected]>
|
After demo: Screen.Recording.2026-06-11.at.15.01.25.movImportant: The error visible in the beginning during login, I addressed in the last commit, now there are no more JS errors and we can safely use: "frame-ancestors 'none'; default-src 'self'" to block scripts, images, fonts that we do not expect. |
|
Also tested the auth flow trough the CF connector in our environments and it works normally without any issue. There are no scripts there, just thought it is worth mentioning 😅 |
Signed-off-by: Taylor Silva <[email protected]>
|
I went ahead and embedded the UnifrakturCook font within Concourse. I prefer having Concourse include everything that it needs to run the web UI. |
ceco556
left a comment
There was a problem hiding this comment.
Tested locally and it is working as expected. The only thing i didn't test is the CF connector, but i see that Kalin already tested it.
Great job!
Move keyframe animations from inline <style> in index.html into animation.less so they are compiled into main.css at build time.
Replace the inline <script> that injected window.elmFlags with tags rendered server-side, and update elm-setup.js to read those values via document.querySelector. This eliminates 'unsafe-inline' from script-src, allowing a clean default-src 'self' CSP policy.
Changes proposed by this PR
I can compile and add screenshots later, but there should be no functional changes, the idea is to allow Concourse to use CSP:
"frame-ancestors 'none'; default-src 'self'"as strict security hardening, removing only the background_image and custom fonts section, but allowing concourse to continue to run normallyNotes to reviewer
Steps to reproduce, add
to
docker-compose.ymlwebsection.Before:
After:

The font is blocked as expected, with this strict policy, also pipeline images would be blocked.