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

[global-build-stats] Extract inline script blocks and event handlers in hudson/plugins/global_build_stats/GlobalBuildStatsPlugin/buildHistory.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}";
      	        ESCAPED_JOB_FILTER = "${escapedJobFilter}";
      	      	ESCAPED_NODE_FILTER = "${escapedNodeFilter}";
      	      	ESCAPED_LAUNCHER_FILTER = "${escapedLauncherFilter}";
      		</script>
      ----
      
      == Inline Script Block
      Line: 140
      ----
      <script type="text/javascript"><![CDATA[
      		  if(document.getElementById('searchBuild_jobFilter').value.indexOf(FIELD_FILTER_REGEX) != -1){
      		  	  document.getElementById('searchBuild_jobFilteringType_REGEX').checked = 'checked';
      		  	  initializeRegexField('searchBuild_jobNameRegex', ESCAPED_JOB_FILTER);
      		  	  document.getElementById('searchBuild_jobFilteringType_REGEX').onchange();
      		  	  document.getElementById('searchBuild_jobNameRegex').disabled = false;
      		  } else if(document.getElementById('searchBuild_jobFilter').value.indexOf(FIELD_FILTER_ALL) != -1){
      		  	  document.getElementById('searchBuild_jobFilteringType_ALL').checked = 'checked';
      		  	  document.getElementById('searchBuild_jobFilteringType_ALL').onchange();
      		  }
      		  if(document.getElementById('searchBuild_nodeFilter').value.indexOf(NODE_MASTER_REGEX) != -1){
      		  	  document.getElementById('searchBuild_nodeFilteringType_REGEXMASTER').checked = 'checked';
       		 	  document.getElementById('searchBuild_nodeFilteringType_REGEXMASTER').onchange();
      		  	  document.getElementById('searchBuild_nodeNameRegex').disabled = true;
      		  } else if(document.getElementById('searchBuild_nodeFilter').value.indexOf(FIELD_FILTER_REGEX) != -1){
      		  	  document.getElementById('searchBuild_nodeFilteringType_REGEX').checked = 'checked';
      		  	  initializeRegexField('searchBuild_nodeNameRegex', ESCAPED_NODE_FILTER);
       		 	  document.getElementById('searchBuild_nodeFilteringType_REGEX').onchange();
      		  	  document.getElementById('searchBuild_nodeNameRegex').disabled = false;
      		  } else if(document.getElementById('searchBuild_nodeFilter').value.indexOf(FIELD_FILTER_ALL) != -1){
      		  	  document.getElementById('searchBuild_nodeFilteringType_ALL').checked = 'checked';
      		  	  document.getElementById('searchBuild_nodeFilteringType_ALL').onchange();
      		  }
      		  if(document.getElementById('searchBuild_launcherFilter').value.indexOf(LAUNCHER_SYSTEM_REGEX) != -1){
      		  	  document.getElementById('searchBuild_launcherFilteringType_REGEXSYSTEM').checked = 'checked';
       		 	  document.getElementById('searchBuild_launcherFilteringType_REGEXSYSTEM').onchange();
      		  	  document.getElementById('searchBuild_launcherNameRegex').disabled = true;
      		  } else if(document.getElementById('searchBuild_launcherFilter').value.indexOf(FIELD_FILTER_REGEX) != -1){
      		  	  document.getElementById('searchBuild_launcherFilteringType_REGEX').checked = 'checked';
      		  	  initializeRegexField('searchBuild_launcherNameRegex', ESCAPED_LAUNCHER_FILTER);
       		 	  document.getElementById('searchBuild_launcherFilteringType_REGEX').onchange();
      		  	  document.getElementById('searchBuild_launcherNameRegex').disabled = false;
      		  } else if(document.getElementById('searchBuild_launcherFilter').value.indexOf(FIELD_FILTER_ALL) != -1){
      		  	  document.getElementById('searchBuild_launcherFilteringType_ALL').checked = 'checked';
      		  	  document.getElementById('searchBuild_launcherFilteringType_ALL').onchange();
      		  }
      		  ]]></script>
      ----
      
      == Inline Event Handler
      Line: 72
      ----
      <input type="radio" id="searchBuild_jobFilteringType_ALL" checked="checked" name="jobFilteringType" value="${FIELD_FILTER_ALL}" class="jenkins-radio__input"
                           onchange="fieldFilterTypeSelected(this.value, 'searchBuild_jobNameRegex', 'searchBuild_jobFilter');" />
      ----
      
      == Inline Event Handler
      Line: 77
      ----
      <input type="radio" id="searchBuild_jobFilteringType_REGEX" name="jobFilteringType" value="${FIELD_FILTER_REGEX}" class="jenkins-radio__input"
                             onchange="fieldFilterTypeSelected(this.value, 'searchBuild_jobNameRegex', 'searchBuild_jobFilter');" />
      ----
      
      == Inline Event Handler
      Line: 81
      ----
      <input type="text" id="searchBuild_jobNameRegex" class="jenkins-input"
                           disabled="true" name="jobNameRegex" size="10"
                           onblur="document.getElementById('searchBuild_jobFilter').value=FIELD_FILTER_REGEX+'('+this.value+')';"/>
      ----
      
      == Inline Event Handler
      Line: 89
      ----
      <input type="radio" id="searchBuild_nodeFilteringType_ALL" checked="checked" name="nodeFilteringType" value="${FIELD_FILTER_ALL}" class="jenkins-radio__input"
                             onchange="fieldFilterTypeSelected(this.value, 'searchBuild_nodeNameRegex', 'searchBuild_nodeFilter');" />
      ----
      
      == Inline Event Handler
      Line: 94
      ----
      <input type="radio" id="searchBuild_nodeFilteringType_REGEXMASTER" name="nodeFilteringType" value="${NODE_MASTER_REGEX}" class="jenkins-radio__input"
                             onchange="fieldFilterTypeSelected(this.value, 'searchBuild_nodeNameRegex', 'searchBuild_nodeFilter');" />
      ----
      
      == Inline Event Handler
      Line: 99
      ----
      <input type="radio" id="searchBuild_nodeFilteringType_REGEX" name="nodeFilteringType" value="${FIELD_FILTER_REGEX}" class="jenkins-radio__input"
                             onchange="fieldFilterTypeSelected(this.value, 'searchBuild_nodeNameRegex', 'searchBuild_nodeFilter');" />
      ----
      
      == Inline Event Handler
      Line: 103
      ----
      <input type="text" id="searchBuild_nodeNameRegex" class="jenkins-input"
                       disabled="true" name="nodeNameRegex" size="10"
                       onblur="document.getElementById('searchBuild_nodeFilter').value=FIELD_FILTER_REGEX+'('+this.value+')';"/>
      ----
      
      == Inline Event Handler
      Line: 111
      ----
      <input type="radio" id="searchBuild_launcherFilteringType_ALL" checked="checked" name="launcherFilteringType" value="${FIELD_FILTER_ALL}" class="jenkins-radio__input"
                             onchange="fieldFilterTypeSelected(this.value, 'searchBuild_launcherNameRegex', 'searchBuild_launcherFilter');" />
      ----
      
      == Inline Event Handler
      Line: 116
      ----
      <input type="radio" id="searchBuild_launcherFilteringType_REGEXSYSTEM" name="launcherFilteringType" value="${LAUNCHER_SYSTEM_REGEX}" class="jenkins-radio__input"
                             onchange="fieldFilterTypeSelected(this.value, 'searchBuild_launcherNameRegex', 'searchBuild_launcherFilter');" />
      ----
      
      == Inline Event Handler
      Line: 121
      ----
      <input type="radio" id="searchBuild_launcherFilteringType_REGEX" name="launcherFilteringType" value="${FIELD_FILTER_REGEX}" class="jenkins-radio__input"
                             onchange="fieldFilterTypeSelected(this.value, 'searchBuild_launcherNameRegex', 'searchBuild_launcherFilter');" />
      ----
      
      == Inline Event Handler
      Line: 125
      ----
      <input type="text" id="searchBuild_launcherNameRegex" class="jenkins-input"
                         disabled="true" name="launcherNameRegex" size="10"
                         onblur="document.getElementById('searchBuild_launcherFilter').value=FIELD_FILTER_REGEX+'('+this.value+')';"/>
      ----
      
      == 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}";
      	        ESCAPED_JOB_FILTER = "${escapedJobFilter}";
      	      	ESCAPED_NODE_FILTER = "${escapedNodeFilter}";
      	      	ESCAPED_LAUNCHER_FILTER = "${escapedLauncherFilter}";
      		</script>
      ----
      
      == Inline Script Block
      Line: 140
      ----
      <script type="text/javascript"><![CDATA[
      		  if(document.getElementById('searchBuild_jobFilter').value.indexOf(FIELD_FILTER_REGEX) != -1){
      		  	  document.getElementById('searchBuild_jobFilteringType_REGEX').checked = 'checked';
      		  	  initializeRegexField('searchBuild_jobNameRegex', ESCAPED_JOB_FILTER);
      		  	  document.getElementById('searchBuild_jobFilteringType_REGEX').onchange();
      		  	  document.getElementById('searchBuild_jobNameRegex').disabled = false;
      		  } else if(document.getElementById('searchBuild_jobFilter').value.indexOf(FIELD_FILTER_ALL) != -1){
      		  	  document.getElementById('searchBuild_jobFilteringType_ALL').checked = 'checked';
      		  	  document.getElementById('searchBuild_jobFilteringType_ALL').onchange();
      		  }
      		  if(document.getElementById('searchBuild_nodeFilter').value.indexOf(NODE_MASTER_REGEX) != -1){
      		  	  document.getElementById('searchBuild_nodeFilteringType_REGEXMASTER').checked = 'checked';
       		 	  document.getElementById('searchBuild_nodeFilteringType_REGEXMASTER').onchange();
      		  	  document.getElementById('searchBuild_nodeNameRegex').disabled = true;
      		  } else if(document.getElementById('searchBuild_nodeFilter').value.indexOf(FIELD_FILTER_REGEX) != -1){
      		  	  document.getElementById('searchBuild_nodeFilteringType_REGEX').checked = 'checked';
      		  	  initializeRegexField('searchBuild_nodeNameRegex', ESCAPED_NODE_FILTER);
       		 	  document.getElementById('searchBuild_nodeFilteringType_REGEX').onchange();
      		  	  document.getElementById('searchBuild_nodeNameRegex').disabled = false;
      		  } else if(document.getElementById('searchBuild_nodeFilter').value.indexOf(FIELD_FILTER_ALL) != -1){
      		  	  document.getElementById('searchBuild_nodeFilteringType_ALL').checked = 'checked';
      		  	  document.getElementById('searchBuild_nodeFilteringType_ALL').onchange();
      		  }
      		  if(document.getElementById('searchBuild_launcherFilter').value.indexOf(LAUNCHER_SYSTEM_REGEX) != -1){
      		  	  document.getElementById('searchBuild_launcherFilteringType_REGEXSYSTEM').checked = 'checked';
       		 	  document.getElementById('searchBuild_launcherFilteringType_REGEXSYSTEM').onchange();
      		  	  document.getElementById('searchBuild_launcherNameRegex').disabled = true;
      		  } else if(document.getElementById('searchBuild_launcherFilter').value.indexOf(FIELD_FILTER_REGEX) != -1){
      		  	  document.getElementById('searchBuild_launcherFilteringType_REGEX').checked = 'checked';
      		  	  initializeRegexField('searchBuild_launcherNameRegex', ESCAPED_LAUNCHER_FILTER);
       		 	  document.getElementById('searchBuild_launcherFilteringType_REGEX').onchange();
      		  	  document.getElementById('searchBuild_launcherNameRegex').disabled = false;
      		  } else if(document.getElementById('searchBuild_launcherFilter').value.indexOf(FIELD_FILTER_ALL) != -1){
      		  	  document.getElementById('searchBuild_launcherFilteringType_ALL').checked = 'checked';
      		  	  document.getElementById('searchBuild_launcherFilteringType_ALL').onchange();
      		  }
      		  ]]></script>
      ----
      
      == Inline Event Handler
      Line: 72
      ----
      <input type="radio" id="searchBuild_jobFilteringType_ALL" checked="checked" name="jobFilteringType" value="${FIELD_FILTER_ALL}" class="jenkins-radio__input"
                           onchange="fieldFilterTypeSelected(this.value, 'searchBuild_jobNameRegex', 'searchBuild_jobFilter');" />
      ----
      
      == Inline Event Handler
      Line: 77
      ----
      <input type="radio" id="searchBuild_jobFilteringType_REGEX" name="jobFilteringType" value="${FIELD_FILTER_REGEX}" class="jenkins-radio__input"
                             onchange="fieldFilterTypeSelected(this.value, 'searchBuild_jobNameRegex', 'searchBuild_jobFilter');" />
      ----
      
      == Inline Event Handler
      Line: 81
      ----
      <input type="text" id="searchBuild_jobNameRegex" class="jenkins-input"
                           disabled="true" name="jobNameRegex" size="10"
                           onblur="document.getElementById('searchBuild_jobFilter').value=FIELD_FILTER_REGEX+'('+this.value+')';"/>
      ----
      
      == Inline Event Handler
      Line: 89
      ----
      <input type="radio" id="searchBuild_nodeFilteringType_ALL" checked="checked" name="nodeFilteringType" value="${FIELD_FILTER_ALL}" class="jenkins-radio__input"
                             onchange="fieldFilterTypeSelected(this.value, 'searchBuild_nodeNameRegex', 'searchBuild_nodeFilter');" />
      ----
      
      == Inline Event Handler
      Line: 94
      ----
      <input type="radio" id="searchBuild_nodeFilteringType_REGEXMASTER" name="nodeFilteringType" value="${NODE_MASTER_REGEX}" class="jenkins-radio__input"
                             onchange="fieldFilterTypeSelected(this.value, 'searchBuild_nodeNameRegex', 'searchBuild_nodeFilter');" />
      ----
      
      == Inline Event Handler
      Line: 99
      ----
      <input type="radio" id="searchBuild_nodeFilteringType_REGEX" name="nodeFilteringType" value="${FIELD_FILTER_REGEX}" class="jenkins-radio__input"
                             onchange="fieldFilterTypeSelected(this.value, 'searchBuild_nodeNameRegex', 'searchBuild_nodeFilter');" />
      ----
      
      == Inline Event Handler
      Line: 103
      ----
      <input type="text" id="searchBuild_nodeNameRegex" class="jenkins-input"
                       disabled="true" name="nodeNameRegex" size="10"
                       onblur="document.getElementById('searchBuild_nodeFilter').value=FIELD_FILTER_REGEX+'('+this.value+')';"/>
      ----
      
      == Inline Event Handler
      Line: 111
      ----
      <input type="radio" id="searchBuild_launcherFilteringType_ALL" checked="checked" name="launcherFilteringType" value="${FIELD_FILTER_ALL}" class="jenkins-radio__input"
                             onchange="fieldFilterTypeSelected(this.value, 'searchBuild_launcherNameRegex', 'searchBuild_launcherFilter');" />
      ----
      
      == Inline Event Handler
      Line: 116
      ----
      <input type="radio" id="searchBuild_launcherFilteringType_REGEXSYSTEM" name="launcherFilteringType" value="${LAUNCHER_SYSTEM_REGEX}" class="jenkins-radio__input"
                             onchange="fieldFilterTypeSelected(this.value, 'searchBuild_launcherNameRegex', 'searchBuild_launcherFilter');" />
      ----
      
      == Inline Event Handler
      Line: 121
      ----
      <input type="radio" id="searchBuild_launcherFilteringType_REGEX" name="launcherFilteringType" value="${FIELD_FILTER_REGEX}" class="jenkins-radio__input"
                             onchange="fieldFilterTypeSelected(this.value, 'searchBuild_launcherNameRegex', 'searchBuild_launcherFilter');" />
      ----
      
      == Inline Event Handler
      Line: 125
      ----
      <input type="text" id="searchBuild_launcherNameRegex" class="jenkins-input"
                         disabled="true" name="launcherNameRegex" size="10"
                         onblur="document.getElementById('searchBuild_launcherFilter').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

            mawinter69 Markus Winter
            basil Basil Crow
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: