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

[build-metrics] Extract inline script blocks and event handlers in jenkins/plugins/build_metrics/BuildMetricsPlugin/index.jelly

XMLWordPrintable

      Problems

      == Inline Script Block
      Line: 25
      ----
      <script>var startDate = ${searchCriteria.start}; var endDate = ${searchCriteria.end};</script>
      ----
      
      == Inline Script Block
      Line: 26
      ----
      <script type="text/javascript">
            FIELD_FILTER_ALL = "${FIELD_FILTER_ALL}";
            FIELD_FILTER_REGEX = "${FIELD_FILTER_REGEX}";
            LAUNCHER_SYSTEM_REGEX = "${LAUNCHER_SYSTEM_REGEX}";
            NODE_MASTER_REGEX = "${NODE_MASTER_REGEX}";
            CAUSE_SYSTEM_REGEX = "${CAUSE_SYSTEM_REGEX}";
            ESCAPED_JOB_FILTER = "${escapedJobFilter}";
            ESCAPED_NODE_FILTER = "${escapedNodeFilter}";
            ESCAPED_LAUNCHER_FILTER = "${escapedLauncherFilter}";
          </script>
      ----
      
      == Inline Script Block
      Line: 109
      ----
      <script type="text/javascript"><![CDATA[
      		  if($('searchBuild_jobFilter').value.indexOf(FIELD_FILTER_REGEX) != -1){
      		  	  $('searchBuild_jobFilteringType_REGEX').checked = 'checked';
      		  	  initializeRegexField('searchBuild_jobNameRegex', ESCAPED_JOB_FILTER);
      		  	  $('searchBuild_jobFilteringType_REGEX').onchange();
      		  	  $('searchBuild_jobNameRegex').disabled = false;
      		  } else if(document.getElementById('searchBuild_jobFilter').value.indexOf(FIELD_FILTER_ALL) != -1){
      		  	  $('searchBuild_jobFilteringType_ALL').checked = 'checked';
      		  	  $('searchBuild_jobFilteringType_ALL').onchange();
      		  }
      		  if($('searchBuild_nodeFilter').value.indexOf(NODE_MASTER_REGEX) != -1){
      		  	  $('searchBuild_nodeFilteringType_REGEXMASTER').checked = 'checked';
       		 	  $('searchBuild_nodeFilteringType_REGEXMASTER').onchange();
      		  	  $('searchBuild_nodeNameRegex').disabled = true;
      		  } else if($('searchBuild_nodeFilter').value.indexOf(FIELD_FILTER_REGEX) != -1){
      		  	  $('searchBuild_nodeFilteringType_REGEX').checked = 'checked';
      		  	  initializeRegexField('searchBuild_nodeNameRegex', ESCAPED_NODE_FILTER);
       		 	  $('searchBuild_nodeFilteringType_REGEX').onchange();
      		  	  $('searchBuild_nodeNameRegex').disabled = false;
      		  } else if($('searchBuild_nodeFilter').value.indexOf(FIELD_FILTER_ALL) != -1){
      		  	  $('searchBuild_nodeFilteringType_ALL').checked = 'checked';
      		  	  $('searchBuild_nodeFilteringType_ALL').onchange();
      		  }
      		  if($('searchBuild_launcherFilter').value.indexOf(LAUNCHER_SYSTEM_REGEX) != -1){
      		  	  $('searchBuild_launcherFilteringType_REGEXSYSTEM').checked = 'checked';
       		 	  $('searchBuild_launcherFilteringType_REGEXSYSTEM').onchange();
      		  	  $('searchBuild_launcherNameRegex').disabled = true;
      		  } else if($('searchBuild_launcherFilter').value.indexOf(FIELD_FILTER_REGEX) != -1){
      		  	  $('searchBuild_launcherFilteringType_REGEX').checked = 'checked';
      		  	  initializeRegexField('searchBuild_launcherNameRegex', ESCAPED_LAUNCHER_FILTER);
       		 	  $('searchBuild_launcherFilteringType_REGEX').onchange();
      		  	  $('searchBuild_launcherNameRegex').disabled = false;
      		  } else if($('searchBuild_launcherFilter').value.indexOf(FIELD_FILTER_ALL) != -1){
      		  	  $('searchBuild_launcherFilteringType_ALL').checked = 'checked';
      		  	  $('searchBuild_launcherFilteringType_ALL').onchange();
      		  }
      		  if($('searchBuild_causeFilter').value.indexOf(CAUSE_SYSTEM_REGEX) != -1){
      		  	  $('searchBuild_causeFilteringType_REGEX').checked = 'checked';
      		  	  initializeRegexField('searchBuild_causeNameRegex', ESCAPED_CAUSE_FILTER);
      		  	  $('searchBuild_causeFilteringType_REGEX').onchange();
      		  	  $('searchBuild_causeNameRegex').disabled = false;
      		  } else if(document.getElementById('searchBuild_causeFilter').value.indexOf(FIELD_FILTER_ALL) != -1){
      		  	  $('searchBuild_causeFilteringType_ALL').checked = 'checked';
      		  	  $('searchBuild_causeFilteringType_ALL').onchange();
      		  }
      		  ]]></script>
      ----
      
      == Inline Event Handler
      Line: 65
      ----
      <input type="radio" id="searchBuild_jobFilteringType_ALL" checked="checked" name="jobFilteringType" value="${FIELD_FILTER_ALL}" onchange="fieldFilterTypeSelected(this.value, 'searchBuild_jobNameRegex', 'searchBuild_jobFilter');" />
      ----
      
      == Inline Event Handler
      Line: 66
      ----
      <input type="radio" id="searchBuild_jobFilteringType_REGEX" name="jobFilteringType" value="${FIELD_FILTER_REGEX}" onchange="fieldFilterTypeSelected(this.value, 'searchBuild_jobNameRegex', 'searchBuild_jobFilter');" />
      ----
      
      == Inline Event Handler
      Line: 68
      ----
      <input type="text" id="searchBuild_jobNameRegex" 
      		      		 disabled="true" name="jobNameRegex" size="20"
      		      		 onblur="$('searchBuild_jobFilter').value=FIELD_FILTER_REGEX+'('+this.value+')';" 
      		      />
      ----
      
      == Inline Event Handler
      Line: 75
      ----
      <input type="radio" id="searchBuild_nodeFilteringType_ALL" checked="checked" name="nodeFilteringType" value="${FIELD_FILTER_ALL}" onchange="fieldFilterTypeSelected(this.value, 'searchBuild_nodeNameRegex', 'searchBuild_nodeFilter');" />
      ----
      
      == Inline Event Handler
      Line: 76
      ----
      <input type="radio" id="searchBuild_nodeFilteringType_REGEXMASTER" name="nodeFilteringType" value="${NODE_MASTER_REGEX}" onchange="fieldFilterTypeSelected(this.value, 'searchBuild_nodeNameRegex', 'searchBuild_nodeFilter');" />
      ----
      
      == Inline Event Handler
      Line: 78
      ----
      <input type="radio" id="searchBuild_nodeFilteringType_REGEX" name="nodeFilteringType" value="${FIELD_FILTER_REGEX}" onchange="fieldFilterTypeSelected(this.value, 'searchBuild_nodeNameRegex', 'searchBuild_nodeFilter');" />
      ----
      
      == Inline Event Handler
      Line: 80
      ----
      <input type="text" id="searchBuild_nodeNameRegex" 
      		      		 disabled="true" name="nodeNameRegex" size="10"
      		      		 onblur="$('searchBuild_nodeFilter').value=FIELD_FILTER_REGEX+'('+this.value+')';" 
      		      />
      ----
      
      == Inline Event Handler
      Line: 87
      ----
      <input type="radio" id="searchBuild_launcherFilteringType_ALL" checked="checked" name="launcherFilteringType" value="${FIELD_FILTER_ALL}" onchange="fieldFilterTypeSelected(this.value, 'searchBuild_launcherNameRegex', 'searchBuild_launcherFilter');" />
      ----
      
      == Inline Event Handler
      Line: 88
      ----
      <input type="radio" id="searchBuild_launcherFilteringType_REGEXSYSTEM" name="launcherFilteringType" value="${LAUNCHER_SYSTEM_REGEX}" onchange="fieldFilterTypeSelected(this.value, 'searchBuild_launcherNameRegex', 'searchBuild_launcherFilter');" />
      ----
      
      == Inline Event Handler
      Line: 90
      ----
      <input type="radio" id="searchBuild_launcherFilteringType_REGEX" name="launcherFilteringType" value="${FIELD_FILTER_REGEX}" onchange="fieldFilterTypeSelected(this.value, 'searchBuild_launcherNameRegex', 'searchBuild_launcherFilter');" />
      ----
      
      == Inline Event Handler
      Line: 92
      ----
      <input type="text" id="searchBuild_launcherNameRegex" 
      		      		 disabled="true" name="launcherNameRegex" size="10"
      		      		 onblur="$('searchBuild_launcherFilter').value=FIELD_FILTER_REGEX+'('+this.value+')';" 
      		      />
      ----
      
      == Inline Event Handler
      Line: 99
      ----
      <input type="radio" id="searchBuild_causeFilteringType_ALL" checked="checked" name="causeFilteringType" value="${FIELD_FILTER_ALL}" onchange="fieldFilterTypeSelected(this.value, 'searchBuild_causeNameRegex', 'searchBuild_causeFilter');" />
      ----
      
      == Inline Event Handler
      Line: 100
      ----
      <input type="radio" id="searchBuild_causeFilteringType_REGEXSYSTEM" name="causeFilteringType" value="${CAUSE_SYSTEM_REGEX}" onchange="fieldFilterTypeSelected(this.value, 'searchBuild_causeNameRegex', 'searchBuild_causeFilter');" />
      ----
      
      == Inline Event Handler
      Line: 102
      ----
      <input type="text" id="searchBuild_causeNameRegex" 
      		      		 disabled="true" name="causeNameRegex" size="10"
      		      		 onblur="$('searchBuild_causeFilter').value=FIELD_FILTER_REGEX+'('+this.value+')';" 
      		      />
      ----
      

      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: