You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@druid.apache.org by GitBox <gi...@apache.org> on 2022/12/03 16:04:30 UTC

[GitHub] [druid] abhishekagarwal87 opened a new pull request, #13489: Add an option to enable HSTS in druid services

abhishekagarwal87 opened a new pull request, #13489:
URL: https://github.com/apache/druid/pull/13489

   
   
   This PR has:
   
   - [ ] been self-reviewed.
      - [ ] using the [concurrency checklist](https://github.com/apache/druid/blob/master/dev/code-review/concurrency.md) (Remove this item if the PR doesn't have any relation to concurrency.)
   - [ ] added documentation for new or modified features or behaviors.
   - [ ] a release note entry in the PR description.
   - [ ] added Javadocs for most classes and all non-trivial methods. Linked related entities via Javadoc links.
   - [ ] added or updated version, license, or notice information in [licenses.yaml](https://github.com/apache/druid/blob/master/dev/license.md)
   - [ ] added comments explaining the "why" and the intent of the code wherever would not be obvious for an unfamiliar reader.
   - [ ] added unit tests or modified existing tests to cover new code paths, ensuring the threshold for [code coverage](https://github.com/apache/druid/blob/master/dev/code-review/code-coverage.md) is met.
   - [ ] added integration tests.
   - [ ] been tested in a test Druid cluster.
   


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org


[GitHub] [druid] cryptoe commented on a diff in pull request #13489: Add an option to enable HSTS in druid services

Posted by GitBox <gi...@apache.org>.
cryptoe commented on code in PR #13489:
URL: https://github.com/apache/druid/pull/13489#discussion_r1065341464


##########
server/src/main/java/org/apache/druid/server/initialization/jetty/JettyServerInitUtils.java:
##########
@@ -122,4 +127,25 @@ public static void addAllowHttpMethodsFilter(ServletContextHandler root, List<St
         null
     );
   }
+  
+  public static void maybeAddHSTSPatternRule(ServerConfig serverConfig, RewriteHandler rewriteHandler)
+  {
+    if (serverConfig.isEnableHSTS()) {
+      rewriteHandler.addRule(getHSTSHeaderPattern());
+    }
+  }
+
+  public static void maybeAddHSTSRewriteHandler(ServerConfig serverConfig, HandlerList handlerList)
+  {
+    if (serverConfig.isEnableHSTS()) {
+      RewriteHandler rewriteHandler = new RewriteHandler();
+      rewriteHandler.addRule(getHSTSHeaderPattern());
+      handlerList.addHandler(rewriteHandler);
+    }
+  }
+
+  private static HeaderPatternRule getHSTSHeaderPattern()
+  {
+    return new HeaderPatternRule("*", "Strict-Transport-Security", "max-age=63072000; includeSubDomains");

Review Comment:
   +1. We can keep this as default and add a new config param which overrides this. 



-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org


[GitHub] [druid] clintropolis commented on a diff in pull request #13489: Add an option to enable HSTS in druid services

Posted by GitBox <gi...@apache.org>.
clintropolis commented on code in PR #13489:
URL: https://github.com/apache/druid/pull/13489#discussion_r1065334119


##########
server/src/main/java/org/apache/druid/server/initialization/jetty/JettyServerInitUtils.java:
##########
@@ -122,4 +127,25 @@ public static void addAllowHttpMethodsFilter(ServletContextHandler root, List<St
         null
     );
   }
+  
+  public static void maybeAddHSTSPatternRule(ServerConfig serverConfig, RewriteHandler rewriteHandler)
+  {
+    if (serverConfig.isEnableHSTS()) {
+      rewriteHandler.addRule(getHSTSHeaderPattern());
+    }
+  }
+
+  public static void maybeAddHSTSRewriteHandler(ServerConfig serverConfig, HandlerList handlerList)
+  {
+    if (serverConfig.isEnableHSTS()) {
+      RewriteHandler rewriteHandler = new RewriteHandler();
+      rewriteHandler.addRule(getHSTSHeaderPattern());
+      handlerList.addHandler(rewriteHandler);
+    }
+  }
+
+  private static HeaderPatternRule getHSTSHeaderPattern()
+  {
+    return new HeaderPatternRule("*", "Strict-Transport-Security", "max-age=63072000; includeSubDomains");

Review Comment:
   should this be configurable?



-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org


[GitHub] [druid] abhishekagarwal87 commented on a diff in pull request #13489: Add an option to enable HSTS in druid services

Posted by GitBox <gi...@apache.org>.
abhishekagarwal87 commented on code in PR #13489:
URL: https://github.com/apache/druid/pull/13489#discussion_r1065360272


##########
server/src/main/java/org/apache/druid/server/initialization/jetty/JettyServerInitUtils.java:
##########
@@ -122,4 +127,25 @@ public static void addAllowHttpMethodsFilter(ServletContextHandler root, List<St
         null
     );
   }
+  
+  public static void maybeAddHSTSPatternRule(ServerConfig serverConfig, RewriteHandler rewriteHandler)
+  {
+    if (serverConfig.isEnableHSTS()) {
+      rewriteHandler.addRule(getHSTSHeaderPattern());
+    }
+  }
+
+  public static void maybeAddHSTSRewriteHandler(ServerConfig serverConfig, HandlerList handlerList)
+  {
+    if (serverConfig.isEnableHSTS()) {
+      RewriteHandler rewriteHandler = new RewriteHandler();
+      rewriteHandler.addRule(getHSTSHeaderPattern());
+      handlerList.addHandler(rewriteHandler);
+    }
+  }
+
+  private static HeaderPatternRule getHSTSHeaderPattern()
+  {
+    return new HeaderPatternRule("*", "Strict-Transport-Security", "max-age=63072000; includeSubDomains");

Review Comment:
   this is a standard header value. If there is a need for it, we can add a new config option later on. I would like to avoid adding another config param right now. If users ask for it, adding a new config option is easy. 



-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org


[GitHub] [druid] abhishekagarwal87 commented on pull request #13489: Add an option to enable HSTS in druid services

Posted by GitBox <gi...@apache.org>.
abhishekagarwal87 commented on PR #13489:
URL: https://github.com/apache/druid/pull/13489#issuecomment-1377573914

   Merged this since CI was failing because of code coverage. 


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org


[GitHub] [druid] abhishekagarwal87 merged pull request #13489: Add an option to enable HSTS in druid services

Posted by GitBox <gi...@apache.org>.
abhishekagarwal87 merged PR #13489:
URL: https://github.com/apache/druid/pull/13489


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org