Plamen Totev
2015-07-12 d0bb38c765274b1c889a429616d4da2b478cdbd2
src/main/java/com/gitblit/guice/WebModule.java
@@ -18,7 +18,9 @@
import java.util.HashMap;
import java.util.Map;
import com.gitblit.AvatarGenerator;
import com.gitblit.Constants;
import com.gitblit.servlet.AccessDeniedServlet;
import com.gitblit.servlet.BranchGraphServlet;
import com.gitblit.servlet.DownloadZipFilter;
import com.gitblit.servlet.DownloadZipServlet;
@@ -55,6 +57,10 @@
   @Override
   protected void configureServlets() {
      // bind web component providers
      bind(AvatarGenerator.class).toProvider(AvatarGeneratorProvider.class);
      // servlets
      serve(fuzzy(Constants.R_PATH), fuzzy(Constants.GIT_PATH)).with(GitServlet.class);
      serve(fuzzy(Constants.RAW_PATH)).with(RawServlet.class);
@@ -70,6 +76,17 @@
      serve("/robots.txt").with(RobotsTxtServlet.class);
      serve("/logo.png").with(LogoServlet.class);
      /* Prevent accidental access to 'resources' such as GitBlit java classes
       *
       * In the GO setup the JAR containing the application and the WAR injected
       * into Jetty are the same file. However Jetty expects to serve the entire WAR
       * contents, except the WEB-INF folder. Thus, all java binary classes in the
       * JAR are served by default as is they were legitimate resources.
       *
       * The below servlet mappings prevent that behavior
       */
      serve(fuzzy("/com/")).with(AccessDeniedServlet.class);
      // global filters
      filter(ALL).through(ProxyFilter.class);
      filter(ALL).through(EnforceAuthenticationFilter.class);