Return-Path: Delivered-To: apmail-geronimo-scm-archive@www.apache.org Received: (qmail 99622 invoked from network); 21 Jun 2010 09:51:30 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 21 Jun 2010 09:51:30 -0000 Received: (qmail 32592 invoked by uid 500); 21 Jun 2010 09:51:30 -0000 Delivered-To: apmail-geronimo-scm-archive@geronimo.apache.org Received: (qmail 32465 invoked by uid 500); 21 Jun 2010 09:51:27 -0000 Mailing-List: contact scm-help@geronimo.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: dev@geronimo.apache.org List-Id: Delivered-To: mailing list scm@geronimo.apache.org Received: (qmail 32458 invoked by uid 99); 21 Jun 2010 09:51:26 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 21 Jun 2010 09:51:26 +0000 X-ASF-Spam-Status: No, hits=-1784.4 required=10.0 tests=ALL_TRUSTED,AWL X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 21 Jun 2010 09:51:26 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id AC80A2388A32; Mon, 21 Jun 2010 09:50:40 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r956522 - /geronimo/server/branches/2.1/plugins/console/console-filter/src/main/java/org/apache/geronimo/console/filter/XSSHandler.java Date: Mon, 21 Jun 2010 09:50:40 -0000 To: scm@geronimo.apache.org From: rwonly@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20100621095040.AC80A2388A32@eris.apache.org> Author: rwonly Date: Mon Jun 21 09:50:40 2010 New Revision: 956522 URL: http://svn.apache.org/viewvc?rev=956522&view=rev Log: GERONIMO-5384 Geronimo console doesn't seem to handle % in sql statements right. Modified: geronimo/server/branches/2.1/plugins/console/console-filter/src/main/java/org/apache/geronimo/console/filter/XSSHandler.java Modified: geronimo/server/branches/2.1/plugins/console/console-filter/src/main/java/org/apache/geronimo/console/filter/XSSHandler.java URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.1/plugins/console/console-filter/src/main/java/org/apache/geronimo/console/filter/XSSHandler.java?rev=956522&r1=956521&r2=956522&view=diff ============================================================================== --- geronimo/server/branches/2.1/plugins/console/console-filter/src/main/java/org/apache/geronimo/console/filter/XSSHandler.java (original) +++ geronimo/server/branches/2.1/plugins/console/console-filter/src/main/java/org/apache/geronimo/console/filter/XSSHandler.java Mon Jun 21 09:50:40 2010 @@ -77,7 +77,7 @@ public class XSSHandler { // these parameter value(s) which can allow < and " usage String[] vals = hreq.getParameterValues(name); for (String value : vals) { - if (isInvalidParam(value)) { + if (isInvalidParamLmt(value)) { // should be safe to log the uri, as we've already run isInvalidURI() on it log.warn("Blocking request due to known XSS content in parameter=" + name + " for uri=" + hreq.getRequestURI()); return true; @@ -87,7 +87,7 @@ public class XSSHandler { else { String[] vals = hreq.getParameterValues(name); for (String value : vals) { - if (isInvalidString(value)) { + if (isInvalidParam(value)) { // should be safe to log the uri, as we've already run isInvalidURI() on it log.warn("Blocking request due to potential XSS content in parameter=" + name + " for uri=" + hreq.getRequestURI()); return true; @@ -119,9 +119,25 @@ public class XSSHandler { } return false; } + + /** + * This is a copy of isInvalidString expect the elimination of URLDecoder. + * Searches the given string for any < or " instances + * @param value + * @return true if we find < or " anywhere in the string, otherwise false + */ + private boolean isInvalidParam(String value) { + if (value != null) { + String s = value.toLowerCase(); + if ((s.indexOf('<') != -1) || (s.indexOf('"') != -1)) { + return true; + } + } + return false; + } /** - * More limited version of the isInvalidString() method, in which we only + * More limited version of the isInvalidParam() method, in which we only * check for: