Skip to content

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

Open
wants to merge 7 commits into
base: release25.7-SNAPSHOT
Choose a base branch
from

Conversation

labkey-adam
Copy link
Contributor

@labkey-adam labkey-adam commented Jun 30, 2025

Rationale

Two enhancements to address strict CSP limitations:

  1. Ability to override object-src: 'none' ; directive, providing allowed hosts. https://www.labkey.org/home/Developer/issues/issues-details.view?issueId=53226
  2. Inject nonce attributes and values into R report HTML outputs that have <script> tags. https://www.labkey.org/home/Developer/issues/issues-details.view?issueId=53211

Related Pull Requests

Tasks

@@ -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));
Copy link
Contributor

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<>());
Copy link
Contributor

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.

@labkey-adam labkey-adam changed the base branch from develop to release25.7-SNAPSHOT July 3, 2025 15:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants