A gadget I constructed was recently rejected by the gallery with only this explanation:
"Your gadget wasn't accepted because it looks like it could be vulnerable to malicious attacks. Go to the developer center for ideas about how to make your gadget more secure"
I read in the recent thread titled "Something wrong with submission process" that some gadgets may be being arbitrarily rejected with this explanation. However, I'm not certain that is the case with my gadget and I'd like to at least follow all of the available security recommendations before I resubmit.
This page:
http://msdn2.microsoft.com/en-us/security/bb498012.aspx
suggests validating and sanitizing any "untrusted data" using javascript functions which it provides. My gadget reads an rss feed from a trusted source but I guess any remote source is considered untrusted.
My gadget creates an ActiveXObject and uses it to poulate an rss xml array. The javascript functions suggested in the above link clean and/or validate strings. My question: from a gallery approval standpoint, should I validate each string as it is parsed from the array, or must the array be somehow sanitized sooner than this And if so, how would that be done I'm not sure what the approvers are looking for but i want to cover the bases before I resubmit.
If anyone else has experience with this issue, i would appreciate hearing thoughts on this.
Here is the relavent (unsanitized) code from my gadget:
function getRSS() {
loading.innerText = "Connecting...";
rssObj = new ActiveXObject("Msxml2.XMLHTTP");
rssObj.open("GET", rssSource + " f=" + Math.random(), true); //random number added to dummy querystring to prevent reading file from cache
rssObj.onreadystatechange = function() {
if (rssObj.readyState === 4) {
if (rssObj.status === 200) {
loading.innerText = "";
rssXML = rssObj.responseXML;
parseRSS();
if (chkConn) { clearInterval(chkConn); }
} else {
var chkConn;
loading.innerText = "No connection";
chkConn = setInterval(getRSS, 30000);
}
} else {
loading.innerText = "Connecting...";
}
}
rssObj.send(null);
}
function parseRSS() {
start = 0;
end = 5;
rssItems = rssXML.getElementsByTagName("item");
rssTitle = null; rssDate = null;
for (i=start; i<end; i++) {
rssTitle = rssItems[i].firstChild.text;
rssDate = rssItems[i].getElementsByTagName("pubDate"); rssDate = rssDate[0].text.split(" ");
rssDate = rssDate[0] + " " + rssDate[1] + " " + rssDate[2] + " " + rssDate[3];
document.getElementById("cell" + (i)).innerHTML = '<div onClick=\"showFlyout(' + i + ');\">' + rssDate + '<div class="title">' + rssTitle + '</div></div>';
}
}
Thanks for any suggestions on how I can get this puppy approved.