-
Task
-
Resolution: Unresolved
-
Minor
Note
While testing this plugin, evaluate whether the third-party libraries in src/main/webapp 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: 37 ---- <script>jQuery.noConflict();</script> ---- == Inline Script Block Line: 52 ---- <script> // Following form is necessary with jQuery.noConflict() to avoid conflict with prototype.js jQuery(function ($) { <j:if test="${it.HasResult == false}"> // Redirect in case no result is selected window.location.href="${it.TablePageURL}"; </j:if> $(document).ready(function() { <j:if test="${it.IsNumeral == true}"> var chart = new Chart(document.getElementById("line_chart"), { type: 'line', data: { labels: ${it.ChartLabels}, datasets: [{ data: ${it.ChartData} }] }, options: { elements: { line: { tension: 0 } }, animation: false, legend: { display: false }, title: { display: true, text: '${it.GraphTitle}' }, scales:{ yAxes:[{ display: true, ticks: { callback: function(value, index, values) { return parseFloat(value).toFixed(2); }, autoSkip: true, maxTicksLimit: 10, min: ${it.GraphYMinimum}, max: ${it.GraphYMaximum} } }] } } }); </j:if> var table = $('#rawResults').DataTable( { scrollX: true, scrollCollapse: true, sDom: 't', ordering: false, fixedColumns: { leftColumns: 1 } } ); var left = $('#rawResults').width(); $('#rawResults').scrollLeft(left); // Sent ping to the backend to reset the clock that counts down content deletion var BchPub = <st:bind value="${it}"/> setInterval(BchPub.resetClock, 30000); // Every 30s BchPub.getBuildSelected( function(t){ var build = t.responseObject(); var nodes = table.column(build).nodes(); nodes.to$$().addClass('highlight'); document.getElementById('build_index').innerHTML = build; }); BchPub.getBuildNumber( function(t){ document.getElementById('build_number').innerHTML = t.responseObject(); document.getElementById('build_number_2').innerHTML = t.responseObject(); }); BchPub.getResultDetails( function(t){ document.getElementById('resultDetails').innerHTML = t.responseObject(); }); BchPub.getParameters( function(t){ var text = t.responseObject(); if (!!text){ document.getElementById('parameters').innerHTML = t.responseObject(); $$("#title_parameters").show(); }else{ document.getElementById('parameters').innerHTML = ""; $$("#title_parameters").hide(); } }); $$('.expand_chart').click(function(){ $$('#line_chart').slideToggle('fast'); if (document.getElementById("icon_chart").getAttribute("number") == 0) { document.getElementById("icon_chart").src = "${rootURL}/plugin/benchmark/images/sort_both.png"; document.getElementById("icon_chart").setAttribute("number", "1"); } else { document.getElementById("icon_chart").src = "${rootURL}/plugin/benchmark/images/sort_desc.png"; document.getElementById("icon_chart").setAttribute("number", "0"); } }); $$('.expand_resultDetails').click(function(){ $$('#resultDetails').slideToggle('fast'); if (document.getElementById("icon_resultDetails").getAttribute("number") == 0) { document.getElementById("icon_resultDetails").src = "${rootURL}/plugin/benchmark/images/sort_both.png"; document.getElementById("icon_resultDetails").setAttribute("number", "1"); } else { document.getElementById("icon_resultDetails").src = "${rootURL}/plugin/benchmark/images/sort_desc.png"; document.getElementById("icon_resultDetails").setAttribute("number", "0"); } }); $$('.expand_parameters').click(function(){ $$('#parameters').slideToggle('fast'); if (document.getElementById("icon_parameters").getAttribute("number") == 0) { document.getElementById("icon_parameters").src = "${rootURL}/plugin/benchmark/images/sort_both.png"; document.getElementById("icon_parameters").setAttribute("number", "1"); } else { document.getElementById("icon_parameters").src = "${rootURL}/plugin/benchmark/images/sort_desc.png"; document.getElementById("icon_parameters").setAttribute("number", "0"); } }); $$('.expand_condensedResults').click(function(){ $$('#condensedResults').slideToggle('fast'); if (document.getElementById("icon_condensedResults").getAttribute("number") == 0) { document.getElementById("icon_condensedResults").src = "${rootURL}/plugin/benchmark/images/sort_both.png"; document.getElementById("icon_condensedResults").setAttribute("number", "1"); } else { document.getElementById("icon_condensedResults").src = "${rootURL}/plugin/benchmark/images/sort_desc.png"; document.getElementById("icon_condensedResults").setAttribute("number", "0"); } }); table.on( 'click', 'td', function () { var idx = table.cell( this ).index().column; var curBuild = document.getElementById('build_index').innerHTML; if (idx != curBuild){ if (idx > 0){ var nodes = table.column(curBuild).nodes(); nodes.to$$().removeClass('highlight'); BchPub.setBuildSelected(idx) setTimeout(function(){ BchPub.getBuildNumber( function(t){ document.getElementById('build_number').innerHTML = t.responseObject(); document.getElementById('build_number_2').innerHTML = t.responseObject(); }); BchPub.getResultDetails( function(t){ document.getElementById('resultDetails').innerHTML = t.responseObject(); }); BchPub.getParameters( function(t){ var text = t.responseObject(); if (!!text){ document.getElementById('parameters').innerHTML = t.responseObject(); $$("#title_parameters").show(); }else{ document.getElementById('parameters').innerHTML = ""; $$("#title_parameters").hide(); } }); var newNodes = table.column(idx).nodes(); newNodes.to$$().addClass('highlight'); document.getElementById('build_index').innerHTML = idx; }, 500); } } } ); } ); } ); </script> ----
Solution
https://www.jenkins.io/doc/developer/security/csp/#inline-javascript-blocks