[global-build-stats] Extract inline script blocks, extract inline event handlers, and migrate legacy checkUrl attributes in hudson/plugins/global_build_stats/GlobalBuildStatsPlugin/index.jelly

XMLWordPrintable

    Problems

    == Legacy checkUrl
    Line: 129
    ----
    checkUrl="'${rootURL}/plugin/global-build-stats/checkTitle?value='+escape(field.value)"
    ----
    
    == Legacy checkUrl
    Line: 138
    ----
    checkUrl="'${rootURL}/plugin/global-build-stats/checkBuildStatWidth?value='+escape(field.value)"
    ----
    
    == Legacy checkUrl
    Line: 146
    ----
    checkUrl="'${rootURL}/plugin/global-build-stats/checkBuildStatHeight?value='+escape(field.value)"
    ----
    
    == Legacy checkUrl
    Line: 155
    ----
    checkUrl="'${rootURL}/plugin/global-build-stats/checkHistoricScale?value='+escape(field.value)"
    ----
    
    == Legacy checkUrl
    Line: 166
    ----
    checkUrl="'${rootURL}/plugin/global-build-stats/checkHistoricLength?value='+escape(field.value)"
    ----
    
    == Legacy checkUrl
    Line: 261
    ----
    checkUrl="'${rootURL}/plugin/global-build-stats/checkYAxisChartType?value='+escape(field.value)"
    ----
    
    == Inline Script Block
    Line: 26
    ----
    <script type="text/javascript"><![CDATA[
            BUILD_STAT_CONTAINER_ID_PREFIX = "container_buildStatConfig_";
            var CURRENT_FORM = null;
    
            // Called after button "initialize stats" is clicked
            function initializeStats(){
              ajaxCall('link', 'recordBuildInfos', function(transport) {
                document.getElementById('initializeStatsMessage').style.display = "inline";
              });
            }
    
    
            var BUILD_STAT_CONFIGS = new BuildStatConfigs();
            window.addEventListener('load', function(){
              ajaxCall('link', rootURL+'/plugin/global-build-stats/api/json?depth=2', function(ret) {
                var buildStat = eval('('+ret.responseText+')');
                for(i=0; i<buildStat.buildStatConfigs.length; i++){
                  var config = buildStat.buildStatConfigs[i];
                  BUILD_STAT_CONFIGS.add(config);
                }
              });
            });
            ]]></script>
    ----
    
    == Inline Script Block
    Line: 49
    ----
    <script type="text/javascript">
            CHART_LENGTH_UNITS = new Array();
            <j:forEach var="historicScale" items="${it.historicScales}" varStatus="status">
              CHART_LENGTH_UNITS[${status.index}] = "${historicScale}";
            </j:forEach>
            FIELD_FILTER_ALL = "${FIELD_FILTER_ALL}";
            FIELD_FILTER_REGEX = "${FIELD_FILTER_REGEX}";
            LAUNCHER_SYSTEM_REGEX = "${LAUNCHER_SYSTEM_REGEX}";
            NODE_MASTER_REGEX = "${NODE_MASTER_REGEX}";
          </script>
    ----
    
    == Inline Event Handler
    Line: 13
    ----
    <l:task icon="symbol-bar-chart-outline plugin-ionicons-api" href="#"
                    onclick="new BuildStatConfigForm(null).displayBuildStatConfigForm(); return false;" title="${%Create new chart}"/>
    ----
    
    == Inline Event Handler
    Line: 90
    ----
    <button id="edit_#{id}" onclick="new BuildStatConfigForm('#{id}').displayBuildStatConfigForm();"
                        class="jenkins-button jenkins-button--tertiary">
    ----
    
    == Inline Event Handler
    Line: 94
    ----
    <button onclick="BUILD_STAT_CONFIGS.moveBuildStat('#{id}', 'up');" id="moveUp_#{id}" class="jenkins-button jenkins-button--tertiary">
    ----
    
    == Inline Event Handler
    Line: 97
    ----
    <button onclick="BUILD_STAT_CONFIGS.moveBuildStat('#{id}', 'down');" id="moveDown_#{id}" class="jenkins-button jenkins-button--tertiary">
    ----
    
    == Inline Event Handler
    Line: 100
    ----
    <button onclick="deleteBuildStat('#{id}');" class="jenkins-button jenkins-button--tertiary">
    ----
    
    == Inline Event Handler
    Line: 121
    ----
    <form name="createBuildStat_#{buildStatId}" action="#{formAction}" method="post" class="globalBuildStatsForm"
                    id="createBuildStat_#{buildStatId}" onsubmit="return !isDivErrorPresentInForm(this);">
    ----
    
    == Inline Event Handler
    Line: 127
    ----
    <input type="text" id="#{buildStatId}_title" name="title"
                           value="#{buildStatTitle}" class="jenkins-input"
                           checkUrl="'${rootURL}/plugin/global-build-stats/checkTitle?value='+escape(field.value)"
                           onblur="validateField(this);" onchange="validateField(this);"
                    />
    ----
    
    == Inline Event Handler
    Line: 136
    ----
    <input type="number" id="#{buildStatId}_buildStatWidth" name="buildStatWidth"
                           size="3" value="#{buildStatWidth}" class="jenkins-input" min="100"
                           checkUrl="'${rootURL}/plugin/global-build-stats/checkBuildStatWidth?value='+escape(field.value)"
                           onblur="validateField(this);" onchange="validateField(this);"
                    />
    ----
    
    == Inline Event Handler
    Line: 144
    ----
    <input type="number" id="#{buildStatId}_buildStatHeight" name="buildStatHeight"
                           size="3" value="#{buildStatHeight}" class="jenkins-input" min="100"
                           checkUrl="'${rootURL}/plugin/global-build-stats/checkBuildStatHeight?value='+escape(field.value)"
                           onblur="validateField(this);" onchange="validateField(this);"
                    />
    ----
    
    == Inline Event Handler
    Line: 154
    ----
    <select id="#{buildStatId}_historicScale" class="jenkins-select__input"
                              name="historicScale" checkUrl="'${rootURL}/plugin/global-build-stats/checkHistoricScale?value='+escape(field.value)"
                              onchange="validateField(this); CURRENT_FORM.changeChartLengthUnit(this.value);">
    ----
    
    == Inline Event Handler
    Line: 164
    ----
    <input type="number" id="#{buildStatId}_historicLength" name="historicLength"
                           size="3" value="#{historicLength}" class="jenkins-input"
                           checkUrl="'${rootURL}/plugin/global-build-stats/checkHistoricLength?value='+escape(field.value)"
                           onblur="validateField(this);" onchange="validateField(this);"
                    />
    ----
    
    == Inline Event Handler
    Line: 179
    ----
    <input type="radio" id="#{buildStatId}_jobFilteringType_ALL" checked="checked" name="jobFilteringType"
                               value="${FIELD_FILTER_ALL}" class="jenkins-radio__input"
                               onchange="fieldFilterTypeSelected(this.value, '#{buildStatId}_jobNameRegex', '#{buildStatId}_jobFilter');"/>
    ----
    
    == Inline Event Handler
    Line: 185
    ----
    <input type="radio" id="#{buildStatId}_jobFilteringType_REGEX" name="jobFilteringType"
                               value="${FIELD_FILTER_REGEX}" class="jenkins-radio__input"
                               onchange="fieldFilterTypeSelected(this.value, '#{buildStatId}_jobNameRegex', '#{buildStatId}_jobFilter');"/>
    ----
    
    == Inline Event Handler
    Line: 190
    ----
    <input type="text" id="#{buildStatId}_jobNameRegex" class="jenkins-input"
                             disabled="true" name="jobNameRegex" size="10"
                             onblur="document.getElementById('#{buildStatId}_jobFilter').value=FIELD_FILTER_REGEX+'('+this.value+')';"/>
    ----
    
    == Inline Event Handler
    Line: 198
    ----
    <input type="radio" id="#{buildStatId}_nodeFilteringType_ALL" checked="checked" name="nodeFilteringType"
                               value="${FIELD_FILTER_ALL}" class="jenkins-radio__input"
                               onchange="fieldFilterTypeSelected(this.value, '#{buildStatId}_nodeNameRegex', '#{buildStatId}_nodeFilter');"/>
    ----
    
    == Inline Event Handler
    Line: 204
    ----
    <input type="radio" id="#{buildStatId}_nodeFilteringType_REGEXMASTER" name="nodeFilteringType"
                               value="${NODE_MASTER_REGEX}" class="jenkins-radio__input"
                               onchange="fieldFilterTypeSelected(this.value, '#{buildStatId}_nodeNameRegex', '#{buildStatId}_nodeFilter');"/>
    ----
    
    == Inline Event Handler
    Line: 210
    ----
    <input type="radio" id="#{buildStatId}_nodeFilteringType_REGEX" name="nodeFilteringType"
                               value="${FIELD_FILTER_REGEX}" class="jenkins-radio__input"
                               onchange="fieldFilterTypeSelected(this.value, '#{buildStatId}_nodeNameRegex', '#{buildStatId}_nodeFilter');"/>
    ----
    
    == Inline Event Handler
    Line: 215
    ----
    <input type="text" id="#{buildStatId}_nodeNameRegex" class="jenkins-input"
                             disabled="true" name="nodeNameRegex" size="10"
                             onblur="document.getElementById('#{buildStatId}_nodeFilter').value=FIELD_FILTER_REGEX+'('+this.value+')';"/>
    ----
    
    == Inline Event Handler
    Line: 223
    ----
    <input type="radio" id="#{buildStatId}_launcherFilteringType_ALL" checked="checked" name="launcherFilteringType"
                               value="${FIELD_FILTER_ALL}" class="jenkins-radio__input"
                               onchange="fieldFilterTypeSelected(this.value, '#{buildStatId}_launcherNameRegex', '#{buildStatId}_launcherFilter');"/>
    ----
    
    == Inline Event Handler
    Line: 229
    ----
    <input type="radio" id="#{buildStatId}_launcherFilteringType_REGEXSYSTEM" name="launcherFilteringType"
                               value="${LAUNCHER_SYSTEM_REGEX}" class="jenkins-radio__input"
                               onchange="fieldFilterTypeSelected(this.value, '#{buildStatId}_launcherNameRegex', '#{buildStatId}_launcherFilter');"/>
    ----
    
    == Inline Event Handler
    Line: 235
    ----
    <input type="radio" id="#{buildStatId}_launcherFilteringType_REGEX" name="launcherFilteringType"
                               value="${FIELD_FILTER_REGEX}" class="jenkins-radio__input"
                               onchange="fieldFilterTypeSelected(this.value, '#{buildStatId}_launcherNameRegex', '#{buildStatId}_launcherFilter');"/>
    ----
    
    == Inline Event Handler
    Line: 240
    ----
    <input type="text" id="#{buildStatId}_launcherNameRegex" class="jenkins-input"
                             disabled="true" name="launcherNameRegex" size="10"
                             onblur="document.getElementById('#{buildStatId}_launcherFilter').value=FIELD_FILTER_REGEX+'('+this.value+')';"/>
    ----
    
    == Inline Event Handler
    Line: 260
    ----
    <select id="#{buildStatId}_yAxisChartType" class="jenkins-select__input"
                                name="yAxisChartType" checkUrl="'${rootURL}/plugin/global-build-stats/checkYAxisChartType?value='+escape(field.value)"
                                onchange="validateField(this);">
    ----
    
    == Inline Event Handler
    Line: 287
    ----
    <a href="#" onclick="new BuildStatConfigForm(null).displayBuildStatConfigForm();">
    ----
    
    == Inline Event Handler
    Line: 325
    ----
    <a href="#" onclick="window.location.href = ''; return false;">
    ----
    
    == Inline Event Handler
    Line: 329
    ----
    <button type="button" class="jenkins-button" onclick="initializeStats();">
    ----
    
    == Legacy checkUrl
    Line: 129
    ----
    checkUrl="'${rootURL}/plugin/global-build-stats/checkTitle?value='+escape(field.value)"
    ----
    
    == Legacy checkUrl
    Line: 138
    ----
    checkUrl="'${rootURL}/plugin/global-build-stats/checkBuildStatWidth?value='+escape(field.value)"
    ----
    
    == Legacy checkUrl
    Line: 146
    ----
    checkUrl="'${rootURL}/plugin/global-build-stats/checkBuildStatHeight?value='+escape(field.value)"
    ----
    
    == Legacy checkUrl
    Line: 155
    ----
    checkUrl="'${rootURL}/plugin/global-build-stats/checkHistoricScale?value='+escape(field.value)"
    ----
    
    == Legacy checkUrl
    Line: 166
    ----
    checkUrl="'${rootURL}/plugin/global-build-stats/checkHistoricLength?value='+escape(field.value)"
    ----
    
    == Legacy checkUrl
    Line: 261
    ----
    checkUrl="'${rootURL}/plugin/global-build-stats/checkYAxisChartType?value='+escape(field.value)"
    ----
    
    == Inline Script Block
    Line: 26
    ----
    <script type="text/javascript"><![CDATA[
            BUILD_STAT_CONTAINER_ID_PREFIX = "container_buildStatConfig_";
            var CURRENT_FORM = null;
    
            // Called after button "initialize stats" is clicked
            function initializeStats(){
              ajaxCall('link', 'recordBuildInfos', function(transport) {
                document.getElementById('initializeStatsMessage').style.display = "inline";
              });
            }
    
    
            var BUILD_STAT_CONFIGS = new BuildStatConfigs();
            window.addEventListener('load', function(){
              ajaxCall('link', rootURL+'/plugin/global-build-stats/api/json?depth=2', function(ret) {
                var buildStat = eval('('+ret.responseText+')');
                for(i=0; i<buildStat.buildStatConfigs.length; i++){
                  var config = buildStat.buildStatConfigs[i];
                  BUILD_STAT_CONFIGS.add(config);
                }
              });
            });
            ]]></script>
    ----
    
    == Inline Script Block
    Line: 49
    ----
    <script type="text/javascript">
            CHART_LENGTH_UNITS = new Array();
            <j:forEach var="historicScale" items="${it.historicScales}" varStatus="status">
              CHART_LENGTH_UNITS[${status.index}] = "${historicScale}";
            </j:forEach>
            FIELD_FILTER_ALL = "${FIELD_FILTER_ALL}";
            FIELD_FILTER_REGEX = "${FIELD_FILTER_REGEX}";
            LAUNCHER_SYSTEM_REGEX = "${LAUNCHER_SYSTEM_REGEX}";
            NODE_MASTER_REGEX = "${NODE_MASTER_REGEX}";
          </script>
    ----
    
    == Inline Event Handler
    Line: 13
    ----
    <l:task icon="symbol-bar-chart-outline plugin-ionicons-api" href="#"
                    onclick="new BuildStatConfigForm(null).displayBuildStatConfigForm(); return false;" title="${%Create new chart}"/>
    ----
    
    == Inline Event Handler
    Line: 90
    ----
    <button id="edit_#{id}" onclick="new BuildStatConfigForm('#{id}').displayBuildStatConfigForm();"
                        class="jenkins-button jenkins-button--tertiary">
    ----
    
    == Inline Event Handler
    Line: 94
    ----
    <button onclick="BUILD_STAT_CONFIGS.moveBuildStat('#{id}', 'up');" id="moveUp_#{id}" class="jenkins-button jenkins-button--tertiary">
    ----
    
    == Inline Event Handler
    Line: 97
    ----
    <button onclick="BUILD_STAT_CONFIGS.moveBuildStat('#{id}', 'down');" id="moveDown_#{id}" class="jenkins-button jenkins-button--tertiary">
    ----
    
    == Inline Event Handler
    Line: 100
    ----
    <button onclick="deleteBuildStat('#{id}');" class="jenkins-button jenkins-button--tertiary">
    ----
    
    == Inline Event Handler
    Line: 121
    ----
    <form name="createBuildStat_#{buildStatId}" action="#{formAction}" method="post" class="globalBuildStatsForm"
                    id="createBuildStat_#{buildStatId}" onsubmit="return !isDivErrorPresentInForm(this);">
    ----
    
    == Inline Event Handler
    Line: 127
    ----
    <input type="text" id="#{buildStatId}_title" name="title"
                           value="#{buildStatTitle}" class="jenkins-input"
                           checkUrl="'${rootURL}/plugin/global-build-stats/checkTitle?value='+escape(field.value)"
                           onblur="validateField(this);" onchange="validateField(this);"
                    />
    ----
    
    == Inline Event Handler
    Line: 136
    ----
    <input type="number" id="#{buildStatId}_buildStatWidth" name="buildStatWidth"
                           size="3" value="#{buildStatWidth}" class="jenkins-input" min="100"
                           checkUrl="'${rootURL}/plugin/global-build-stats/checkBuildStatWidth?value='+escape(field.value)"
                           onblur="validateField(this);" onchange="validateField(this);"
                    />
    ----
    
    == Inline Event Handler
    Line: 144
    ----
    <input type="number" id="#{buildStatId}_buildStatHeight" name="buildStatHeight"
                           size="3" value="#{buildStatHeight}" class="jenkins-input" min="100"
                           checkUrl="'${rootURL}/plugin/global-build-stats/checkBuildStatHeight?value='+escape(field.value)"
                           onblur="validateField(this);" onchange="validateField(this);"
                    />
    ----
    
    == Inline Event Handler
    Line: 154
    ----
    <select id="#{buildStatId}_historicScale" class="jenkins-select__input"
                              name="historicScale" checkUrl="'${rootURL}/plugin/global-build-stats/checkHistoricScale?value='+escape(field.value)"
                              onchange="validateField(this); CURRENT_FORM.changeChartLengthUnit(this.value);">
    ----
    
    == Inline Event Handler
    Line: 164
    ----
    <input type="number" id="#{buildStatId}_historicLength" name="historicLength"
                           size="3" value="#{historicLength}" class="jenkins-input"
                           checkUrl="'${rootURL}/plugin/global-build-stats/checkHistoricLength?value='+escape(field.value)"
                           onblur="validateField(this);" onchange="validateField(this);"
                    />
    ----
    
    == Inline Event Handler
    Line: 179
    ----
    <input type="radio" id="#{buildStatId}_jobFilteringType_ALL" checked="checked" name="jobFilteringType"
                               value="${FIELD_FILTER_ALL}" class="jenkins-radio__input"
                               onchange="fieldFilterTypeSelected(this.value, '#{buildStatId}_jobNameRegex', '#{buildStatId}_jobFilter');"/>
    ----
    
    == Inline Event Handler
    Line: 185
    ----
    <input type="radio" id="#{buildStatId}_jobFilteringType_REGEX" name="jobFilteringType"
                               value="${FIELD_FILTER_REGEX}" class="jenkins-radio__input"
                               onchange="fieldFilterTypeSelected(this.value, '#{buildStatId}_jobNameRegex', '#{buildStatId}_jobFilter');"/>
    ----
    
    == Inline Event Handler
    Line: 190
    ----
    <input type="text" id="#{buildStatId}_jobNameRegex" class="jenkins-input"
                             disabled="true" name="jobNameRegex" size="10"
                             onblur="document.getElementById('#{buildStatId}_jobFilter').value=FIELD_FILTER_REGEX+'('+this.value+')';"/>
    ----
    
    == Inline Event Handler
    Line: 198
    ----
    <input type="radio" id="#{buildStatId}_nodeFilteringType_ALL" checked="checked" name="nodeFilteringType"
                               value="${FIELD_FILTER_ALL}" class="jenkins-radio__input"
                               onchange="fieldFilterTypeSelected(this.value, '#{buildStatId}_nodeNameRegex', '#{buildStatId}_nodeFilter');"/>
    ----
    
    == Inline Event Handler
    Line: 204
    ----
    <input type="radio" id="#{buildStatId}_nodeFilteringType_REGEXMASTER" name="nodeFilteringType"
                               value="${NODE_MASTER_REGEX}" class="jenkins-radio__input"
                               onchange="fieldFilterTypeSelected(this.value, '#{buildStatId}_nodeNameRegex', '#{buildStatId}_nodeFilter');"/>
    ----
    
    == Inline Event Handler
    Line: 210
    ----
    <input type="radio" id="#{buildStatId}_nodeFilteringType_REGEX" name="nodeFilteringType"
                               value="${FIELD_FILTER_REGEX}" class="jenkins-radio__input"
                               onchange="fieldFilterTypeSelected(this.value, '#{buildStatId}_nodeNameRegex', '#{buildStatId}_nodeFilter');"/>
    ----
    
    == Inline Event Handler
    Line: 215
    ----
    <input type="text" id="#{buildStatId}_nodeNameRegex" class="jenkins-input"
                             disabled="true" name="nodeNameRegex" size="10"
                             onblur="document.getElementById('#{buildStatId}_nodeFilter').value=FIELD_FILTER_REGEX+'('+this.value+')';"/>
    ----
    
    == Inline Event Handler
    Line: 223
    ----
    <input type="radio" id="#{buildStatId}_launcherFilteringType_ALL" checked="checked" name="launcherFilteringType"
                               value="${FIELD_FILTER_ALL}" class="jenkins-radio__input"
                               onchange="fieldFilterTypeSelected(this.value, '#{buildStatId}_launcherNameRegex', '#{buildStatId}_launcherFilter');"/>
    ----
    
    == Inline Event Handler
    Line: 229
    ----
    <input type="radio" id="#{buildStatId}_launcherFilteringType_REGEXSYSTEM" name="launcherFilteringType"
                               value="${LAUNCHER_SYSTEM_REGEX}" class="jenkins-radio__input"
                               onchange="fieldFilterTypeSelected(this.value, '#{buildStatId}_launcherNameRegex', '#{buildStatId}_launcherFilter');"/>
    ----
    
    == Inline Event Handler
    Line: 235
    ----
    <input type="radio" id="#{buildStatId}_launcherFilteringType_REGEX" name="launcherFilteringType"
                               value="${FIELD_FILTER_REGEX}" class="jenkins-radio__input"
                               onchange="fieldFilterTypeSelected(this.value, '#{buildStatId}_launcherNameRegex', '#{buildStatId}_launcherFilter');"/>
    ----
    
    == Inline Event Handler
    Line: 240
    ----
    <input type="text" id="#{buildStatId}_launcherNameRegex" class="jenkins-input"
                             disabled="true" name="launcherNameRegex" size="10"
                             onblur="document.getElementById('#{buildStatId}_launcherFilter').value=FIELD_FILTER_REGEX+'('+this.value+')';"/>
    ----
    
    == Inline Event Handler
    Line: 260
    ----
    <select id="#{buildStatId}_yAxisChartType" class="jenkins-select__input"
                                name="yAxisChartType" checkUrl="'${rootURL}/plugin/global-build-stats/checkYAxisChartType?value='+escape(field.value)"
                                onchange="validateField(this);">
    ----
    
    == Inline Event Handler
    Line: 287
    ----
    <a href="#" onclick="new BuildStatConfigForm(null).displayBuildStatConfigForm();">
    ----
    
    == Inline Event Handler
    Line: 325
    ----
    <a href="#" onclick="window.location.href = ''; return false;">
    ----
    
    == Inline Event Handler
    Line: 329
    ----
    <button type="button" class="jenkins-button" onclick="initializeStats();">
    ----
    

    Solutions

    https://www.jenkins.io/doc/developer/security/csp/#inline-javascript-blocks
    https://www.jenkins.io/doc/developer/security/csp/#inline-event-handlers
    https://www.jenkins.io/doc/developer/security/csp/#legacy-javascript-checkurl-validation

          Assignee:
          Markus Winter
          Reporter:
          Basil Crow
          Votes:
          0 Vote for this issue
          Watchers:
          1 Start watching this issue

            Created:
            Updated:
            Resolved: