-
-
Notifications
You must be signed in to change notification settings - Fork 8.8k
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
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 callingmakeStaplerProxy
to bind objects to JS:st:bind
emitted ascript
tag with inline script that assigns the result ofmakeStaplerProxy
to 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.jelly
added themakeStaplerProxy
call 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:bind
now emitsscript
tags withsrc
. Stapler has been improved to have a separate URL that provides the previously inline script standalone.renderOnDemand
now adds HTML attributes for the function name and its argument values, which are then read inhudson-behavior.js
and used to invoke the specified method with the correct arguments.Testing notes
st:bind
is used in core byprogressiveRendering
, which is used by the "Build History" view.renderOnDemand
is 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 entries
section only if there are breaking changes or other changes which may require extra steps from users during the upgrade@Restricted
or have@since TODO
Javadoc, 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 entries
are accurate, human-readable, and in the imperative moodupgrade-guide-needed
label is set and there is aProposed upgrade guidelines
section in the PR title. (example)lts-candidate
to be considered (see query).