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

[release] Extract inline script block and event handler in hudson/plugins/release/pipeline/ReleaseStep/config.jelly

XMLWordPrintable

    • Icon: Task Task
    • Resolution: Unresolved
    • Icon: Minor Minor
    • release-plugin

      Problems

      == Inline Script Block
      Line: 34
      ----
      <script>
                  function loadParams() {
                      const div = document.getElementById('params');
                      const parametersTextBox = document.getElementById('${jobFieldId}')
      
                      const url = '${descriptor.descriptorUrl}/parameters?job=' + encodeURIComponent(parametersTextBox.value) + '&amp;context=' + encodeURIComponent('${descriptor.context}')
                      fetch(url)
                          .then(rsp => {
                              if (rsp.ok) {
                                  rsp.text().then(responseText => {
                                      div.innerHTML = responseText;
                                      Behaviour.applySubtree(div);
                                  })
                              } else {
                                  div.innerHTML = "<b>ERROR</b>: Failed to load parameter definitions: " + rsp.statusText;
                              }
                          })
                  }
              </script>
      ----
      
      == Inline Event Handler
      Line: 30
      ----
      <f:textbox onblur="loadParams()" id="${jobFieldId}"/>
      ----
      

      Solutions

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

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

              Created:
              Updated: