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

[last-changes] Extract inline script blocks in com/github/jenkins/lastchanges/LastChangesBuildAction/commit.jelly

XMLWordPrintable

      Note

      While testing this plugin, evaluate whether the third-party libraries inĀ src/main/webapp/js 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: 9
      ----
      <script type="text/javascript">window.jQueryJenkins = jQuery.noConflict();
            </script>
      ----
      
      == Inline Script Block
      Line: 35
      ----
      <script>
               jQueryJenkins(document).ready(function () {
                  if (jQueryJenkins('#main-panel').length) {
                       jQueryJenkins('#main-panel').attr('class','col-sm-24 col-md-24 col-lg-24 col-xlg-24');
                  }
      
               var commitChanges = "<j:out value="${commit.escapedDiff}"/>";
               var sidePanelTD = document.getElementById('side-panel');
               if (sidePanelTD) {
                   sidePanelTD.parentNode.removeChild(sidePanelTD);
               }
      
               var diff2htmlUi = new Diff2HtmlUI({diff: commitChanges});
      
               diff2htmlUi.draw('#side-by-side', {
                       inputFormat: 'json',
                       outputFormat: 'side-by-side',
                       showFiles: true,
                       synchronisedScroll: true,
                       matchWordsThreshold: '0.25',
                       matchingMaxComparisons: '1500',
                       matching: 'lines'
                   }
               );
               diff2htmlUi.fileListCloseable('#side-by-side', false);
               diff2htmlUi.highlightCode('#side-by-side');
      
                   }); //end documentReady
      
            </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: