-
Notifications
You must be signed in to change notification settings - Fork 7
A couple more CSP enhancements #6809
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
base: release25.7-SNAPSHOT
Are you sure you want to change the base?
Conversation
@@ -94,7 +94,7 @@ public HtmlOutputView(ParamReplacement param, String label) | |||
protected String renderInternalAsString(File file) throws Exception | |||
{ | |||
if (exists(file)) | |||
return PageFlowUtil.getFileContentsAsString(file); | |||
return PageFlowUtil.addScriptNonces(PageFlowUtil.getFileContentsAsString(file)); |
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.
This seems fine. I'm curious about all the R caching scenarios, but I think this happens "late".
*/ | ||
public static String addScriptNonces(String html) | ||
{ | ||
Document doc = JSoupUtil.convertHtmlToDocument(StringUtils.trimToEmpty(html), false, new LinkedList<>()); |
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.
Of course this will do various transformations to the code if it is not well-formed. I guess I'm alright with that.
Rationale
Two enhancements to address strict CSP limitations:
object-src: 'none' ;
directive, providing allowed hosts. https://www.labkey.org/home/Developer/issues/issues-details.view?issueId=53226<script>
tags. https://www.labkey.org/home/Developer/issues/issues-details.view?issueId=53211Related Pull Requests
Tasks