You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by se...@apache.org on 2013/06/19 11:55:27 UTC

svn commit: r866328 - /websites/production/commons/content/proper/commons-csv/apidocs/index.html

Author: sebb
Date: Wed Jun 19 09:55:27 2013
New Revision: 866328

Log:
Apply fix for CVE-2013-1571, a frame injection attack

Modified:
    websites/production/commons/content/proper/commons-csv/apidocs/index.html

Modified: websites/production/commons/content/proper/commons-csv/apidocs/index.html
==============================================================================
--- websites/production/commons/content/proper/commons-csv/apidocs/index.html (original)
+++ websites/production/commons/content/proper/commons-csv/apidocs/index.html Wed Jun 19 09:55:27 2013
@@ -12,6 +12,42 @@ Commons CSV 1.0-SNAPSHOT API
         targetPage = targetPage.substring(1);
     if (targetPage.indexOf(":") != -1)
         targetPage = "undefined";
+    if (targetPage != "" && !validURL(targetPage))
+        targetPage = "undefined";
+    function validURL(url) {
+        var pos = url.indexOf(".html");
+        if (pos == -1 || pos != url.length - 5)
+            return false;
+        var allowNumber = false;
+        var allowSep = false;
+        var seenDot = false;
+        for (var i = 0; i < url.length - 5; i++) {
+            var ch = url.charAt(i);
+            if ('a' <= ch && ch <= 'z' ||
+                    'A' <= ch && ch <= 'Z' ||
+                    ch == '$' ||
+                    ch == '_') {
+                allowNumber = true;
+                allowSep = true;
+            } else if ('0' <= ch && ch <= '9'
+                    || ch == '-') {
+                if (!allowNumber)
+                     return false;
+            } else if (ch == '/' || ch == '.') {
+                if (!allowSep)
+                    return false;
+                allowNumber = false;
+                allowSep = false;
+                if (ch == '.')
+                     seenDot = true;
+                if (ch == '/' && seenDot)
+                     return false;
+            } else {
+                return false;
+            }
+        }
+        return true;
+    }
     function loadFrames() {
         if (targetPage != "" && targetPage != "undefined")
              top.classFrame.location = top.targetPage;
@@ -33,4 +69,4 @@ This document is designed to be viewed u
 Link to<A HREF="org/apache/commons/csv/package-summary.html">Non-frame version.</A>
 </NOFRAMES>
 </FRAMESET>
-</HTML>
\ No newline at end of file
+</HTML>