[JENKINS-60866][JENKINS-71513] Apply Stapler update for CSP-compliant st:bind and renderOnDemand - #6865
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
|
Looks like the default branch of Stapler with a bunch of unreleased commits (for incrementals) is incompatible with core. Nice. |
@daniel-beck Why would it be “nice”? Your sarcasm is not appreciated. The corresponding changes have been ready for review in #6801 for 9 days. |
|
Please take a moment and address the merge conflicts of your pull request. Thanks! |
|
Please take a moment and address the merge conflicts of your pull request. Thanks! |
|
I plan to merge the upstream change and finalize the |
| let proxyMethod = e.getAttribute("data-proxy-method"); | ||
| let proxyUrl = e.getAttribute("data-proxy-url"); | ||
| let proxyCrumb = e.getAttribute("data-proxy-crumb"); | ||
| let proxyUrlNames = e.getAttribute("data-proxy-url-names").split(","); |
There was a problem hiding this comment.
shouldn't these be const?
| let proxyMethod = e.getAttribute("data-proxy-method"); | |
| let proxyUrl = e.getAttribute("data-proxy-url"); | |
| let proxyCrumb = e.getAttribute("data-proxy-crumb"); | |
| let proxyUrlNames = e.getAttribute("data-proxy-url-names").split(","); | |
| const proxyMethod = e.getAttribute("data-proxy-method"); | |
| const proxyUrl = e.getAttribute("data-proxy-url"); | |
| const proxyCrumb = e.getAttribute("data-proxy-crumb"); | |
| const proxyUrlNames = e.getAttribute("data-proxy-url-names").split(","); |
|
|
||
| @Override | ||
| public String getUrlName() { | ||
| return "theWellKnownRoot"; |
There was a problem hiding this comment.
Not a very realistic example of course, because it is a singleton (the point of WithWellKnownURL would be to look up a specific object based on parsing out a path), but good enough for purposes of tests here I suppose.
There was a problem hiding this comment.
Given that this is the only implementation of WithWellKnownURL, we'll survive — if it weren't for your comments recently in the context of session serialization, I might have ripped it out entirely.
(Yes, there's another one in CloudBees, but it's long dead.)
|
/label ready-for-merge This PR is now ready for merge, after ~24 hours, we will merge it if there's no negative feedback. Thanks! |
See JENKINS-60866.
Downstream of jenkinsci/stapler#385
This takes care of two different previously inline or
eval'ed JS snippets that ended up callingmakeStaplerProxyto bind objects to JS:st:bindemitted ascripttag with inline script that assigns the result ofmakeStaplerProxyto a variable (if used with a variable name -- the other mode cannot be fixed, as it's intended for nesting in an inline script).renderOnDemand.jellyadded themakeStaplerProxycall it needed to an HTML attribute, latereval'ing it injenkins/war/src/main/webapp/scripts/hudson-behavior.js
Line 793 in d977ee8
This PR changes Stapler and Jenkins to no longer need either:
st:bindnow emitsscripttags withsrc. Stapler has been improved to have a separate URL that provides the previously inline script standalone.renderOnDemandnow adds HTML attributes for the function name and its argument values, which are then read inhudson-behavior.jsand used to invoke the specified method with the correct arguments.Testing notes
st:bindis used in core byprogressiveRendering, which is used by the "Build History" view.renderOnDemandis used whenever a form has nontrivial dynamic content (e.g. adding build steps to a freestyle job, or the configuration of a security realm, authorization strategy, or markup formatter after selecting the type in a dropdown box.Proposed changelog entries
Proposed upgrade guidelines
N/A
Submitter checklist
Proposed changelog entriessection only if there are breaking changes or other changes which may require extra steps from users during the upgrade@Restrictedor have@since TODOJavadoc, as appropriate.@Deprecated(since = "TODO")or@Deprecated(forRemoval = true, since = "TODO")if applicable.Desired reviewers
@mention
Maintainer checklist
Before the changes are marked as
ready-for-merge:Proposed changelog entriesare accurate, human-readable, and in the imperative moodupgrade-guide-neededlabel is set and there is aProposed upgrade guidelinessection in the PR title. (example)lts-candidateto be considered (see query).