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

[testabilityexplorer] Extract inline script block in WEB-INF/classes/details/classcost.jelly

      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.

      Problem

      == Inline Script Block
      Line: 23
      ----
      <script type="text/javascript">
                  var myTabs = new YAHOO.widget.TabView("statistics");
      
                  YAHOO.plugin.Dispatcher.delegate (new YAHOO.widget.Tab({
                      label: '${%Methods}',
                      content: '<table class="pane sortable" id="packages">
                          <tr>
                            <td class="pane-header">${%Method}</td>
                            <td class="pane-header">${%Overall}</td>
                            <td class="pane-header">${%Cyclomatic}</td>
                            <td class="pane-header">${%Global}</td>
                            <td class="pane-header">${%Lod}</td>
                          </tr>
                          <tbody>
                            <j:forEach var="mainMethodCost" items="${it.costStack}">
                              <tr>
                                <td class="pane">
                                  <j:choose>
                                      <j:when test="${mainMethodCost.costStack.size() > 0}">
                                          <a href="../class.${it.name}:line.${mainMethodCost.line}">${mainMethodCost.displayName}:${mainMethodCost.line}</a>
                                      </j:when>
                                      <j:otherwise>
                                        ${mainMethodCost.displayName}:${mainMethodCost.line}
                                    </j:otherwise>
                                  </j:choose>
                                </td>
                                  <j:choose>
                                    <j:when test="${mainMethodCost.overall > 100}">
                                        <td class="pane"><span style="color:red">${mainMethodCost.overall}</span></td>
                                        <td class="pane"><span style="color:red">${mainMethodCost.cyclomatic}</span></td>
                                        <td class="pane"><span style="color:red">${mainMethodCost.global}</span></td>
                                        <td class="pane"><span style="color:red">${mainMethodCost.lod}</span></td>
                                    </j:when>
                                    <j:when test="${mainMethodCost.overall > 20}">
                                        <td class="pane"><span style="color:orange">${mainMethodCost.overall}</span></td>
                                        <td class="pane"><span style="color:orange">${mainMethodCost.cyclomatic}</span></td>
                                        <td class="pane"><span style="color:orange">${mainMethodCost.global}</span></td>
                                        <td class="pane"><span style="color:orange">${mainMethodCost.lod}</span></td>
                                    </j:when>
                                    <j:otherwise>
                                        <td class="pane"><span style="color:green">${mainMethodCost.overall}</span></td>
                                        <td class="pane"><span style="color:green">${mainMethodCost.cyclomatic}</span></td>
                                        <td class="pane"><span style="color:green">${mainMethodCost.global}</span></td>
                                        <td class="pane"><span style="color:green">${mainMethodCost.lod}</span></td>
                                    </j:otherwise>
                                  </j:choose>
                              </tr>
                            </j:forEach>
                          </tbody>
                        </table>',
                      cacheData: true,
                      active: true
                  }), myTabs);
      
              </script>
      ----
      

      Solution

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

          [JENKINS-74547] [testabilityexplorer] Extract inline script block in WEB-INF/classes/details/classcost.jelly

          Basil Crow created issue -
          Basil Crow made changes -
          Assignee Original: reikje [ reikje ]
          Basil Crow made changes -
          Description Original: h4. Problems

          {noformat}
          == Inline Script Block
          Line: 23
          ----
          <script type="text/javascript">
                      var myTabs = new YAHOO.widget.TabView("statistics");

                      YAHOO.plugin.Dispatcher.delegate (new YAHOO.widget.Tab({
                          label: '${%Methods}',
                          content: '<table class="pane sortable" id="packages">
                              <tr>
                                <td class="pane-header">${%Method}</td>
                                <td class="pane-header">${%Overall}</td>
                                <td class="pane-header">${%Cyclomatic}</td>
                                <td class="pane-header">${%Global}</td>
                                <td class="pane-header">${%Lod}</td>
                              </tr>
                              <tbody>
                                <j:forEach var="mainMethodCost" items="${it.costStack}">
                                  <tr>
                                    <td class="pane">
                                      <j:choose>
                                          <j:when test="${mainMethodCost.costStack.size() > 0}">
                                              <a href="../class.${it.name}:line.${mainMethodCost.line}">${mainMethodCost.displayName}:${mainMethodCost.line}</a>
                                          </j:when>
                                          <j:otherwise>
                                            ${mainMethodCost.displayName}:${mainMethodCost.line}
                                        </j:otherwise>
                                      </j:choose>
                                    </td>
                                      <j:choose>
                                        <j:when test="${mainMethodCost.overall > 100}">
                                            <td class="pane"><span style="color:red">${mainMethodCost.overall}</span></td>
                                            <td class="pane"><span style="color:red">${mainMethodCost.cyclomatic}</span></td>
                                            <td class="pane"><span style="color:red">${mainMethodCost.global}</span></td>
                                            <td class="pane"><span style="color:red">${mainMethodCost.lod}</span></td>
                                        </j:when>
                                        <j:when test="${mainMethodCost.overall > 20}">
                                            <td class="pane"><span style="color:orange">${mainMethodCost.overall}</span></td>
                                            <td class="pane"><span style="color:orange">${mainMethodCost.cyclomatic}</span></td>
                                            <td class="pane"><span style="color:orange">${mainMethodCost.global}</span></td>
                                            <td class="pane"><span style="color:orange">${mainMethodCost.lod}</span></td>
                                        </j:when>
                                        <j:otherwise>
                                            <td class="pane"><span style="color:green">${mainMethodCost.overall}</span></td>
                                            <td class="pane"><span style="color:green">${mainMethodCost.cyclomatic}</span></td>
                                            <td class="pane"><span style="color:green">${mainMethodCost.global}</span></td>
                                            <td class="pane"><span style="color:green">${mainMethodCost.lod}</span></td>
                                        </j:otherwise>
                                      </j:choose>
                                  </tr>
                                </j:forEach>
                              </tbody>
                            </table>',
                          cacheData: true,
                          active: true
                      }), myTabs);

                  </script>
          ----

          == Inline Script Block
          Line: 23
          ----
          <script type="text/javascript">
                      var myTabs = new YAHOO.widget.TabView("statistics");

                      YAHOO.plugin.Dispatcher.delegate (new YAHOO.widget.Tab({
                          label: '${%Methods}',
                          content: '<table class="pane sortable" id="packages">
                              <tr>
                                <td class="pane-header">${%Method}</td>
                                <td class="pane-header">${%Overall}</td>
                                <td class="pane-header">${%Cyclomatic}</td>
                                <td class="pane-header">${%Global}</td>
                                <td class="pane-header">${%Lod}</td>
                              </tr>
                              <tbody>
                                <j:forEach var="mainMethodCost" items="${it.costStack}">
                                  <tr>
                                    <td class="pane">
                                      <j:choose>
                                          <j:when test="${mainMethodCost.costStack.size() > 0}">
                                              <a href="../class.${it.name}:line.${mainMethodCost.line}">${mainMethodCost.displayName}:${mainMethodCost.line}</a>
                                          </j:when>
                                          <j:otherwise>
                                            ${mainMethodCost.displayName}:${mainMethodCost.line}
                                        </j:otherwise>
                                      </j:choose>
                                    </td>
                                      <j:choose>
                                        <j:when test="${mainMethodCost.overall > 100}">
                                            <td class="pane"><span style="color:red">${mainMethodCost.overall}</span></td>
                                            <td class="pane"><span style="color:red">${mainMethodCost.cyclomatic}</span></td>
                                            <td class="pane"><span style="color:red">${mainMethodCost.global}</span></td>
                                            <td class="pane"><span style="color:red">${mainMethodCost.lod}</span></td>
                                        </j:when>
                                        <j:when test="${mainMethodCost.overall > 20}">
                                            <td class="pane"><span style="color:orange">${mainMethodCost.overall}</span></td>
                                            <td class="pane"><span style="color:orange">${mainMethodCost.cyclomatic}</span></td>
                                            <td class="pane"><span style="color:orange">${mainMethodCost.global}</span></td>
                                            <td class="pane"><span style="color:orange">${mainMethodCost.lod}</span></td>
                                        </j:when>
                                        <j:otherwise>
                                            <td class="pane"><span style="color:green">${mainMethodCost.overall}</span></td>
                                            <td class="pane"><span style="color:green">${mainMethodCost.cyclomatic}</span></td>
                                            <td class="pane"><span style="color:green">${mainMethodCost.global}</span></td>
                                            <td class="pane"><span style="color:green">${mainMethodCost.lod}</span></td>
                                        </j:otherwise>
                                      </j:choose>
                                  </tr>
                                </j:forEach>
                              </tbody>
                            </table>',
                          cacheData: true,
                          active: true
                      }), myTabs);

                  </script>
          ----
          {noformat}

          h4. Solution

          [https://www.jenkins.io/doc/developer/security/csp/#inline-javascript-blocks]
          New: h4. Problem

          {noformat}
          == Inline Script Block
          Line: 23
          ----
          <script type="text/javascript">
                      var myTabs = new YAHOO.widget.TabView("statistics");

                      YAHOO.plugin.Dispatcher.delegate (new YAHOO.widget.Tab({
                          label: '${%Methods}',
                          content: '<table class="pane sortable" id="packages">
                              <tr>
                                <td class="pane-header">${%Method}</td>
                                <td class="pane-header">${%Overall}</td>
                                <td class="pane-header">${%Cyclomatic}</td>
                                <td class="pane-header">${%Global}</td>
                                <td class="pane-header">${%Lod}</td>
                              </tr>
                              <tbody>
                                <j:forEach var="mainMethodCost" items="${it.costStack}">
                                  <tr>
                                    <td class="pane">
                                      <j:choose>
                                          <j:when test="${mainMethodCost.costStack.size() > 0}">
                                              <a href="../class.${it.name}:line.${mainMethodCost.line}">${mainMethodCost.displayName}:${mainMethodCost.line}</a>
                                          </j:when>
                                          <j:otherwise>
                                            ${mainMethodCost.displayName}:${mainMethodCost.line}
                                        </j:otherwise>
                                      </j:choose>
                                    </td>
                                      <j:choose>
                                        <j:when test="${mainMethodCost.overall > 100}">
                                            <td class="pane"><span style="color:red">${mainMethodCost.overall}</span></td>
                                            <td class="pane"><span style="color:red">${mainMethodCost.cyclomatic}</span></td>
                                            <td class="pane"><span style="color:red">${mainMethodCost.global}</span></td>
                                            <td class="pane"><span style="color:red">${mainMethodCost.lod}</span></td>
                                        </j:when>
                                        <j:when test="${mainMethodCost.overall > 20}">
                                            <td class="pane"><span style="color:orange">${mainMethodCost.overall}</span></td>
                                            <td class="pane"><span style="color:orange">${mainMethodCost.cyclomatic}</span></td>
                                            <td class="pane"><span style="color:orange">${mainMethodCost.global}</span></td>
                                            <td class="pane"><span style="color:orange">${mainMethodCost.lod}</span></td>
                                        </j:when>
                                        <j:otherwise>
                                            <td class="pane"><span style="color:green">${mainMethodCost.overall}</span></td>
                                            <td class="pane"><span style="color:green">${mainMethodCost.cyclomatic}</span></td>
                                            <td class="pane"><span style="color:green">${mainMethodCost.global}</span></td>
                                            <td class="pane"><span style="color:green">${mainMethodCost.lod}</span></td>
                                        </j:otherwise>
                                      </j:choose>
                                  </tr>
                                </j:forEach>
                              </tbody>
                            </table>',
                          cacheData: true,
                          active: true
                      }), myTabs);

                  </script>
          ----
          {noformat}

          h4. Solution

          [https://www.jenkins.io/doc/developer/security/csp/#inline-javascript-blocks]
          Summary Original: [testabilityexplorer] Extract inline script blocks in WEB-INF/classes/details/classcost.jelly New: [testabilityexplorer] Extract inline script block in WEB-INF/classes/details/classcost.jelly
          Basil Crow made changes -
          Description Original: h4. Problem

          {noformat}
          == Inline Script Block
          Line: 23
          ----
          <script type="text/javascript">
                      var myTabs = new YAHOO.widget.TabView("statistics");

                      YAHOO.plugin.Dispatcher.delegate (new YAHOO.widget.Tab({
                          label: '${%Methods}',
                          content: '<table class="pane sortable" id="packages">
                              <tr>
                                <td class="pane-header">${%Method}</td>
                                <td class="pane-header">${%Overall}</td>
                                <td class="pane-header">${%Cyclomatic}</td>
                                <td class="pane-header">${%Global}</td>
                                <td class="pane-header">${%Lod}</td>
                              </tr>
                              <tbody>
                                <j:forEach var="mainMethodCost" items="${it.costStack}">
                                  <tr>
                                    <td class="pane">
                                      <j:choose>
                                          <j:when test="${mainMethodCost.costStack.size() > 0}">
                                              <a href="../class.${it.name}:line.${mainMethodCost.line}">${mainMethodCost.displayName}:${mainMethodCost.line}</a>
                                          </j:when>
                                          <j:otherwise>
                                            ${mainMethodCost.displayName}:${mainMethodCost.line}
                                        </j:otherwise>
                                      </j:choose>
                                    </td>
                                      <j:choose>
                                        <j:when test="${mainMethodCost.overall > 100}">
                                            <td class="pane"><span style="color:red">${mainMethodCost.overall}</span></td>
                                            <td class="pane"><span style="color:red">${mainMethodCost.cyclomatic}</span></td>
                                            <td class="pane"><span style="color:red">${mainMethodCost.global}</span></td>
                                            <td class="pane"><span style="color:red">${mainMethodCost.lod}</span></td>
                                        </j:when>
                                        <j:when test="${mainMethodCost.overall > 20}">
                                            <td class="pane"><span style="color:orange">${mainMethodCost.overall}</span></td>
                                            <td class="pane"><span style="color:orange">${mainMethodCost.cyclomatic}</span></td>
                                            <td class="pane"><span style="color:orange">${mainMethodCost.global}</span></td>
                                            <td class="pane"><span style="color:orange">${mainMethodCost.lod}</span></td>
                                        </j:when>
                                        <j:otherwise>
                                            <td class="pane"><span style="color:green">${mainMethodCost.overall}</span></td>
                                            <td class="pane"><span style="color:green">${mainMethodCost.cyclomatic}</span></td>
                                            <td class="pane"><span style="color:green">${mainMethodCost.global}</span></td>
                                            <td class="pane"><span style="color:green">${mainMethodCost.lod}</span></td>
                                        </j:otherwise>
                                      </j:choose>
                                  </tr>
                                </j:forEach>
                              </tbody>
                            </table>',
                          cacheData: true,
                          active: true
                      }), myTabs);

                  </script>
          ----
          {noformat}

          h4. Solution

          [https://www.jenkins.io/doc/developer/security/csp/#inline-javascript-blocks]
          New: h1. 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.*

          h4. Problem

          {noformat}
          == Inline Script Block
          Line: 23
          ----
          <script type="text/javascript">
                      var myTabs = new YAHOO.widget.TabView("statistics");

                      YAHOO.plugin.Dispatcher.delegate (new YAHOO.widget.Tab({
                          label: '${%Methods}',
                          content: '<table class="pane sortable" id="packages">
                              <tr>
                                <td class="pane-header">${%Method}</td>
                                <td class="pane-header">${%Overall}</td>
                                <td class="pane-header">${%Cyclomatic}</td>
                                <td class="pane-header">${%Global}</td>
                                <td class="pane-header">${%Lod}</td>
                              </tr>
                              <tbody>
                                <j:forEach var="mainMethodCost" items="${it.costStack}">
                                  <tr>
                                    <td class="pane">
                                      <j:choose>
                                          <j:when test="${mainMethodCost.costStack.size() > 0}">
                                              <a href="../class.${it.name}:line.${mainMethodCost.line}">${mainMethodCost.displayName}:${mainMethodCost.line}</a>
                                          </j:when>
                                          <j:otherwise>
                                            ${mainMethodCost.displayName}:${mainMethodCost.line}
                                        </j:otherwise>
                                      </j:choose>
                                    </td>
                                      <j:choose>
                                        <j:when test="${mainMethodCost.overall > 100}">
                                            <td class="pane"><span style="color:red">${mainMethodCost.overall}</span></td>
                                            <td class="pane"><span style="color:red">${mainMethodCost.cyclomatic}</span></td>
                                            <td class="pane"><span style="color:red">${mainMethodCost.global}</span></td>
                                            <td class="pane"><span style="color:red">${mainMethodCost.lod}</span></td>
                                        </j:when>
                                        <j:when test="${mainMethodCost.overall > 20}">
                                            <td class="pane"><span style="color:orange">${mainMethodCost.overall}</span></td>
                                            <td class="pane"><span style="color:orange">${mainMethodCost.cyclomatic}</span></td>
                                            <td class="pane"><span style="color:orange">${mainMethodCost.global}</span></td>
                                            <td class="pane"><span style="color:orange">${mainMethodCost.lod}</span></td>
                                        </j:when>
                                        <j:otherwise>
                                            <td class="pane"><span style="color:green">${mainMethodCost.overall}</span></td>
                                            <td class="pane"><span style="color:green">${mainMethodCost.cyclomatic}</span></td>
                                            <td class="pane"><span style="color:green">${mainMethodCost.global}</span></td>
                                            <td class="pane"><span style="color:green">${mainMethodCost.lod}</span></td>
                                        </j:otherwise>
                                      </j:choose>
                                  </tr>
                                </j:forEach>
                              </tbody>
                            </table>',
                          cacheData: true,
                          active: true
                      }), myTabs);

                  </script>
          ----
          {noformat}

          h4. 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: