-
Task
-
Resolution: Unresolved
-
Minor
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
[JENKINS-74525] [global-yaml-properties] Extract inline script block and migrate legacy checkUrl attribute in io/jenkins/plugins/globalyamlproperties/ConfigurationManagementLink/index.jelly
Assignee | Original: Vladyslav Kovalov [ vladyslav_kovalov ] |
Description |
Original:
h4. Problems {noformat} == 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)" ---- == 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)" ---- {noformat} h4. Solutions [https://www.jenkins.io/doc/developer/security/csp/#inline-javascript-blocks] [https://www.jenkins.io/doc/developer/security/csp/#legacy-javascript-checkurl-validation] |
New:
h4. Problems {noformat} == 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)" ---- {noformat} h4. Solutions [https://www.jenkins.io/doc/developer/security/csp/#inline-javascript-blocks] [https://www.jenkins.io/doc/developer/security/csp/#legacy-javascript-checkurl-validation] |
Summary | Original: [global-yaml-properties] Extract inline script blocks and migrate legacy checkUrl attributes in io/jenkins/plugins/globalyamlproperties/ConfigurationManagementLink/index.jelly | New: [global-yaml-properties] Extract inline script block and migrate legacy checkUrl attribute in io/jenkins/plugins/globalyamlproperties/ConfigurationManagementLink/index.jelly |