bbende 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_r328337163
##########
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:
Should we be somehow skipping over the webApiContext since we are handling
that a different way?
I suppose it doesn't really matter, but I think we end up with the web-api
having both sets of filters, but never reaching these since they end up after
Jersey.
----------------------------------------------------------------
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