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

[global-yaml-properties] Extract inline script block and migrate legacy checkUrl attribute in io/jenkins/plugins/globalyamlproperties/ConfigurationManagementLink/index.jelly

XMLWordPrintable

      Problems

      == Inline Script Block
      Line: 37
      ----
      <script type="text/javascript">
                      document.addEventListener("DOMContentLoaded", function() {
                      // Attach event listener to parent element
                      var formElement = document.querySelector('form[name="configs"]');
      
                      // If any "error" div elements are found, prevent form submission
                      formElement.addEventListener('submit', function(event) {
                      var errorDivs = formElement.querySelectorAll('div.error');
                      if (errorDivs.length > 0) {
                      event.preventDefault();
                      alert('Form validation failed. Please correct the errors and try again.');
                      }
                      });
      
                      // Process readonly logic for textareas with CodeMirror
                      formElement.addEventListener('change', function(e) {
                      if (e.target.name === 'enableReadOnly') {
                      var checkbox = e.target;
                      var closestBlock = checkbox.closest('.tbody.dropdownList-container');
      
                      var textarea = closestBlock.querySelector('textarea[name="yamlConfig"]');
                      if (textarea.hasAttribute('readonly')) {
                          textarea.removeAttribute('readonly');
                      } else {
                          textarea.setAttribute('readonly', 'readonly');
                          }
                      }
                      });
                      });
                  </script>
      ----
      
      == Legacy checkUrl
      Line: 21
      ----
      checkUrl="'checkName?value='+escape(this.value)"
      ----
      

      Solutions

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

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

              Created:
              Updated: