Skip to content

Commit

Permalink
Add ContentSecurityPolicyFilter.registerAllowedSources() (#239)
Browse files Browse the repository at this point in the history
* Add ContentSecurityPolicyFilter.registerAllowedSources()
* Modify ContentSecurityPolicyFilter
  • Loading branch information
bbimber authored Feb 21, 2025
1 parent b2d159b commit 78b6341
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 4 additions & 1 deletion mGAP/src/org/labkey/mgap/mGAPModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
import org.labkey.api.ldk.notification.NotificationService;
import org.labkey.api.module.ModuleContext;
import org.labkey.api.query.FieldKey;
import org.labkey.api.security.Directive;
import org.labkey.api.sequenceanalysis.SequenceAnalysisService;
import org.labkey.api.sequenceanalysis.pipeline.SequencePipelineService;
import org.labkey.api.util.PageFlowUtil;
Expand Down Expand Up @@ -107,7 +108,9 @@ public void doStartupAfterSpringConfig(ModuleContext moduleContext)

SystemMaintenance.addTask(new mGapMaintenanceTask());

ContentSecurityPolicyFilter.registerAllowedConnectionSource(this.getClass().getName(), "https://*.fontawesome.com", "https://code.jquery.com", "https://www.gstatic.com");
ContentSecurityPolicyFilter.registerAllowedSources(Directive.Connection, this.getClass().getName(), "https://code.jquery.com", "https://*.fontawesome.com");
ContentSecurityPolicyFilter.registerAllowedSources(Directive.Style, this.getClass().getName(), "https://code.jquery.com", "https://www.gstatic.com");
ContentSecurityPolicyFilter.registerAllowedSources(Directive.Font, this.getClass().getName(), "https://*.fontawesome.com");

new PipelineStartup();
}
Expand Down
5 changes: 4 additions & 1 deletion mcc/src/org/labkey/mcc/MccModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import org.labkey.api.module.ModuleContext;
import org.labkey.api.query.DefaultSchema;
import org.labkey.api.query.QuerySchema;
import org.labkey.api.security.Directive;
import org.labkey.api.security.permissions.ReadPermission;
import org.labkey.api.security.roles.RoleManager;
import org.labkey.api.study.Study;
Expand Down Expand Up @@ -137,7 +138,9 @@ protected void doStartupAfterSpringConfig(ModuleContext moduleContext)

SystemMaintenance.addTask(new MccMaintenanceTask());

ContentSecurityPolicyFilter.registerAllowedConnectionSource(this.getClass().getName(), "https://cdn.datatables.net");
ContentSecurityPolicyFilter.registerAllowedSources(Directive.Connection, this.getClass().getName(), "https://cdn.datatables.net");
ContentSecurityPolicyFilter.registerAllowedSources(Directive.Style, this.getClass().getName(), "https://cdn.datatables.net");
ContentSecurityPolicyFilter.registerAllowedSources(Directive.Image, this.getClass().getName(), "https://cdn.datatables.net");
}

@Override
Expand Down

0 comments on commit 78b6341

Please sign in to comment.