return (false);
}
if (urlPattern.startsWith("*.")) {
- if (urlPattern.indexOf('/') < 0)
+ if (urlPattern.indexOf('/') < 0) {
+ checkUnusualURLPattern(urlPattern);
return (true);
- else
+ } else
return (false);
}
if ( (urlPattern.startsWith("/")) &&
- (urlPattern.indexOf("*.") < 0))
+ (urlPattern.indexOf("*.") < 0)) {
+ checkUnusualURLPattern(urlPattern);
return (true);
- else
+ } else
return (false);
}
+ /**
+ * Check for unusual but valid <code><url-pattern></code>s.
+ * See Bugzilla 34805, 43079 & 43080
+ */
+ private void checkUnusualURLPattern(String urlPattern) {
+ if (log.isInfoEnabled()) {
+ if(urlPattern.endsWith("*") && (urlPattern.length() < 2 ||
+ urlPattern.charAt(urlPattern.length()-2) != '/')) {
+ log.info("Suspicious url pattern: \"" + urlPattern + "\"" +
+ " in context [" + getName() + "] - see" +
+ " section SRV.11.2 of the Servlet specification" );
+ }
+ }
+ }
+
+
// ------------------------------------------------------------- Operations
import org.apache.catalina.util.RequestUtil;
-import org.apache.juli.logging.Log;
-import org.apache.juli.logging.LogFactory;
-
import java.io.Serializable;
public class SecurityCollection implements Serializable {
- private static Log log = LogFactory.getLog(SecurityCollection.class);
-
-
// ----------------------------------------------------------- Constructors
if (pattern == null)
return;
- // Bugzilla 34805: add friendly warning.
- if(pattern.endsWith("*")) {
- if (pattern.charAt(pattern.length()-1) != '/') {
- if (log.isDebugEnabled()) {
- log.warn("Suspicious url pattern: \"" + pattern + "\"" +
- " - see http://java.sun.com/aboutJava/communityprocess/first/jsr053/servlet23_PFD.pdf" +
- " section 11.2" );
- }
- }
- }
-
pattern = RequestUtil.URLDecode(pattern);
String results[] = new String[patterns.length + 1];
for (int i = 0; i < patterns.length; i++) {