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

[cavisson-ns-nd-integration] Extract inline script block and event handlers in com/cavisson/jenkins/BuildActionStopThread/index.jelly

XMLWordPrintable

      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: 31
      ----
      <script>
       		function stopTest(value){
       			if(value == 1){
       			var jobid = document.getElementById("jobid").value;
       			var username = document.getElementById("username").value;
       			var url = document.getElementById("url").value;
       			if(url == ""){
       			  alert("Please enter url");
       			  return;
       			}
       			if(username == "") {
       			  alert("Please enter user name.");
       			  return;
       			}
       			if(jobid == "") {
       			  alert("Please enter job id.");
       			  return;
       			}
       			
       			
       			
       			document.getElementById('msg').style.display = "block";
       			instance.stopRunningTest(jobid,username,url, function(t) {
       				var res = t.responseObject();
       				document.getElementById('msg').style.display = "none";
       				alert(res);
      				window.history.back();
       			});
       			}else if(value == 0){
       				window.history.back();
       			}
       		}
       	</script>
      ----
      
      == Inline Event Handler
      Line: 18
      ----
      <span onclick="stopTest(1)">
      ----
      
      == Inline Event Handler
      Line: 22
      ----
      <span onclick="stopTest(0)">
      ----
      

      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: