Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-74458

[selection-tasks-plugin] Extract inline script blocks and event handler in WEB-INF/classes/hpi/ScriptSelectionTaskDefinition/index.jelly

XMLWordPrintable

      Problems

      == Inline Script Block
      Line: 13
      ----
      <script language="JavaScript">
      	var myArrayTestSelection = new Array();
      	var sizeMyArray = 0;
      
          function recur() {
          	
          }
          function checkBlocking(a) {
          	var currDeep = 0;
          	for(keyVar in myArray){
          		if( myArray[keyVar] == "[" ) {
          			currDeep++;
          		}
          		if( myArray[keyVar] == "]" ) {
          			currDeep--;
          		}
          		//alert(myArray[keyVar] + " = " + currDeep);
          	}
          	//alert(currDeep);
          }
          function addNode(node) {
          	myArray[sizeMyArray] = node;
          	sizeMyArray++;
          }
          function clickChildren(name, elem, delim, parent) {
      		var children = document.getElementsByTagName('input');
      		
      		for(child in children) {
      			if (children[child].type == 'checkbox') {
      				var id = children[child].id;
      				
      				var str;
      				if (parent == "") {
      					str = name;
      				} else {
      					str = parent + delim + name;
      				}
      				
      				if (id.indexOf(str) != -1) {
                  		children[child].checked = elem.checked;
                  	}
              	}
      		}
      	}
      </script>
      ----
      
      == Inline Script Block
      Line: 74
      ----
      <script language="JavaScript">
      								addNode('[');
      							</script>
      ----
      
      == Inline Script Block
      Line: 80
      ----
      <script language="JavaScript">
      								addNode(']');
      							</script>
      ----
      
      == Inline Script Block
      Line: 92
      ----
      <script language="JavaScript">
      									addNode('${i.variableName}');
      								</script>
      ----
      
      == Inline Event Handler
      Line: 89
      ----
      <f:checkbox name="${i.variableName}" id="CB${i.parent+i.variableName}" checked="${i.check}"
      									onclick="clickChildren('${i.name}', this, '${it.getNodeDelimSymbol()}', '${i.parent}')"/>
      ----
      

      Solutions

      https://www.jenkins.io/doc/developer/security/csp/#inline-javascript-blocks
      https://www.jenkins.io/doc/developer/security/csp/#inline-event-handlers

            Unassigned Unassigned
            basil Basil Crow
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: