snoopdave commented on code in PR #189:
URL: https://github.com/apache/roller/pull/189#discussion_r4005803913


##########
app/src/main/java/org/apache/roller/weblogger/ui/core/filters/BootstrapSecurityFilter.java:
##########
@@ -0,0 +1,29 @@
+package org.apache.roller.weblogger.ui.core.filters;
+
+import java.io.IOException;
+import javax.servlet.*;
+import javax.servlet.http.*;
+import org.apache.roller.weblogger.business.WebloggerFactory;
+import org.apache.roller.weblogger.ui.core.security.BootstrapSecurity;
+
+/** Prevents anonymous access to installer and first-user actions. */
+public class BootstrapSecurityFilter implements Filter {
+    public void doFilter(ServletRequest req, ServletResponse res, FilterChain 
chain) throws IOException, ServletException {
+        HttpServletRequest r = (HttpServletRequest) req;
+        HttpServletResponse p = (HttpServletResponse) res;
+        String uri = r.getRequestURI();
+        boolean tokenPage = uri != null && 
(uri.endsWith("/bootstrap-token.rol")
+                || uri.endsWith("/bootstrap-token!redeem.rol"));
+        boolean installer = uri != null && (tokenPage || 
uri.contains("/roller-ui/install/")
+                || uri.endsWith("/roller-ui/register.rol")
+                || uri.endsWith("/roller-ui/register!save.rol")

Review Comment:
   🐞Codex Issue: **Blocking:** The gate only matches `/register.rol` and 
`/register!save.rol`, but Struts dynamic method invocation also exposes URLs 
such as `/register!execute.rol` and `/register!activate.rol`. Those direct 
routes can reach the initial registration flow without the token. Gate the 
resolved register action/method (or reject all register methods while bootstrap 
is incomplete) and add regression coverage for every allowed method.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to