You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by mg...@apache.org on 2013/06/19 09:48:09 UTC

svn commit: r1494486 - /wicket/common/site/apidocs/1.5/index.html

Author: mgrigorov
Date: Wed Jun 19 07:48:08 2013
New Revision: 1494486

URL: http://svn.apache.org/r1494486
Log:
Fix javadocs agains frame injection (http://www.kb.cert.org/vuls/id/225657)


Modified:
    wicket/common/site/apidocs/1.5/index.html

Modified: wicket/common/site/apidocs/1.5/index.html
URL: http://svn.apache.org/viewvc/wicket/common/site/apidocs/1.5/index.html?rev=1494486&r1=1494485&r2=1494486&view=diff
==============================================================================
--- wicket/common/site/apidocs/1.5/index.html (original)
+++ wicket/common/site/apidocs/1.5/index.html Wed Jun 19 07:48:08 2013
@@ -13,6 +13,42 @@ Wicket Parent 1.5-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;