-
Task
-
Resolution: Unresolved
-
Minor
Problems
== Inline Script Block Line: 35 ---- <script language="javascript"> /* because this entire content is sent to the browser for every build step added to the job, we risk having multiple duplicate functions variables etc... since we are the ones defining cachedServerFlows, we only execute the javascript code if cachedServerFlows is not defined. */ if (typeof cachedServerFlows === 'undefined') { var cachedServerFlows = new Array(); window['setVisible'] = function setVisible(id, visibility) { var e = document.getElementById(id); e.style.visibility = visibility ? 'visible' : 'hidden'; }; window['clearFlowParameters'] = function clearFlowParameters(buildStepId) { var argsContainer = document.getElementById('argsContainer' + buildStepId); var repeater = argsContainer.firstChild; while (repeater.firstChild.getAttribute("name") === "args") { repeater.removeChild(repeater.firstChild); } }; window['getFlowsForServer'] = function getFlowsForServer(buildStepId, force, serverId, basepath, callback) { if (cachedServerFlows[serverId + basepath] == null || force) { //display ajax delay popup var refreshButton = document.getElementById("refreshButton" + buildStepId); refreshButton.onclick = function() {}; var img = refreshButton.childNodes[0]; var src = img.src; var fileStartIndex = src.lastIndexOf('/') + 1; img.src = src.substring(0,fileStartIndex) + 'spinner.gif'; descriptorProxy.listFlowsForServer( serverId, basepath, function(response) { var flows = response.responseObject(); if (flows instanceof Array) { cachedServerFlows[serverId + basepath] = flows; callback(buildStepId, cachedServerFlows[serverId + basepath]); } else{ var errorDetails; if (typeof flows.message === 'undefined') { errorDetails = response.responseText; } else { errorDetails = flows.message; } alert("server failed to return list of flows: " + errorDetails); } //kill ajax "spinner" img.src = src.substring(0,fileStartIndex) + 'refresh.png'; refreshButton.onclick = function() { refreshServerFlows(buildStepId, true); }; } ); } else { callback(buildStepId, cachedServerFlows[serverId + basepath]); } }; window['updateFlowsSelect'] = function updateFlowsSelect(buildStepId, newValues) { var flowsSelector = document.getElementById('selectedFlow' + buildStepId); //remember the previously selected flow, so that if it still exists after refresh we can reselect it var previouslySelectedFlow = flowsSelector.options[flowsSelector.selectedIndex].value; //leave the first "empty" option while (flowsSelector.length > 1) { flowsSelector.remove(1); } var i; var previousStillExists = false; for (i=0 ; i < newValues.length ; i++) { var newValue = newValues[i]; var option = document.createElement("option"); option.value = newValue; option.text = newValue; if (newValue === previouslySelectedFlow) { previousStillExists = true; option.selected = true; } flowsSelector.add(option, null); } if (!previousStillExists) { clearFlowParameters(buildStepId); } }; window['refreshServerFlows'] = function refreshServerFlows(buildStepId, force) { var serverSelector = document.getElementById('ooServer' + buildStepId); //don't do anything in case it's the "-- select one --" initial default value if (serverSelector.selectedIndex > 0) { var selectedServer = serverSelector.options[serverSelector.selectedIndex].value; var basepath = document.getElementById('basepath' + buildStepId).value; getFlowsForServer(buildStepId, force, selectedServer, basepath, updateFlowsSelect); } }; window['setBasepathError'] = function setBasepathError(buildStepId, msg) { var basepathElement = document.getElementById("basepath" + buildStepId); var siblings = basepathElement.parentNode.parentNode.parentNode.childNodes; for (var i = 0 ; i < siblings.length ; i++) { var sibling = siblings[i]; if (sibling.tagName === "TR"){ if (sibling.className.indexOf("validation-error-area") != -1) { var newValue = (msg === "" ? "" : "<div class=error>" + msg + "</div>"); var errorContainer = sibling.childNodes[1]; errorContainer.innerHTML = newValue; break; } } } } //TODO all of this perhaps could've been done instead with hudson-behavior.js method registerRegexpValidator window['validateBasepath'] = function validateBasepath(buildStepId) { return document.getElementById("basepath" + buildStepId).value.indexOf("/Library") == 0; } window['validateBasepathAndRefreshFlows'] = function validateBasepathAndRefreshFlows(buildStepId) { if (validateBasepath(buildStepId)) { refreshServerFlows('${buildStepAjaxId}',false); setBasepathError(buildStepId, ""); } else { setBasepathError(buildStepId, "basepath must start with /Library"); } } } </script> ---- == Inline Script Block Line: 295 ---- <script type="text/javascript"> function hideshow() { var showhide=document.getElementById('text'); if(showhide.style.visibility=="hidden") { showhide.style.visibility="visible"; } else{ showhide.style.visibility="hidden"; } } </script> ---- == Inline Event Handler Line: 207 ---- <select class="setting-input" id="ooServer${buildStepAjaxId}" name="ooServer" onChange="refreshServerFlows('${buildStepAjaxId}',false)"> ---- == Inline Event Handler Line: 240 ---- <select class="setting-input " id="selectedFlow${buildStepAjaxId}" name="selectedFlow" onChange="clearFlowParameters('${buildStepAjaxId}');"> ---- == Inline Event Handler Line: 249 ---- <a id="refreshButton${buildStepAjaxId}" onClick="refreshServerFlows('${buildStepAjaxId}',true);"> ---- == Inline Event Handler Line: 258 ---- <f:textbox id="basepath${buildStepAjaxId}" default="/Library" onChange="validateBasepathAndRefreshFlows('${buildStepAjaxId}')" /> ----
Solutions
https://www.jenkins.io/doc/developer/security/csp/#inline-javascript-blocks
https://www.jenkins.io/doc/developer/security/csp/#inline-event-handlers