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

[fortify] Extract inline script block in com/fortify/plugin/jenkins/ChartAction/floatingBox.jelly

XMLWordPrintable

    • Icon: Task Task
    • Resolution: Unresolved
    • Icon: Minor Minor
    • fortify-plugin

      Problem

      == Inline Script Block
      Line: 22
      ----
      <script defer="true">
              var stamp = new Date().getTime();
              function checkGraphUpdate() {
                  fetch("${action.urlName}/checkUpdates", {
                      method: 'POST',
                      headers: crumb.wrap({
                          'Content-Type': 'application/x-www-form-urlencoded'
                      }),
                      body: new URLSearchParams({
                          stamp: stamp,
                      })
                  }).then(function(rsp) {
                      if (rsp.ok) {
                          var update = rsp.headers.get('go');
                          if(update == "go") {
                              stamp = new Date().getTime();
                              var image = document.getElementById('nvsGraph');
                              if(image.complete) {
                                  var new_image = new Image();
                                  new_image.id = "nvsGraph";
                                  new_image.src = image.src + "?v=" + stamp;
                                  // insert new image and remove old
                                  image.parentNode.insertBefore(new_image,image);
                                  image.parentNode.removeChild(image);
                              }
                          }
                          // next update in 10 sec
                          window.setTimeout(checkGraphUpdate, 10000);
                      }
                  });
              }
              window.setTimeout(checkGraphUpdate, 15000);
          </script>
      ----
      

      Solution

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

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

              Created:
              Updated: