changeset 75:170cd1109ea6

Fixed Bug 575805 - Stored Cross Site Scripting in MarkDown URLs (Actually, this fixes xss vulns in the profileImageURL and headshot URLs; the fix for Bug 575792 in rev 1f03c20b2510 fixed the xss vuln in Markdown URLs.)
author Atul Varma <avarma@mozilla.com>
date Wed, 30 Jun 2010 14:23:18 -0700
parents c95fab1bf593
children 3936385d6c16
files static-files/js/index.js
diffstat 1 files changed, 14 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/static-files/js/index.js	Wed Jun 30 09:43:17 2010 -0700
+++ b/static-files/js/index.js	Wed Jun 30 14:23:18 2010 -0700
@@ -22,9 +22,23 @@
       }
     }
 
+    function isUrlSafe(url) {
+      if (typeof(url) != "string")
+        return false;
+      return (url.match("^https?://") != null);
+    }
+
     function normalizeUserInfo(userInfo) {
       if (!(userInfo.interests && jQuery.isArray(userInfo.interests)))
         userInfo.interests = [];
+
+      ["profileImageURL",
+       "websiteURL"].forEach(
+         function(prop) {
+           if (prop in userInfo)
+             if (!isUrlSafe(userInfo[prop]))
+               delete userInfo[prop];
+         });
     }
 
     function fillUserInfo() {