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

[inedo-buildmaster] Extract inline script block and event handler in WEB-INF/classes/com/inedo/buildmaster/jenkins/BuildMasterReleaseParameterDefinition/index.jelly

XMLWordPrintable

      Problems

      == Inline Script Block
      Line: 68
      ----
      <script type="text/javascript">
              var jenkinsProxy = <st:bind value="${it}"/>;
      
      	    function refreshReleases(el) {
      	        var applicationId = el.value;
      
                  console.log('Calling getReleases for applicationId %s...', applicationId);
      
                  this.jenkinsProxy.getReleases(applicationId, function (t) {
                      var releases = t.responseText;
                      var releaseEl = el.parentElement.querySelector("select[name='releaseNumber']");
      
                      console.log('returned %s', releases);
                      var data = JSON.parse(releases);
      
                      while (releaseEl.options.length > 0) {
                          releaseEl.remove(releaseEl.options.length - 1);
                      }
      
                      for (i = 0; i &lt; data.length; i++)
                      {
                          var opt = document.createElement('option');
      
                          opt.text = data[i];
                          opt.value = data[i];
      
                          releaseEl.add(opt, null);
                      }
                  });
              }
      	</script>
      ----
      
      == Inline Event Handler
      Line: 41
      ----
      <select name="applicationId" onchange="refreshReleases(this);">
      ----
      

      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: