Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[JENKINS-60866][JENKINS-71513] Apply Stapler update for CSP-compliant st:bind and renderOnDemand #6865

Merged
merged 24 commits into from
Feb 24, 2024
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
645beac
[JENKINS-60866] Apply Stapler update for CSP-compliant st:bind
daniel-beck Jul 16, 2022
fbb392e
[JENKINS-60866] Make renderOnDemand CSP-compliant
daniel-beck Jul 17, 2022
9f675a4
Thanks Spotless
daniel-beck Jul 17, 2022
60051b4
Make Stapler incrementals work
daniel-beck Jul 17, 2022
ffd7c36
Update Stapler to new incremental
daniel-beck Aug 3, 2022
2debadf
Merge branch 'master' into csp-bind
daniel-beck Aug 3, 2022
c2f5ae2
Merge remote-tracking branch 'origin/master' into csp-bind
basil Aug 26, 2022
269ac92
Merge remote-tracking branch 'jenkinsci/master' into csp-bind
daniel-beck Aug 11, 2023
bd50766
Fixup bad merge
daniel-beck Aug 11, 2023
ced608e
Update Stapler, add test demonstrating st:bind working
daniel-beck Aug 15, 2023
b076c02
Address review feedback
daniel-beck Aug 16, 2023
f5c7a84
Add test for null bind, update Stapler
daniel-beck Aug 21, 2023
1e32e73
Merge branch 'master' into csp-bind
daniel-beck Aug 21, 2023
89271e7
Checkstyle
daniel-beck Aug 21, 2023
1ff5257
More tests
daniel-beck Aug 22, 2023
e778bc4
Merge branch 'master' into csp-bind
daniel-beck Sep 25, 2023
3195579
Merge branch 'master' into csp-bind
daniel-beck Sep 26, 2023
5eef5a6
Merge remote-tracking branch 'jenkinsci/master' into csp-bind
daniel-beck Oct 12, 2023
d2ab58d
Merge branch 'master' into csp-bind
daniel-beck Oct 26, 2023
844cac1
Merge branch 'master' into csp-bind
daniel-beck Nov 1, 2023
dfe2e0d
Merge commit '09905a09d95026dcd20634ed48e810b209ce46da' into csp-bind
daniel-beck Feb 12, 2024
afb4593
Merge remote-tracking branch 'origin/csp-bind' into csp-bind
daniel-beck Feb 12, 2024
a3b14ad
Merge remote-tracking branch 'jenkinsci/master' into csp-bind
daniel-beck Feb 12, 2024
dd8a075
Use released Stapler
daniel-beck Feb 14, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion bom/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ THE SOFTWARE.
<properties>
<asm.version>9.5</asm.version>
<slf4jVersion>2.0.7</slf4jVersion>
<stapler.version>1802.v9e2750160d01</stapler.version>
<!-- TODO https://github.com/jenkinsci/stapler/pull/385 -->
<stapler.version>1819.v7d73b_0b_a_cc5b_</stapler.version>
<groovy.version>2.4.21</groovy.version>
</properties>

Expand Down
7 changes: 7 additions & 0 deletions core/src/main/java/hudson/Functions.java
Original file line number Diff line number Diff line change
Expand Up @@ -2227,6 +2227,13 @@ public static String createRenderOnDemandProxy(JellyContext context, String attr
return Stapler.getCurrentRequest().createJavaScriptProxy(new RenderOnDemandClosure(context, attributesToCapture));
}

/**
* @since TODO
*/
public static StaplerRequest.RenderOnDemandParameters createRenderOnDemandProxyParameters(JellyContext context, String attributesToCapture) {
return Stapler.getCurrentRequest().createJavaScriptProxyParameters(new RenderOnDemandClosure(context, attributesToCapture));
}

public static String getCurrentDescriptorByNameUrl() {
return Descriptor.getCurrentDescriptorByNameUrl();
}
Expand Down
6 changes: 5 additions & 1 deletion core/src/main/resources/lib/layout/renderOnDemand.jelly
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,12 @@ THE SOFTWARE.
</st:attribute>
</st:documentation>

<j:set var="parameters" value="${h.createRenderOnDemandProxyParameters(context,attrs.capture)}"/>
<x:element name="${attrs.tag?:'div'}">
<x:attribute name="class">render-on-demand ${attrs.clazz}</x:attribute>
<x:attribute name="proxy">${h.createRenderOnDemandProxy(context,attrs.capture)}</x:attribute>
<x:attribute name="data-proxy-method">${parameters.proxyMethod}</x:attribute>
<x:attribute name="data-proxy-url">${parameters.url}</x:attribute>
<x:attribute name="data-proxy-crumb">${parameters.crumb}</x:attribute>
<x:attribute name="data-proxy-args">${parameters.methodsString}</x:attribute>
</x:element>
</j:jelly>
8 changes: 7 additions & 1 deletion war/src/main/webapp/scripts/hudson-behavior.js
Original file line number Diff line number Diff line change
Expand Up @@ -1001,7 +1001,13 @@ function renderOnDemand(e, callback, noBehaviour) {
if (!e || !e.classList.contains("render-on-demand")) {
return;
}
var proxy = eval(e.getAttribute("proxy"));

let proxyMethod = e.getAttribute("data-proxy-method");
let proxyUrl = e.getAttribute("data-proxy-url");
let proxyCrumb = e.getAttribute("data-proxy-crumb");
let proxyMethods = e.getAttribute("data-proxy-args").split(",");

var proxy = window[proxyMethod](proxyUrl, proxyCrumb, proxyMethods);
proxy.render(function (t) {
var contextTagName = e.parentNode.tagName;
var c;
Expand Down