-
Task
-
Resolution: Unresolved
-
Minor
Note
While testing this plugin, evaluate whether the third-party libraries inĀ src/main/webapp/js are compatible with CSP in restrictive mode. The plugin may need to be upgraded from jQuery 1.x to 3.x to fully function in CSP restrictive mode.
Problems
== Inline Script Block Line: 9 ---- <script type="text/javascript">window.jQueryJenkins = jQuery.noConflict();</script> ---- == Inline Script Block Line: 34 ---- <script> jQueryJenkins(document).ready(function () { if (jQueryJenkins('#main-panel').length) { jQueryJenkins('#main-panel').attr('class','col-sm-24 col-md-24 col-lg-24 col-xlg-24'); } var buildChanges = "<j:out value="${it.buildChanges.escapedDiff}"/>"; var sidePanelTD = document.getElementById('side-panel'); if (sidePanelTD) { sidePanelTD.parentNode.removeChild(sidePanelTD); } if(buildChanges) { var diff2htmlUi = new Diff2HtmlUI({diff: buildChanges}); diff2htmlUi.draw('#${it.config.format().getFormat()}', { inputFormat: 'json', outputFormat: '${it.config.format().getFormat()}', showFiles: ${it.config.showFiles()}, synchronisedScroll: ${it.config.synchronisedScroll()}, matchWordsThreshold: '${it.config.matchWordsThreshold()}', matchingMaxComparisons: '${it.config.matchingMaxComparisons()}', matching: '${it.config.matching().getMatching()}' } ); diff2htmlUi.fileListCloseable('#${it.config.format().getFormat()}', false); diff2htmlUi.highlightCode('#${it.config.format().getFormat()}'); } else { jQueryJenkins('#line-by-line').append('<p style="margin-top:150px;text-align:center;font-size:14px;">No changes between revision <span style="font-weight:600;text-decoration:underline">${it.buildChanges.currentRevision.commitId}</span> and <span style="font-weight:600;text-decoration:underline">${it.buildChanges.previousRevision.commitId}</span> </p>') jQueryJenkins('#changes-info, .d2h-show2').hide(); } }); //end documentReady function showCommits() { jQueryJenkins('.d2h-show2').hide(); jQueryJenkins('.d2h-hide2, #commits').show(); } function hideCommits() { jQueryJenkins('.d2h-show2').show(); jQueryJenkins('.d2h-hide2, #commits').hide(); } </script> ---- == Inline Event Handler Line: 118 ---- <a class="d2h-file-switch d2h-hide2" style="display: none;" onclick="hideCommits()"> ---- == Inline Event Handler Line: 119 ---- <a class="d2h-file-switch d2h-show2" style="display: inline;" onclick="showCommits()"> ----
Solutions
https://www.jenkins.io/doc/developer/security/csp/#inline-javascript-blocks
https://www.jenkins.io/doc/developer/security/csp/#inline-event-handlers