mirror of
https://github.com/jenkinsci/jenkins.git
synced 2026-11-16 21:42:27 +00:00
Small tidy up for the Tools page (#7716)
* Init * Update global.jelly * Update config.jelly * Restore top button * Change form-label to section__title * Add comment suggestion by daniel-beck Co-authored-by: Daniel Beck <1831569+daniel-beck@users.noreply.github.com> * Remove test * Update HeteroListTest.java --------- Co-authored-by: Daniel Beck <1831569+daniel-beck@users.noreply.github.com>
This commit is contained in:
1 parent
0ace6141c6
commit
5ea8cf2fa5
7 files changed
+16
-58
No files matched your search
@@ -23,13 +23,14 @@ THE SOFTWARE.
|
||||
-->
|
||||
<?jelly escape-by-default='true'?>
|
||||
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form" xmlns:local="local">
|
||||
<f:section title="${descriptor.displayName}">
|
||||
<f:section title="${%title(descriptor.displayName)}">
|
||||
<d:taglib uri="local">
|
||||
<d:tag name="section">
|
||||
<!-- While there's no longer a title/description for f:entry at the top level, keep this around for f:entries in tool config pages to be safe -->
|
||||
<j:set var="escapeEntryTitleAndDescription" value="true"/>
|
||||
<f:entry title="${%title(descriptor.displayName)}" description="${%description(descriptor.displayName)}">
|
||||
<f:repeatable name="tool" var="instance" items="${descriptor.installations}"
|
||||
add="${%label.add(descriptor.displayName)}" header="${descriptor.displayName}" enableTopButton="true"
|
||||
<f:entry>
|
||||
<f:repeatable name="tool" var="instance" items="${descriptor.installations}" enableTopButton="true"
|
||||
add="${%label.add(descriptor.displayName)}" header="${descriptor.displayName}"
|
||||
noAddButton="${readOnlyMode ? 'true' : null}"
|
||||
>
|
||||
<j:set var="toolDescriptor" value="${descriptor}" /><!-- to make this descriptor accessible from properties -->
|
||||
@@ -37,11 +38,7 @@ THE SOFTWARE.
|
||||
<st:include page="config.jelly" from="${descriptor}" class="${descriptor.clazz}"/>
|
||||
<f:descriptorList descriptors="${descriptor.propertyDescriptors}" field="properties"/>
|
||||
<l:isAdmin>
|
||||
<f:entry title="">
|
||||
<div align="right">
|
||||
<f:repeatableDeleteButton value="${%label.delete(descriptor.displayName)}"/>
|
||||
</div>
|
||||
</f:entry>
|
||||
<f:repeatableDeleteButton value="${%label.delete(descriptor.displayName)}"/>
|
||||
</l:isAdmin>
|
||||
</div>
|
||||
</f:repeatable>
|
||||
|
||||
@@ -56,7 +56,7 @@ THE SOFTWARE.
|
||||
<j:forEach var="descriptor" items="${h.getSortedDescriptorsForGlobalConfigUnclassifiedReadable()}">
|
||||
<j:set var="readOnlyMode" value="${!editable.contains(descriptor)}" />
|
||||
<j:set var="instance" value="${descriptor}" /><!-- this makes the <f:textbox field=.../> work -->
|
||||
<f:rowSet name="${descriptor.jsonSafeClassName}" isFormItem="false">
|
||||
<f:rowSet name="${descriptor.jsonSafeClassName}">
|
||||
<st:include page="${descriptor.globalConfigPage}" from="${descriptor}" />
|
||||
</f:rowSet>
|
||||
</j:forEach>
|
||||
|
||||
+2
-2
@@ -35,7 +35,7 @@ THE SOFTWARE.
|
||||
</div>
|
||||
</j:if>
|
||||
<j:if test="${!empty(flagConfigs)}">
|
||||
<f:rowSet name="flags" isFormItem="false">
|
||||
<f:rowSet name="flags">
|
||||
<table class="jenkins-table sortable">
|
||||
<thead>
|
||||
<tr>
|
||||
@@ -64,4 +64,4 @@ THE SOFTWARE.
|
||||
</f:rowSet>
|
||||
</j:if>
|
||||
</f:entry>
|
||||
</j:jelly>
|
||||
</j:jelly>
|
||||
@@ -20,7 +20,7 @@ l.layout(permission:app.SYSTEM_READ, title:my.displayName, type:"one-column") {
|
||||
Functions.getSortedDescriptorsForGlobalConfigByDescriptor(my.FILTER).each { Descriptor descriptor ->
|
||||
set("descriptor",descriptor)
|
||||
set("instance",descriptor)
|
||||
f.rowSet(name:descriptor.jsonSafeClassName, class: "jenkins-!-margin-bottom-0") {
|
||||
f.rowSet(name:descriptor.jsonSafeClassName) {
|
||||
st.include(from:descriptor, page:descriptor.globalConfigPage)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,12 +35,6 @@ THE SOFTWARE.
|
||||
<st:attribute name="ref">
|
||||
id of the thing that serves as the group head, if that's available separately
|
||||
</st:attribute>
|
||||
<st:attribute name="isFormItem">
|
||||
Removes the "jenkins-form-item" class if false
|
||||
</st:attribute>
|
||||
<st:attribute name="class">
|
||||
Classes to apply to the container (this will be the form item if 'isFormItem' is true)
|
||||
</st:attribute>
|
||||
</st:documentation>
|
||||
|
||||
<j:set var="contents" trim="true">
|
||||
@@ -53,11 +47,9 @@ THE SOFTWARE.
|
||||
</j:when>
|
||||
<j:otherwise>
|
||||
<j:if test="${contents.length() != 0}">
|
||||
<div class="${isFormItem.equals('false') ? '' : 'jenkins-form-item'} ${attrs.class}">
|
||||
<div ref="${attrs.ref}" class="row-set-start row-group-start tr" style="display:none" name="${attrs.name}"></div>
|
||||
<j:out value="${contents}" />
|
||||
<div class="row-set-end row-group-end tr"></div>
|
||||
</div>
|
||||
<div ref="${attrs.ref}" class="row-set-start row-group-start tr" style="display:none" name="${attrs.name}"></div>
|
||||
<j:out value="${contents}" />
|
||||
<div class="row-set-end row-group-end tr jenkins-!-display-contents"></div>
|
||||
</j:if>
|
||||
</j:otherwise>
|
||||
</j:choose>
|
||||
|
||||
@@ -27,7 +27,7 @@ THE SOFTWARE.
|
||||
<st:documentation>
|
||||
Section header in the form table.
|
||||
|
||||
<st:attribute name="title" use="required"> <![CDATA[
|
||||
<st:attribute name="title"> <![CDATA[
|
||||
The section header text.
|
||||
If null is given, the entire <f:section> tag becomes no-op.
|
||||
]]>
|
||||
@@ -43,7 +43,7 @@ THE SOFTWARE.
|
||||
<st:adjunct includes="lib.form.section_" />
|
||||
|
||||
<f:rowSet name="${attrs.name}">
|
||||
<div class="${attrs.title!=null ? 'jenkins-section' : ''}">
|
||||
<section class="${attrs.title!=null ? 'jenkins-section' : ''}">
|
||||
<j:if test="${attrs.title!=null}">
|
||||
<div class="jenkins-section__title">
|
||||
<div class="jenkins-hidden">
|
||||
@@ -53,6 +53,6 @@ THE SOFTWARE.
|
||||
</div>
|
||||
</j:if>
|
||||
<d:invokeBody />
|
||||
</div>
|
||||
</section>
|
||||
</f:rowSet>
|
||||
</j:jelly>
|
||||
@@ -28,7 +28,6 @@ import static org.hamcrest.CoreMatchers.containsString;
|
||||
import static org.hamcrest.CoreMatchers.instanceOf;
|
||||
import static org.hamcrest.CoreMatchers.not;
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import com.gargoylesoftware.htmlunit.html.DomElement;
|
||||
@@ -51,7 +50,6 @@ import java.io.File;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import net.sourceforge.htmlunit.corejs.javascript.NativeArray;
|
||||
import org.jenkinsci.Symbol;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
@@ -84,35 +82,6 @@ public class HeteroListTest {
|
||||
assertThat(menuItemContent, not(containsString("<")));
|
||||
}
|
||||
|
||||
// correspond to the hardening of escapeEntryTitleAndDescription
|
||||
@Test
|
||||
@Issue("SECURITY-2035")
|
||||
public void xssPrevented_usingToolInstallation_withJustDisplayName() throws Exception {
|
||||
JenkinsRule.WebClient wc = j.createWebClient();
|
||||
|
||||
HtmlPage page = wc.goTo("configureTools/");
|
||||
|
||||
// check the displayName
|
||||
Object resultDN = page.executeJavaScript(
|
||||
"var settingFields = document.querySelectorAll('.jenkins-form-label');" +
|
||||
"var children = Array.from(settingFields).filter(b => b.textContent.indexOf('XSS:') !== -1)[0].children;" +
|
||||
"Array.from(children).filter(c => c.tagName === 'IMG')"
|
||||
).getJavaScriptResult();
|
||||
assertThat(resultDN, instanceOf(NativeArray.class));
|
||||
NativeArray resultDNNA = (NativeArray) resultDN;
|
||||
assertEquals(0, resultDNNA.size());
|
||||
|
||||
// check the description
|
||||
Object resultDesc = page.executeJavaScript(
|
||||
"var settingFields = document.querySelectorAll('.jenkins-form-description');" +
|
||||
"var children = Array.from(settingFields).filter(b => b.textContent.indexOf('XSS:') !== -1)[0].children;" +
|
||||
"Array.from(children).filter(c => c.tagName === 'IMG')"
|
||||
).getJavaScriptResult();
|
||||
assertThat(resultDesc, instanceOf(NativeArray.class));
|
||||
NativeArray resultDescNA = (NativeArray) resultDesc;
|
||||
assertEquals(0, resultDescNA.size());
|
||||
}
|
||||
|
||||
@Test
|
||||
@Issue("SECURITY-2035")
|
||||
public void xssPrevented_usingToolInstallation_repeatableAddExisting() throws Exception {
|
||||
|
||||
Reference in new issue
Block a user