-
Task
-
Resolution: Unresolved
-
Minor
Problems
== Inline Script Block Line: 111 ---- <script> <j:set var="value" value="${instance.securityListNames}" /> <![CDATA[ var items = '${value}'; items = items.replace("[",""); items = items.replace("]",""); items = items.split(","); window.addEventListener("load",function(){ setTimeout(fieldcheck,3000); }); function selectSecurityList(select) { var sl = select.options[select.selectedIndex]; var option = document.createElement("option"); option.text = sl.text + " [Click to remove]"; option.value = sl.value; option.selected = true; var secList = document.getElementById("securityLists"); var secListOptions = secList.options; for (var i = 0; i < secListOptions.length; i++){ if(secListOptions[i].value == sl.value) return; } secList.appendChild(option); option.setAttribute('onclick', 'this.parentNode.removeChild(this);'); }; function selectAll() { var secList = document.getElementById("securityLists"); var secListOptions = secList.options; for (var i = 0; i < secListOptions.length; i++){ secListOptions[i].selected = true; } }; function removeAll() { var secList = document.getElementById("securityLists"); while (secList.options.length > 0) { secList.remove(0); } }; function fieldcheck() { var secList = document.getElementById("securityLists"); var select = document.getElementById("securitySelect"); var selectOptionVal = []; for (var i = 0; i < select.options.length; i++) { selectOptionVal.push(select.options[i].value); } //load security list from config file if(secList.options.length > 0) { for(var i = 0; i < secList.options.length; i++) { var index = selectOptionVal.indexOf(secList.options[i].value); if(index != 0) { secList.options[i].text = select.options[index].text + " [Click to remove]"; secList.options[i].setAttribute('onclick', 'this.parentNode.removeChild(this);'); }else{ secList.remove(i); } } }else{ for(var i = 0; i < items.length; i++) { var secListOption = document.createElement("option"); secListOption.text = ""; secListOption.value = items[i].trim(); secListOption.selected = true; secList.appendChild(secListOption); } } //verify security list base on compare list for(var i = 0; i < secList.options.length; i++) { var index = selectOptionVal.indexOf(secList.options[i].value); if(index != -1) { secList.options[i].text = select.options[index].text + " [Click to remove]"; secList.options[i].setAttribute('onclick', 'this.parentNode.removeChild(this);'); }else{ secList.remove(i); } } }; ]]> </script> ---- == Inline Event Handler Line: 48 ---- <f:select id="securitySelect" field="securityListName" onchange="selectSecurityList(this);"/> ---- == Inline Event Handler Line: 49 ---- <select id="securityLists" field="securityListNames" size="5" multiple="multiple" class="setting-input" onclick="selectAll()" name="_.securityListNames"> ---- == Inline Event Handler Line: 51 ---- <input type="button" value="Reset Selected Security List" onclick="removeAll()" /> ----
Solutions
https://www.jenkins.io/doc/developer/security/csp/#inline-javascript-blocks
https://www.jenkins.io/doc/developer/security/csp/#inline-event-handlers