[JENKINS-74891] Extract inline JavaScript from EmailExtTemplateAction/index.groovy
#569
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
https://issues.jenkins.io/browse/JENKINS-74891
There's still a problem with the mechanism that renders the template. It's rendered inside an
iframe
element. Default CSP header that's set by Content Security Policy does not defineframe-src
, hencedefault-src
is used, which only allows'self'
. This means thatdata:
src foriframe
is not allowed, which prohibits templates from being rendered in restrictive mode. This is also be demonstrated on "After the change" video below.Depending on how wanted this feature is it can either be fixed or deprecated with a notice that it doesn't work in CSP restrictive mode.
Alternatively CSP plugin could define
frame-src
policy that we'd consider safe (probably a question to @jenkinsci/core-security-review what sources would be safe). I have doubts thatdata:
will make it into the list of safe sources.Testing done
Before the change
After the change
Submitter checklist