[ https://issues.apache.org/jira/browse/WW-5400?focusedWorklogId=914318&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-914318 ]
ASF GitHub Bot logged work on WW-5400: -------------------------------------- Author: ASF GitHub Bot Created on: 12/Apr/24 05:34 Start Date: 12/Apr/24 05:34 Worklog Time Spent: 10m Work Description: lukaszlenart commented on code in PR #913: URL: https://github.com/apache/struts/pull/913#discussion_r1562033229 ########## core/src/main/java/org/apache/struts2/interceptor/csp/CspInterceptor.java: ########## @@ -124,4 +153,11 @@ public void setPrependServletContext(boolean prependServletContext) { this.prependServletContext = prependServletContext; } -} + /** + * Sets the class name of the default {@link CspSettings} implementation to use when the action does not + * set its own values. If not set, the default is {@link DefaultCspSettings}. + */ + public void setDefaultCspSettingsClassName(String defaultCspSettingsClassName) { + this.defaultCspSettingsClassName = defaultCspSettingsClassName; + } Review Comment: You can use Struts inject mechanism instead of using raw class and creating the instance by yourself. It's all about defining a `<bean name="customCspSettings" class="..."/>` and then annotating the setter with `@Inject("customCspSettings")`. I assume you never played with Struts @Inject, so let's leave it as is and I will change that in the next PR. ########## core/src/main/java/org/apache/struts2/interceptor/csp/CspInterceptor.java: ########## @@ -124,4 +153,11 @@ public void setPrependServletContext(boolean prependServletContext) { this.prependServletContext = prependServletContext; } -} + /** + * Sets the class name of the default {@link CspSettings} implementation to use when the action does not + * set its own values. If not set, the default is {@link DefaultCspSettings}. + */ Review Comment: Please add `@since Struts 6.5.0` [annotation](https://www.oracle.com/pl/technical-resources/articles/java/javadoc-tool.html#@since) ########## core/src/main/java/org/apache/struts2/interceptor/csp/CspSettings.java: ########## @@ -56,6 +57,11 @@ public interface CspSettings { */ void setReportUri(String uri); + /** + * Sets the report group where csp violation reports will be sent + */ Review Comment: Could you add [@since Struts 6.5.0](https://www.oracle.com/pl/technical-resources/articles/java/javadoc-tool.html#@since)? Issue Time Tracking ------------------- Worklog Id: (was: 914318) Time Spent: 50m (was: 40m) > CSP interceptor only allows very limited configuration > ------------------------------------------------------ > > Key: WW-5400 > URL: https://issues.apache.org/jira/browse/WW-5400 > Project: Struts 2 > Issue Type: Improvement > Components: Core Interceptors > Affects Versions: 6.3.0 > Reporter: Erica Kane > Priority: Major > Fix For: 6.5.0 > > Time Spent: 50m > Remaining Estimate: 0h > > I have been trying to implement CSP on our website. The CSP interceptor > provides an elegant solution with the <s:script> and <s:link> tags. However, > I want to set my own base-uri. And perhaps make some other changes to the CSP > headers. > But these values are not accessible. Only the report-only and report-uri can > be changed. Even if one is willing to work at the Action level and implement > a new interface for all of them, I can't change the base-uri. I've seen > people on Stack Overflow disable it for this reason. I want to use it, but > could someone please explain how to set the base-uri globally? If not, I will > likely have to make my own. > P.S. I will update the documentation page. Nowhere in the description of the > interceptor does it mention the script and link tags, and without those, it > is useless! -- This message was sent by Atlassian Jira (v8.20.10#820010)