thenatog commented on a change in pull request #231: NIFIREG-320 - Added jetty
header filters to set security headers. Set…
URL: https://github.com/apache/nifi-registry/pull/231#discussion_r328401394
##########
File path:
nifi-registry-core/nifi-registry-jetty/src/main/java/org/apache/nifi/registry/jetty/JettyServer.java
##########
@@ -301,6 +338,15 @@ private WebAppContext loadWar(final File warFile, final
String contextPath, fina
// configure the max form size (3x the default)
webappContext.setMaxFormContentSize(600000);
+ // add HTTP security headers to all responses
+ final String ALL_PATHS = "/*";
+ ArrayList<Class<? extends Filter>> filters = new
ArrayList<>(Arrays.asList(XFrameOptionsFilter.class,
ContentSecurityPolicyFilter.class, XSSProtectionFilter.class));
+ if(properties.isHTTPSConfigured()) {
+ filters.add(StrictTransportSecurityFilter.class);
+ }
+
+ filters.forEach( (filter) -> addFilters(filter, ALL_PATHS,
webappContext));
Review comment:
I didn't check what the context looks like after using the spring security
settings, but it doesn't appear to affect much using both. I can skip over it
if you think that's better.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services