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

[carbonetes-serverless-container-scanning-and-policy-compliance] Extract inline script block in io/jenkins/plugins/carbonetes/CarbonetesAction/index.jelly

      Problem

      == Inline Script Block
      Line: 561
      ----
      <script type="text/javascript">	
              const vueIconSettings = {
        				icons: {
         				 iconfont: 'mdiSvg', // 'mdi' || 'mdiSvg' || 'md' || 'fa' || 'fa4'
       				 },
      				};
                  var app = new Vue({
                  el: '#app',
                  vuetify: new Vuetify(vueIconSettings),
                  data: function() {	
                          return  {
                              pr : {
                              scaHeaders: [
                                  { text: 'Dependency',value: 'fileName', sortable: true},
                                  { text: 'File Path', value: 'filePath' , sortable: false},
                                  { text: 'Vulnerabilities', value: 'vulnerabilities' , sortable: false},
                                  { text: 'Evidence Collected', value: 'evidenceColllected' , sortable: false},
                                  ],
                              licenseFinderHeaders: [
                                  { text: 'Dependency', sortable: true},
                                  { text: 'Version', sortable: false},
                                  { text: 'Licenses', sortable: false},
                                  { text: 'Link', sortable: false}
                              ],
                              secretsHeaders: [
                                  { text: 'File', value: 'fileName', sortable: true},
                                  { text: 'File Path',value: 'filePath', sortable: true},
                                  { text: 'Line No. ', value: 'lineNo',sortable: true},
                                  { text: 'Content Regex Match',value: 'contentRegexMatch', sortable: true},
                                  
                              ],
                              malwareHeaders:[
                                  { text: 'File Directory', value: 'fileName', sortable: true},
                                  { text: 'File Name', value: 'fileName', sortable: true},
                                  { text: 'Virus', value: 'fileName', sortable: true}
                              ],
                              bomPackageHeaders: [
                              	{ text: 'Name', value: '', sortable: true},
                              	{ text: 'Version', value: '', sortable: true},
                              	{ text: 'Type', value: '', sortable: true},
                              	{ text: 'Path', value: '', sortable: true}
                              ],
                              bomSourceHeaders: [
                                  { text: 'Media Type', value: '', sortable: true},
                                  { text: 'Digest', value: '', sortable: true},
                                  { text: 'Size', value: '', sortable: true},
                              ],
                              policyHeaders:[
                                  { text: 'Gate', value: 'gate', sortable: true},
                                  { text: 'Gate Trigger', value: 'gateTrigger', sortable: true},
                                  { text: 'Check Output', value: 'checkOutput', sortable: true},
                                  { text: 'Gate Action', value: 'gateAction', sortable: true},
                              ],	
                              dedupHeaders: [
                                  { text: 'Severity',value: 'severity', sortable: false, align : 'center'},
                                  { text: 'Vulnerability', value: 'vuln' , sortable: false},
                                  { text: 'Package Name', value: 'package_name' , sortable: false},
                                  { text: 'Package Version', value: 'package_version' , sortable: false},
                                  { text: 'Fix', value: 'fix' , sortable: false},
                                  { text: 'Feed', value: 'feed' , sortable: false},
                                  { text: 'Feed Group', value: 'feed_group' , sortable: false},
                                  { text: 'Gate Action', value: 'gate_action' , sortable: false},
                                  ],
                              tabItems : [
                                  { tab: 'Vulnerability', content: 'Tab 1 Content' },
                                  { tab: 'Software Composition', content: 'Tab 2 Content' },
                                  { tab: 'Secrets', content: 'Tab 2 Content' },
                                  { tab: 'License Finder', content: 'Tab 2 Content' },
                                  { tab: 'Malware Analysis', content: 'Tab 2 Content' },			   
                              ],
                              tab : null,	    
                              rowsPerPageOptions : { 
                                  rowsPerPageItems: [5, 10, 20]
                              }, 
                              footerProps: {
                                  disableItemsPerPage : true
                              },
                              policyBundleId: "${it.getPolicyBundleId()}",
                              bundleName: "${it.getBundleName()}",
                              vulnerabilityResult : ${it.getVulnerabilitiesResult()},
                              scaResult : ${it.getScaResult()},
                              malwareResult : ${it.getMalwareResult()},
                              bomResult     : ${it.getBillOfMaterialsResult()},
                              licenseResult : ${it.getLicenseFinderResult()},
                              secretsResult : ${it.getSecretsAnalysisResult()},
                              policyEvaluationResult : ${it.getPolicyEvaluationResult()},
                              }
                          } 				      
                      },
                      computed: {
                          pDuration:{
                              get() {
                                  return parseInt(this.pr.scaResult.analysis.duration / 60);
                              }
                          },
                          pScaResult : {
                              get() {
                                  return this.pr.scaResult
                              }
                          },
                          pLicenseFinderResult : {
                              get() {
                                  return this.pr.licenseResult
                              }
                          },
                          pSecretsResult: {
                              get(){
                                  return this.pr.secretsResult
                              }
                          },
                          pMalwareResult: {
                              get(){
                                  return this.pr.malwareResult
                              }
                          },
                          pBomResult: {
                          	get() {
                          		return this.pr.bomResult
                          	}
                          },
                          pVulnerabilityResult: {
                                  get() {
                                      return this.pr.vulnerabilityResult
                                  },
                          },
                          pVulnerability: {
                                  get() {
                                      return this.pr.vulnerability
                                  },
                          },
                          pPolicyEvaluationResult: {
                              get() {
                                  return this.pr.policyEvaluationResult
                              }
                          },
                      },
      
                      methods: {
                          bytesToSize(bytes) {
                              var sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB'];
                              if (bytes == 0) return '0 Byte';
                              var i = parseInt(Math.floor(Math.log(bytes) / Math.log(1024)));
                              return Math.round(bytes / Math.pow(1024, i), 2) + ' ' + sizes[i];
                      },
          }
                  })
              </script>
      ----
      

      Solution

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

          [JENKINS-74676] [carbonetes-serverless-container-scanning-and-policy-compliance] Extract inline script block in io/jenkins/plugins/carbonetes/CarbonetesAction/index.jelly

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

          {noformat}
          == Inline Script Block
          Line: 561
          ----
          <script type="text/javascript">
                  const vueIconSettings = {
             icons: {
              iconfont: 'mdiSvg', // 'mdi' || 'mdiSvg' || 'md' || 'fa' || 'fa4'
            },
          };
                      var app = new Vue({
                      el: '#app',
                      vuetify: new Vuetify(vueIconSettings),
                      data: function() {
                              return {
                                  pr : {
                                  scaHeaders: [
                                      { text: 'Dependency',value: 'fileName', sortable: true},
                                      { text: 'File Path', value: 'filePath' , sortable: false},
                                      { text: 'Vulnerabilities', value: 'vulnerabilities' , sortable: false},
                                      { text: 'Evidence Collected', value: 'evidenceColllected' , sortable: false},
                                      ],
                                  licenseFinderHeaders: [
                                      { text: 'Dependency', sortable: true},
                                      { text: 'Version', sortable: false},
                                      { text: 'Licenses', sortable: false},
                                      { text: 'Link', sortable: false}
                                  ],
                                  secretsHeaders: [
                                      { text: 'File', value: 'fileName', sortable: true},
                                      { text: 'File Path',value: 'filePath', sortable: true},
                                      { text: 'Line No. ', value: 'lineNo',sortable: true},
                                      { text: 'Content Regex Match',value: 'contentRegexMatch', sortable: true},
                                      
                                  ],
                                  malwareHeaders:[
                                      { text: 'File Directory', value: 'fileName', sortable: true},
                                      { text: 'File Name', value: 'fileName', sortable: true},
                                      { text: 'Virus', value: 'fileName', sortable: true}
                                  ],
                                  bomPackageHeaders: [
                                   { text: 'Name', value: '', sortable: true},
                                   { text: 'Version', value: '', sortable: true},
                                   { text: 'Type', value: '', sortable: true},
                                   { text: 'Path', value: '', sortable: true}
                                  ],
                                  bomSourceHeaders: [
                                      { text: 'Media Type', value: '', sortable: true},
                                      { text: 'Digest', value: '', sortable: true},
                                      { text: 'Size', value: '', sortable: true},
                                  ],
                                  policyHeaders:[
                                      { text: 'Gate', value: 'gate', sortable: true},
                                      { text: 'Gate Trigger', value: 'gateTrigger', sortable: true},
                                      { text: 'Check Output', value: 'checkOutput', sortable: true},
                                      { text: 'Gate Action', value: 'gateAction', sortable: true},
                                  ],
                                  dedupHeaders: [
                                      { text: 'Severity',value: 'severity', sortable: false, align : 'center'},
                                      { text: 'Vulnerability', value: 'vuln' , sortable: false},
                                      { text: 'Package Name', value: 'package_name' , sortable: false},
                                      { text: 'Package Version', value: 'package_version' , sortable: false},
                                      { text: 'Fix', value: 'fix' , sortable: false},
                                      { text: 'Feed', value: 'feed' , sortable: false},
                                      { text: 'Feed Group', value: 'feed_group' , sortable: false},
                                      { text: 'Gate Action', value: 'gate_action' , sortable: false},
                                      ],
                                  tabItems : [
                                      { tab: 'Vulnerability', content: 'Tab 1 Content' },
                                      { tab: 'Software Composition', content: 'Tab 2 Content' },
                                      { tab: 'Secrets', content: 'Tab 2 Content' },
                                      { tab: 'License Finder', content: 'Tab 2 Content' },
                                      { tab: 'Malware Analysis', content: 'Tab 2 Content' },
                                  ],
                                  tab : null,
                                  rowsPerPageOptions : {
                                      rowsPerPageItems: [5, 10, 20]
                                  },
                                  footerProps: {
                                      disableItemsPerPage : true
                                  },
                                  policyBundleId: "${it.getPolicyBundleId()}",
                                  bundleName: "${it.getBundleName()}",
                                  vulnerabilityResult : ${it.getVulnerabilitiesResult()},
                                  scaResult : ${it.getScaResult()},
                                  malwareResult : ${it.getMalwareResult()},
                                  bomResult : ${it.getBillOfMaterialsResult()},
                                  licenseResult : ${it.getLicenseFinderResult()},
                                  secretsResult : ${it.getSecretsAnalysisResult()},
                                  policyEvaluationResult : ${it.getPolicyEvaluationResult()},
                                  }
                              }
                          },
                          computed: {
                              pDuration:{
                                  get() {
                                      return parseInt(this.pr.scaResult.analysis.duration / 60);
                                  }
                              },
                              pScaResult : {
                                  get() {
                                      return this.pr.scaResult
                                  }
                              },
                              pLicenseFinderResult : {
                                  get() {
                                      return this.pr.licenseResult
                                  }
                              },
                              pSecretsResult: {
                                  get(){
                                      return this.pr.secretsResult
                                  }
                              },
                              pMalwareResult: {
                                  get(){
                                      return this.pr.malwareResult
                                  }
                              },
                              pBomResult: {
                               get() {
                               return this.pr.bomResult
                               }
                              },
                              pVulnerabilityResult: {
                                      get() {
                                          return this.pr.vulnerabilityResult
                                      },
                              },
                              pVulnerability: {
                                      get() {
                                          return this.pr.vulnerability
                                      },
                              },
                              pPolicyEvaluationResult: {
                                  get() {
                                      return this.pr.policyEvaluationResult
                                  }
                              },
                          },

                          methods: {
                              bytesToSize(bytes) {
                                  var sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB'];
                                  if (bytes == 0) return '0 Byte';
                                  var i = parseInt(Math.floor(Math.log(bytes) / Math.log(1024)));
                                  return Math.round(bytes / Math.pow(1024, i), 2) + ' ' + sizes[i];
                          },
              }
                      })
                  </script>
          ----

          == Inline Script Block
          Line: 561
          ----
          <script type="text/javascript">
                  const vueIconSettings = {
             icons: {
              iconfont: 'mdiSvg', // 'mdi' || 'mdiSvg' || 'md' || 'fa' || 'fa4'
            },
          };
                      var app = new Vue({
                      el: '#app',
                      vuetify: new Vuetify(vueIconSettings),
                      data: function() {
                              return {
                                  pr : {
                                  scaHeaders: [
                                      { text: 'Dependency',value: 'fileName', sortable: true},
                                      { text: 'File Path', value: 'filePath' , sortable: false},
                                      { text: 'Vulnerabilities', value: 'vulnerabilities' , sortable: false},
                                      { text: 'Evidence Collected', value: 'evidenceColllected' , sortable: false},
                                      ],
                                  licenseFinderHeaders: [
                                      { text: 'Dependency', sortable: true},
                                      { text: 'Version', sortable: false},
                                      { text: 'Licenses', sortable: false},
                                      { text: 'Link', sortable: false}
                                  ],
                                  secretsHeaders: [
                                      { text: 'File', value: 'fileName', sortable: true},
                                      { text: 'File Path',value: 'filePath', sortable: true},
                                      { text: 'Line No. ', value: 'lineNo',sortable: true},
                                      { text: 'Content Regex Match',value: 'contentRegexMatch', sortable: true},
                                      
                                  ],
                                  malwareHeaders:[
                                      { text: 'File Directory', value: 'fileName', sortable: true},
                                      { text: 'File Name', value: 'fileName', sortable: true},
                                      { text: 'Virus', value: 'fileName', sortable: true}
                                  ],
                                  bomPackageHeaders: [
                                   { text: 'Name', value: '', sortable: true},
                                   { text: 'Version', value: '', sortable: true},
                                   { text: 'Type', value: '', sortable: true},
                                   { text: 'Path', value: '', sortable: true}
                                  ],
                                  bomSourceHeaders: [
                                      { text: 'Media Type', value: '', sortable: true},
                                      { text: 'Digest', value: '', sortable: true},
                                      { text: 'Size', value: '', sortable: true},
                                  ],
                                  policyHeaders:[
                                      { text: 'Gate', value: 'gate', sortable: true},
                                      { text: 'Gate Trigger', value: 'gateTrigger', sortable: true},
                                      { text: 'Check Output', value: 'checkOutput', sortable: true},
                                      { text: 'Gate Action', value: 'gateAction', sortable: true},
                                  ],
                                  dedupHeaders: [
                                      { text: 'Severity',value: 'severity', sortable: false, align : 'center'},
                                      { text: 'Vulnerability', value: 'vuln' , sortable: false},
                                      { text: 'Package Name', value: 'package_name' , sortable: false},
                                      { text: 'Package Version', value: 'package_version' , sortable: false},
                                      { text: 'Fix', value: 'fix' , sortable: false},
                                      { text: 'Feed', value: 'feed' , sortable: false},
                                      { text: 'Feed Group', value: 'feed_group' , sortable: false},
                                      { text: 'Gate Action', value: 'gate_action' , sortable: false},
                                      ],
                                  tabItems : [
                                      { tab: 'Vulnerability', content: 'Tab 1 Content' },
                                      { tab: 'Software Composition', content: 'Tab 2 Content' },
                                      { tab: 'Secrets', content: 'Tab 2 Content' },
                                      { tab: 'License Finder', content: 'Tab 2 Content' },
                                      { tab: 'Malware Analysis', content: 'Tab 2 Content' },
                                  ],
                                  tab : null,
                                  rowsPerPageOptions : {
                                      rowsPerPageItems: [5, 10, 20]
                                  },
                                  footerProps: {
                                      disableItemsPerPage : true
                                  },
                                  policyBundleId: "${it.getPolicyBundleId()}",
                                  bundleName: "${it.getBundleName()}",
                                  vulnerabilityResult : ${it.getVulnerabilitiesResult()},
                                  scaResult : ${it.getScaResult()},
                                  malwareResult : ${it.getMalwareResult()},
                                  bomResult : ${it.getBillOfMaterialsResult()},
                                  licenseResult : ${it.getLicenseFinderResult()},
                                  secretsResult : ${it.getSecretsAnalysisResult()},
                                  policyEvaluationResult : ${it.getPolicyEvaluationResult()},
                                  }
                              }
                          },
                          computed: {
                              pDuration:{
                                  get() {
                                      return parseInt(this.pr.scaResult.analysis.duration / 60);
                                  }
                              },
                              pScaResult : {
                                  get() {
                                      return this.pr.scaResult
                                  }
                              },
                              pLicenseFinderResult : {
                                  get() {
                                      return this.pr.licenseResult
                                  }
                              },
                              pSecretsResult: {
                                  get(){
                                      return this.pr.secretsResult
                                  }
                              },
                              pMalwareResult: {
                                  get(){
                                      return this.pr.malwareResult
                                  }
                              },
                              pBomResult: {
                               get() {
                               return this.pr.bomResult
                               }
                              },
                              pVulnerabilityResult: {
                                      get() {
                                          return this.pr.vulnerabilityResult
                                      },
                              },
                              pVulnerability: {
                                      get() {
                                          return this.pr.vulnerability
                                      },
                              },
                              pPolicyEvaluationResult: {
                                  get() {
                                      return this.pr.policyEvaluationResult
                                  }
                              },
                          },

                          methods: {
                              bytesToSize(bytes) {
                                  var sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB'];
                                  if (bytes == 0) return '0 Byte';
                                  var i = parseInt(Math.floor(Math.log(bytes) / Math.log(1024)));
                                  return Math.round(bytes / Math.pow(1024, i), 2) + ' ' + sizes[i];
                          },
              }
                      })
                  </script>
          ----
          {noformat}

          h4. Solution

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

          {noformat}
          == Inline Script Block
          Line: 561
          ----
          <script type="text/javascript">
                  const vueIconSettings = {
             icons: {
              iconfont: 'mdiSvg', // 'mdi' || 'mdiSvg' || 'md' || 'fa' || 'fa4'
            },
          };
                      var app = new Vue({
                      el: '#app',
                      vuetify: new Vuetify(vueIconSettings),
                      data: function() {
                              return {
                                  pr : {
                                  scaHeaders: [
                                      { text: 'Dependency',value: 'fileName', sortable: true},
                                      { text: 'File Path', value: 'filePath' , sortable: false},
                                      { text: 'Vulnerabilities', value: 'vulnerabilities' , sortable: false},
                                      { text: 'Evidence Collected', value: 'evidenceColllected' , sortable: false},
                                      ],
                                  licenseFinderHeaders: [
                                      { text: 'Dependency', sortable: true},
                                      { text: 'Version', sortable: false},
                                      { text: 'Licenses', sortable: false},
                                      { text: 'Link', sortable: false}
                                  ],
                                  secretsHeaders: [
                                      { text: 'File', value: 'fileName', sortable: true},
                                      { text: 'File Path',value: 'filePath', sortable: true},
                                      { text: 'Line No. ', value: 'lineNo',sortable: true},
                                      { text: 'Content Regex Match',value: 'contentRegexMatch', sortable: true},
                                      
                                  ],
                                  malwareHeaders:[
                                      { text: 'File Directory', value: 'fileName', sortable: true},
                                      { text: 'File Name', value: 'fileName', sortable: true},
                                      { text: 'Virus', value: 'fileName', sortable: true}
                                  ],
                                  bomPackageHeaders: [
                                   { text: 'Name', value: '', sortable: true},
                                   { text: 'Version', value: '', sortable: true},
                                   { text: 'Type', value: '', sortable: true},
                                   { text: 'Path', value: '', sortable: true}
                                  ],
                                  bomSourceHeaders: [
                                      { text: 'Media Type', value: '', sortable: true},
                                      { text: 'Digest', value: '', sortable: true},
                                      { text: 'Size', value: '', sortable: true},
                                  ],
                                  policyHeaders:[
                                      { text: 'Gate', value: 'gate', sortable: true},
                                      { text: 'Gate Trigger', value: 'gateTrigger', sortable: true},
                                      { text: 'Check Output', value: 'checkOutput', sortable: true},
                                      { text: 'Gate Action', value: 'gateAction', sortable: true},
                                  ],
                                  dedupHeaders: [
                                      { text: 'Severity',value: 'severity', sortable: false, align : 'center'},
                                      { text: 'Vulnerability', value: 'vuln' , sortable: false},
                                      { text: 'Package Name', value: 'package_name' , sortable: false},
                                      { text: 'Package Version', value: 'package_version' , sortable: false},
                                      { text: 'Fix', value: 'fix' , sortable: false},
                                      { text: 'Feed', value: 'feed' , sortable: false},
                                      { text: 'Feed Group', value: 'feed_group' , sortable: false},
                                      { text: 'Gate Action', value: 'gate_action' , sortable: false},
                                      ],
                                  tabItems : [
                                      { tab: 'Vulnerability', content: 'Tab 1 Content' },
                                      { tab: 'Software Composition', content: 'Tab 2 Content' },
                                      { tab: 'Secrets', content: 'Tab 2 Content' },
                                      { tab: 'License Finder', content: 'Tab 2 Content' },
                                      { tab: 'Malware Analysis', content: 'Tab 2 Content' },
                                  ],
                                  tab : null,
                                  rowsPerPageOptions : {
                                      rowsPerPageItems: [5, 10, 20]
                                  },
                                  footerProps: {
                                      disableItemsPerPage : true
                                  },
                                  policyBundleId: "${it.getPolicyBundleId()}",
                                  bundleName: "${it.getBundleName()}",
                                  vulnerabilityResult : ${it.getVulnerabilitiesResult()},
                                  scaResult : ${it.getScaResult()},
                                  malwareResult : ${it.getMalwareResult()},
                                  bomResult : ${it.getBillOfMaterialsResult()},
                                  licenseResult : ${it.getLicenseFinderResult()},
                                  secretsResult : ${it.getSecretsAnalysisResult()},
                                  policyEvaluationResult : ${it.getPolicyEvaluationResult()},
                                  }
                              }
                          },
                          computed: {
                              pDuration:{
                                  get() {
                                      return parseInt(this.pr.scaResult.analysis.duration / 60);
                                  }
                              },
                              pScaResult : {
                                  get() {
                                      return this.pr.scaResult
                                  }
                              },
                              pLicenseFinderResult : {
                                  get() {
                                      return this.pr.licenseResult
                                  }
                              },
                              pSecretsResult: {
                                  get(){
                                      return this.pr.secretsResult
                                  }
                              },
                              pMalwareResult: {
                                  get(){
                                      return this.pr.malwareResult
                                  }
                              },
                              pBomResult: {
                               get() {
                               return this.pr.bomResult
                               }
                              },
                              pVulnerabilityResult: {
                                      get() {
                                          return this.pr.vulnerabilityResult
                                      },
                              },
                              pVulnerability: {
                                      get() {
                                          return this.pr.vulnerability
                                      },
                              },
                              pPolicyEvaluationResult: {
                                  get() {
                                      return this.pr.policyEvaluationResult
                                  }
                              },
                          },

                          methods: {
                              bytesToSize(bytes) {
                                  var sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB'];
                                  if (bytes == 0) return '0 Byte';
                                  var i = parseInt(Math.floor(Math.log(bytes) / Math.log(1024)));
                                  return Math.round(bytes / Math.pow(1024, i), 2) + ' ' + sizes[i];
                          },
              }
                      })
                  </script>
          ----
          {noformat}

          h4. Solution

          [https://www.jenkins.io/doc/developer/security/csp/#inline-javascript-blocks]
          Summary Original: [carbonetes-serverless-container-scanning-and-policy-compliance] Extract inline script blocks in io/jenkins/plugins/carbonetes/CarbonetesAction/index.jelly New: [carbonetes-serverless-container-scanning-and-policy-compliance] Extract inline script block in io/jenkins/plugins/carbonetes/CarbonetesAction/index.jelly

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

              Created:
              Updated: