Make JS and CSS URLs work when Jenkins 2.539+ enforce CSP protections #281
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.
This allows loading admin-specified JS and CSS URLs from anywhere by allowing the specific configured URLs for the respective kind of element.
Resolves #280.
Testing done
Interactively played with it, URLs loaded, log output and header values are as expected.
A known limitation of this is is that any transitive inclusions in the specified files would not be allowed, as well as any other
*-srcrequired to work. Examples:eval, that would still require'unsafe-eval'.url(…)for a bunch of CSS directives (unless they point back to'self'I guess).There's always CSP plugin to allow your directives through configuration. And of course, writing a custom theme plugin is also doable. But this should take care of the folks who have fairly modest theming needs.
Submitter checklist