This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-site.git
The following commit(s) were added to refs/heads/master by this push:
new 9b7511056 SLING-12650 - Newly applied ASF-wide CSP policies break the
Sling website (#278)
9b7511056 is described below
commit 9b751105622946f1f5291eed300cc3d6f38cff6f
Author: Robert Munteanu <[email protected]>
AuthorDate: Wed May 27 14:12:23 2026 +0200
SLING-12650 - Newly applied ASF-wide CSP policies break the Sling website
(#278)
Fix CSP violations related to highlight.js by serving the assets locally.
---
src/main/jbake/assets/res/highlight.js/default.min.css | 1 +
src/main/jbake/assets/res/highlight.js/highlight.min.js | 3 +++
src/main/jbake/templates/header.tpl | 4 ++--
3 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/src/main/jbake/assets/res/highlight.js/default.min.css
b/src/main/jbake/assets/res/highlight.js/default.min.css
new file mode 100644
index 000000000..7d8be18d0
--- /dev/null
+++ b/src/main/jbake/assets/res/highlight.js/default.min.css
@@ -0,0 +1 @@
+.hljs{display:block;overflow-x:auto;padding:0.5em;background:#F0F0F0}.hljs,.hljs-subst{color:#444}.hljs-comment{color:#888888}.hljs-keyword,.hljs-attribute,.hljs-selector-tag,.hljs-meta-keyword,.hljs-doctag,.hljs-name{font-weight:bold}.hljs-type,.hljs-string,.hljs-number,.hljs-selector-id,.hljs-selector-class,.hljs-quote,.hljs-template-tag,.hljs-deletion{color:#880000}.hljs-title,.hljs-section{color:#880000;font-weight:bold}.hljs-regexp,.hljs-symbol,.hljs-variable,.hljs-template-variable
[...]
\ No newline at end of file
diff --git a/src/main/jbake/assets/res/highlight.js/highlight.min.js
b/src/main/jbake/assets/res/highlight.js/highlight.min.js
new file mode 100644
index 000000000..f30a334c9
--- /dev/null
+++ b/src/main/jbake/assets/res/highlight.js/highlight.min.js
@@ -0,0 +1,3 @@
+/*! highlight.js v9.12.0 | BSD3 License | git.io/hljslicense */
+!function(e){var t="object"==typeof window&&window||"object"==typeof
self&&self;"undefined"!=typeof
exports?e(exports):t&&(t.hljs=e({}),"function"==typeof
define&&define.amd&&define([],function(){return t.hljs}))}(function(e){function
t(e){return
e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function
r(e){return e.nodeName.toLowerCase()}function a(e,t){var r=e&&e.exec(t);return
r&&0===r.index}function n(e){return E.test(e)}function i(e){var
t,r,a,i,s=e.className+" ";i [...]
+var
t="[a-zA-Z_]\\w*[!?=]?|[-+~]\\@|<<|>>|=~|===?|<=>|[<>]=?|\\*\\*|[-/+%^&*~`|]|\\[\\]=?",r={keyword:"and
then defined module in return redo if BEGIN retry end for self when next until
do begin unless END rescue else break undef not super class case require yield
alias while ensure elsif or include attr_reader attr_writer
attr_accessor",literal:"true false
nil"},a={cN:"doctag",b:"@[A-Za-z]+"},n={b:"#<",e:">"},i=[e.C("#","$",{c:[a]}),e.C("^\\=begin","^\\=end",{c:[a],r:10}),e.C("^__END__"
[...]
\ No newline at end of file
diff --git a/src/main/jbake/templates/header.tpl
b/src/main/jbake/templates/header.tpl
index 374e2a37b..9177d3317 100644
--- a/src/main/jbake/templates/header.tpl
+++ b/src/main/jbake/templates/header.tpl
@@ -11,8 +11,8 @@ head {
yieldUnescaped "<script
src='https://www.apachecon.com/event-images/snippet.js'></script>"
// highlightjs.org
- link(rel:'stylesheet',
href:'https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/styles/default.min.css')
newLine()
- yieldUnescaped "<script
src='https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/highlight.min.js'></script>"
+ link(rel:'stylesheet',
href:"${config.site_contextPath}res/highlight.js/default.min.css") newLine()
+ yieldUnescaped "<script
src='${config.site_contextPath}res/highlight.js/highlight.min.js'></script>"
script {
yield 'hljs.initHighlightingOnLoad();'
} newLine()